1 | import { factory } from '../../utils/factory'
|
2 | import { createAlgorithm02 } from '../../type/matrix/utils/algorithm02'
|
3 | import { createAlgorithm03 } from '../../type/matrix/utils/algorithm03'
|
4 | import { createAlgorithm07 } from '../../type/matrix/utils/algorithm07'
|
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 |
|
10 | const name = 'dotDivide'
|
11 | const dependencies = [
|
12 | 'typed',
|
13 | 'matrix',
|
14 | 'equalScalar',
|
15 | 'divideScalar',
|
16 | 'DenseMatrix'
|
17 | ]
|
18 |
|
19 | export const createDotDivide = factory(name, dependencies, ({ typed, matrix, equalScalar, divideScalar, DenseMatrix }) => {
|
20 | const algorithm02 = createAlgorithm02({ typed, equalScalar })
|
21 | const algorithm03 = createAlgorithm03({ typed })
|
22 | const algorithm07 = createAlgorithm07({ typed, DenseMatrix })
|
23 | const algorithm11 = createAlgorithm11({ typed, equalScalar })
|
24 | const algorithm12 = createAlgorithm12({ typed, DenseMatrix })
|
25 | const algorithm13 = createAlgorithm13({ typed })
|
26 | const algorithm14 = createAlgorithm14({ typed })
|
27 |
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | const dotDivide = typed(name, {
|
55 |
|
56 | 'any, any': divideScalar,
|
57 |
|
58 | 'SparseMatrix, SparseMatrix': function (x, y) {
|
59 | return algorithm07(x, y, divideScalar, false)
|
60 | },
|
61 |
|
62 | 'SparseMatrix, DenseMatrix': function (x, y) {
|
63 | return algorithm02(y, x, divideScalar, true)
|
64 | },
|
65 |
|
66 | 'DenseMatrix, SparseMatrix': function (x, y) {
|
67 | return algorithm03(x, y, divideScalar, false)
|
68 | },
|
69 |
|
70 | 'DenseMatrix, DenseMatrix': function (x, y) {
|
71 | return algorithm13(x, y, divideScalar)
|
72 | },
|
73 |
|
74 | 'Array, Array': function (x, y) {
|
75 |
|
76 | return dotDivide(matrix(x), matrix(y)).valueOf()
|
77 | },
|
78 |
|
79 | 'Array, Matrix': function (x, y) {
|
80 |
|
81 | return dotDivide(matrix(x), y)
|
82 | },
|
83 |
|
84 | 'Matrix, Array': function (x, y) {
|
85 |
|
86 | return dotDivide(x, matrix(y))
|
87 | },
|
88 |
|
89 | 'SparseMatrix, any': function (x, y) {
|
90 | return algorithm11(x, y, divideScalar, false)
|
91 | },
|
92 |
|
93 | 'DenseMatrix, any': function (x, y) {
|
94 | return algorithm14(x, y, divideScalar, false)
|
95 | },
|
96 |
|
97 | 'any, SparseMatrix': function (x, y) {
|
98 | return algorithm12(y, x, divideScalar, true)
|
99 | },
|
100 |
|
101 | 'any, DenseMatrix': function (x, y) {
|
102 | return algorithm14(y, x, divideScalar, true)
|
103 | },
|
104 |
|
105 | 'Array, any': function (x, y) {
|
106 |
|
107 | return algorithm14(matrix(x), y, divideScalar, false).valueOf()
|
108 | },
|
109 |
|
110 | 'any, Array': function (x, y) {
|
111 |
|
112 | return algorithm14(matrix(y), x, divideScalar, true).valueOf()
|
113 | }
|
114 | })
|
115 |
|
116 | return dotDivide
|
117 | })
|