Fixed lower case naming of MatrixIndex

This commit is contained in:
jos 2018-06-13 16:17:06 +02:00
parent f1ce473457
commit c2518dcf60
9 changed files with 22 additions and 22 deletions

View File

@ -3,7 +3,7 @@
const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const matrix = load(require('../../type/matrix/DenseMatrix'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -33,7 +33,7 @@ function factory (type, config, load, typed) {
'Array | Matrix, Array | Matrix': function (a1, a2) {
let result = []
if (subset(size(a1), new index(0)) !== 0 && subset(size(a2), new index(0)) !== 0) { // if any of them is empty, return empty
if (subset(size(a1), new MatrixIndex(0)) !== 0 && subset(size(a2), new MatrixIndex(0)) !== 0) { // if any of them is empty, return empty
const b1 = flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural)
const b2 = flatten(Array.isArray(a2) ? a2 : a2.toArray()).sort(compareNatural)
result = []

View File

@ -5,7 +5,7 @@ const identify = require('../../utils/array').identify
const generalize = require('../../utils/array').generalize
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const matrix = load(require('../../type/matrix/DenseMatrix'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -35,9 +35,9 @@ function factory (type, config, load, typed) {
const setDifference = typed('setDifference', {
'Array | Matrix, Array | Matrix': function (a1, a2) {
let result
if (subset(size(a1), new index(0)) === 0) { // empty-anything=empty
if (subset(size(a1), new MatrixIndex(0)) === 0) { // empty-anything=empty
result = []
} else if (subset(size(a2), new index(0)) === 0) { // anything-empty=anything
} else if (subset(size(a2), new MatrixIndex(0)) === 0) { // anything-empty=anything
return flatten(a1.toArray())
} else {
const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))

View File

@ -3,7 +3,7 @@
const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const matrix = load(require('../../type/matrix/DenseMatrix'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -31,7 +31,7 @@ function factory (type, config, load, typed) {
const setDistinct = typed('setDistinct', {
'Array | Matrix': function (a) {
let result
if (subset(size(a), new index(0)) === 0) { // if empty, return empty
if (subset(size(a), new MatrixIndex(0)) === 0) { // if empty, return empty
result = []
} else {
const b = flatten(Array.isArray(a) ? a : a.toArray()).sort(compareNatural)

View File

@ -5,7 +5,7 @@ const identify = require('../../utils/array').identify
const generalize = require('../../utils/array').generalize
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const matrix = load(require('../../type/matrix/DenseMatrix'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -35,7 +35,7 @@ function factory (type, config, load, typed) {
const setIntersect = typed('setIntersect', {
'Array | Matrix, Array | Matrix': function (a1, a2) {
let result
if (subset(size(a1), new index(0)) === 0 || subset(size(a2), new index(0)) === 0) { // of any of them is empty, return empty
if (subset(size(a1), new MatrixIndex(0)) === 0 || subset(size(a2), new MatrixIndex(0)) === 0) { // of any of them is empty, return empty
result = []
} else {
const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))

View File

@ -4,7 +4,7 @@ const flatten = require('../../utils/array').flatten
const identify = require('../../utils/array').identify
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
const compareNatural = load(require('../relational/compareNatural'))
@ -32,9 +32,9 @@ function factory (type, config, load, typed) {
*/
const setIsSubset = typed('setIsSubset', {
'Array | Matrix, Array | Matrix': function (a1, a2) {
if (subset(size(a1), new index(0)) === 0) { // empty is a subset of anything
if (subset(size(a1), new MatrixIndex(0)) === 0) { // empty is a subset of anything
return true
} else if (subset(size(a2), new index(0)) === 0) { // anything is not a subset of empty
} else if (subset(size(a2), new MatrixIndex(0)) === 0) { // anything is not a subset of empty
return false
}
const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))

View File

@ -4,7 +4,7 @@ const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const compareNatural = load(require('../relational/compareNatural'))
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -31,7 +31,7 @@ function factory (type, config, load, typed) {
*/
const setMultiplicity = typed('setMultiplicity', {
'number | BigNumber | Fraction | Complex, Array | Matrix': function (e, a) {
if (subset(size(a), new index(0)) === 0) { // if empty, return 0
if (subset(size(a), new MatrixIndex(0)) === 0) { // if empty, return 0
return 0
}
const b = flatten(Array.isArray(a) ? a : a.toArray())

View File

@ -3,7 +3,7 @@
const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
const compareNatural = load(require('../relational/compareNatural'))
@ -29,7 +29,7 @@ function factory (type, config, load, typed) {
*/
const setPowerset = typed('setPowerset', {
'Array | Matrix': function (a) {
if (subset(size(a), new index(0)) === 0) { // if empty, return empty
if (subset(size(a), new MatrixIndex(0)) === 0) { // if empty, return empty
return []
}
const b = flatten(Array.isArray(a) ? a : a.toArray()).sort(compareNatural)

View File

@ -3,7 +3,7 @@
const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const concat = load(require('../matrix/concat'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -32,9 +32,9 @@ function factory (type, config, load, typed) {
*/
const setSymDifference = typed('setSymDifference', {
'Array | Matrix, Array | Matrix': function (a1, a2) {
if (subset(size(a1), new index(0)) === 0) { // if any of them is empty, return the other one
if (subset(size(a1), new MatrixIndex(0)) === 0) { // if any of them is empty, return the other one
return flatten(a2)
} else if (subset(size(a2), new index(0)) === 0) {
} else if (subset(size(a2), new MatrixIndex(0)) === 0) {
return flatten(a1)
}
const b1 = flatten(a1)

View File

@ -3,7 +3,7 @@
const flatten = require('../../utils/array').flatten
function factory (type, config, load, typed) {
const index = load(require('../../type/matrix/MatrixIndex'))
const MatrixIndex = load(require('../../type/matrix/MatrixIndex'))
const concat = load(require('../matrix/concat'))
const size = load(require('../matrix/size'))
const subset = load(require('../matrix/subset'))
@ -33,9 +33,9 @@ function factory (type, config, load, typed) {
*/
const setUnion = typed('setUnion', {
'Array | Matrix, Array | Matrix': function (a1, a2) {
if (subset(size(a1), new index(0)) === 0) { // if any of them is empty, return the other one
if (subset(size(a1), new MatrixIndex(0)) === 0) { // if any of them is empty, return the other one
return flatten(a2)
} else if (subset(size(a2), new index(0)) === 0) {
} else if (subset(size(a2), new MatrixIndex(0)) === 0) {
return flatten(a1)
}
const b1 = flatten(a1)