1 | import { factory } from '../../utils/factory';
|
2 | import { createAlgorithm02 } from '../../type/matrix/utils/algorithm02';
|
3 | import { createAlgorithm03 } from '../../type/matrix/utils/algorithm03';
|
4 | import { createAlgorithm05 } from '../../type/matrix/utils/algorithm05';
|
5 | import { createAlgorithm11 } from '../../type/matrix/utils/algorithm11';
|
6 | import { createAlgorithm12 } from '../../type/matrix/utils/algorithm12';
|
7 | import { createAlgorithm13 } from '../../type/matrix/utils/algorithm13';
|
8 | import { createAlgorithm14 } from '../../type/matrix/utils/algorithm14';
|
9 | import { modNumber } from '../../plain/number';
|
10 | var name = 'mod';
|
11 | var dependencies = ['typed', 'matrix', 'equalScalar', 'DenseMatrix'];
|
12 | export var createMod =
|
13 |
|
14 | factory(name, dependencies, function (_ref) {
|
15 | var typed = _ref.typed,
|
16 | matrix = _ref.matrix,
|
17 | equalScalar = _ref.equalScalar,
|
18 | DenseMatrix = _ref.DenseMatrix;
|
19 | var algorithm02 = createAlgorithm02({
|
20 | typed: typed,
|
21 | equalScalar: equalScalar
|
22 | });
|
23 | var algorithm03 = createAlgorithm03({
|
24 | typed: typed
|
25 | });
|
26 | var algorithm05 = createAlgorithm05({
|
27 | typed: typed,
|
28 | equalScalar: equalScalar
|
29 | });
|
30 | var algorithm11 = createAlgorithm11({
|
31 | typed: typed,
|
32 | equalScalar: equalScalar
|
33 | });
|
34 | var algorithm12 = createAlgorithm12({
|
35 | typed: typed,
|
36 | DenseMatrix: DenseMatrix
|
37 | });
|
38 | var algorithm13 = createAlgorithm13({
|
39 | typed: typed
|
40 | });
|
41 | var algorithm14 = createAlgorithm14({
|
42 | typed: typed
|
43 | });
|
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 | var mod = typed(name, {
|
81 | 'number, number': modNumber,
|
82 | 'BigNumber, BigNumber': function BigNumberBigNumber(x, y) {
|
83 | return y.isZero() ? x : x.mod(y);
|
84 | },
|
85 | 'Fraction, Fraction': function FractionFraction(x, y) {
|
86 | return x.mod(y);
|
87 | },
|
88 | 'SparseMatrix, SparseMatrix': function SparseMatrixSparseMatrix(x, y) {
|
89 | return algorithm05(x, y, mod, false);
|
90 | },
|
91 | 'SparseMatrix, DenseMatrix': function SparseMatrixDenseMatrix(x, y) {
|
92 | return algorithm02(y, x, mod, true);
|
93 | },
|
94 | 'DenseMatrix, SparseMatrix': function DenseMatrixSparseMatrix(x, y) {
|
95 | return algorithm03(x, y, mod, false);
|
96 | },
|
97 | 'DenseMatrix, DenseMatrix': function DenseMatrixDenseMatrix(x, y) {
|
98 | return algorithm13(x, y, mod);
|
99 | },
|
100 | 'Array, Array': function ArrayArray(x, y) {
|
101 |
|
102 | return mod(matrix(x), matrix(y)).valueOf();
|
103 | },
|
104 | 'Array, Matrix': function ArrayMatrix(x, y) {
|
105 |
|
106 | return mod(matrix(x), y);
|
107 | },
|
108 | 'Matrix, Array': function MatrixArray(x, y) {
|
109 |
|
110 | return mod(x, matrix(y));
|
111 | },
|
112 | 'SparseMatrix, any': function SparseMatrixAny(x, y) {
|
113 | return algorithm11(x, y, mod, false);
|
114 | },
|
115 | 'DenseMatrix, any': function DenseMatrixAny(x, y) {
|
116 | return algorithm14(x, y, mod, false);
|
117 | },
|
118 | 'any, SparseMatrix': function anySparseMatrix(x, y) {
|
119 | return algorithm12(y, x, mod, true);
|
120 | },
|
121 | 'any, DenseMatrix': function anyDenseMatrix(x, y) {
|
122 | return algorithm14(y, x, mod, true);
|
123 | },
|
124 | 'Array, any': function ArrayAny(x, y) {
|
125 |
|
126 | return algorithm14(matrix(x), y, mod, false).valueOf();
|
127 | },
|
128 | 'any, Array': function anyArray(x, y) {
|
129 |
|
130 | return algorithm14(matrix(y), x, mod, true).valueOf();
|
131 | }
|
132 | });
|
133 | return mod;
|
134 | }); |
\ | No newline at end of file |