1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.createUnequalNumber = exports.createUnequal = void 0;
|
7 |
|
8 | var _factory = require("../../utils/factory.js");
|
9 |
|
10 | var _algorithm = require("../../type/matrix/utils/algorithm03.js");
|
11 |
|
12 | var _algorithm2 = require("../../type/matrix/utils/algorithm07.js");
|
13 |
|
14 | var _algorithm3 = require("../../type/matrix/utils/algorithm12.js");
|
15 |
|
16 | var _algorithm4 = require("../../type/matrix/utils/algorithm14.js");
|
17 |
|
18 | var _algorithm5 = require("../../type/matrix/utils/algorithm13.js");
|
19 |
|
20 | var name = 'unequal';
|
21 | var dependencies = ['typed', 'config', 'equalScalar', 'matrix', 'DenseMatrix'];
|
22 | var createUnequal = (0, _factory.factory)(name, dependencies, function (_ref) {
|
23 | var typed = _ref.typed,
|
24 | config = _ref.config,
|
25 | equalScalar = _ref.equalScalar,
|
26 | matrix = _ref.matrix,
|
27 | DenseMatrix = _ref.DenseMatrix;
|
28 | var algorithm03 = (0, _algorithm.createAlgorithm03)({
|
29 | typed: typed
|
30 | });
|
31 | var algorithm07 = (0, _algorithm2.createAlgorithm07)({
|
32 | typed: typed,
|
33 | DenseMatrix: DenseMatrix
|
34 | });
|
35 | var algorithm12 = (0, _algorithm3.createAlgorithm12)({
|
36 | typed: typed,
|
37 | DenseMatrix: DenseMatrix
|
38 | });
|
39 | var algorithm13 = (0, _algorithm5.createAlgorithm13)({
|
40 | typed: typed
|
41 | });
|
42 | var algorithm14 = (0, _algorithm4.createAlgorithm14)({
|
43 | typed: typed
|
44 | });
|
45 | |
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | return typed('unequal', {
|
90 | 'any, any': function anyAny(x, y) {
|
91 |
|
92 | if (x === null) {
|
93 | return y !== null;
|
94 | }
|
95 |
|
96 | if (y === null) {
|
97 | return x !== null;
|
98 | }
|
99 |
|
100 | if (x === undefined) {
|
101 | return y !== undefined;
|
102 | }
|
103 |
|
104 | if (y === undefined) {
|
105 | return x !== undefined;
|
106 | }
|
107 |
|
108 | return _unequal(x, y);
|
109 | },
|
110 | 'SparseMatrix, SparseMatrix': function SparseMatrixSparseMatrix(x, y) {
|
111 | return algorithm07(x, y, _unequal);
|
112 | },
|
113 | 'SparseMatrix, DenseMatrix': function SparseMatrixDenseMatrix(x, y) {
|
114 | return algorithm03(y, x, _unequal, true);
|
115 | },
|
116 | 'DenseMatrix, SparseMatrix': function DenseMatrixSparseMatrix(x, y) {
|
117 | return algorithm03(x, y, _unequal, false);
|
118 | },
|
119 | 'DenseMatrix, DenseMatrix': function DenseMatrixDenseMatrix(x, y) {
|
120 | return algorithm13(x, y, _unequal);
|
121 | },
|
122 | 'Array, Array': function ArrayArray(x, y) {
|
123 |
|
124 | return this(matrix(x), matrix(y)).valueOf();
|
125 | },
|
126 | 'Array, Matrix': function ArrayMatrix(x, y) {
|
127 |
|
128 | return this(matrix(x), y);
|
129 | },
|
130 | 'Matrix, Array': function MatrixArray(x, y) {
|
131 |
|
132 | return this(x, matrix(y));
|
133 | },
|
134 | 'SparseMatrix, any': function SparseMatrixAny(x, y) {
|
135 | return algorithm12(x, y, _unequal, false);
|
136 | },
|
137 | 'DenseMatrix, any': function DenseMatrixAny(x, y) {
|
138 | return algorithm14(x, y, _unequal, false);
|
139 | },
|
140 | 'any, SparseMatrix': function anySparseMatrix(x, y) {
|
141 | return algorithm12(y, x, _unequal, true);
|
142 | },
|
143 | 'any, DenseMatrix': function anyDenseMatrix(x, y) {
|
144 | return algorithm14(y, x, _unequal, true);
|
145 | },
|
146 | 'Array, any': function ArrayAny(x, y) {
|
147 |
|
148 | return algorithm14(matrix(x), y, _unequal, false).valueOf();
|
149 | },
|
150 | 'any, Array': function anyArray(x, y) {
|
151 |
|
152 | return algorithm14(matrix(y), x, _unequal, true).valueOf();
|
153 | }
|
154 | });
|
155 |
|
156 | function _unequal(x, y) {
|
157 | return !equalScalar(x, y);
|
158 | }
|
159 | });
|
160 | exports.createUnequal = createUnequal;
|
161 | var createUnequalNumber = (0, _factory.factory)(name, ['typed', 'equalScalar'], function (_ref2) {
|
162 | var typed = _ref2.typed,
|
163 | equalScalar = _ref2.equalScalar;
|
164 | return typed(name, {
|
165 | 'any, any': function anyAny(x, y) {
|
166 |
|
167 | if (x === null) {
|
168 | return y !== null;
|
169 | }
|
170 |
|
171 | if (y === null) {
|
172 | return x !== null;
|
173 | }
|
174 |
|
175 | if (x === undefined) {
|
176 | return y !== undefined;
|
177 | }
|
178 |
|
179 | if (y === undefined) {
|
180 | return x !== undefined;
|
181 | }
|
182 |
|
183 | return !equalScalar(x, y);
|
184 | }
|
185 | });
|
186 | });
|
187 | exports.createUnequalNumber = createUnequalNumber; |
\ | No newline at end of file |