1 | 'use strict'
|
2 |
|
3 | function factory (type, config, load, typed) {
|
4 | const matrix = load(require('../../type/matrix/function/matrix'))
|
5 |
|
6 | const algorithm02 = load(require('../../type/matrix/utils/algorithm02'))
|
7 | const algorithm03 = load(require('../../type/matrix/utils/algorithm03'))
|
8 | const algorithm09 = load(require('../../type/matrix/utils/algorithm09'))
|
9 | const algorithm11 = load(require('../../type/matrix/utils/algorithm11'))
|
10 | const algorithm12 = load(require('../../type/matrix/utils/algorithm12'))
|
11 | const algorithm13 = load(require('../../type/matrix/utils/algorithm13'))
|
12 | const algorithm14 = load(require('../../type/matrix/utils/algorithm14'))
|
13 |
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | const atan2 = typed('atan2', {
|
44 |
|
45 | 'number, number': Math.atan2,
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | 'BigNumber, BigNumber': function (y, x) {
|
52 | return type.BigNumber.atan2(y, x)
|
53 | },
|
54 |
|
55 | 'SparseMatrix, SparseMatrix': function (x, y) {
|
56 | return algorithm09(x, y, atan2, false)
|
57 | },
|
58 |
|
59 | 'SparseMatrix, DenseMatrix': function (x, y) {
|
60 |
|
61 | return algorithm02(y, x, atan2, true)
|
62 | },
|
63 |
|
64 | 'DenseMatrix, SparseMatrix': function (x, y) {
|
65 | return algorithm03(x, y, atan2, false)
|
66 | },
|
67 |
|
68 | 'DenseMatrix, DenseMatrix': function (x, y) {
|
69 | return algorithm13(x, y, atan2)
|
70 | },
|
71 |
|
72 | 'Array, Array': function (x, y) {
|
73 | return atan2(matrix(x), matrix(y)).valueOf()
|
74 | },
|
75 |
|
76 | 'Array, Matrix': function (x, y) {
|
77 | return atan2(matrix(x), y)
|
78 | },
|
79 |
|
80 | 'Matrix, Array': function (x, y) {
|
81 | return atan2(x, matrix(y))
|
82 | },
|
83 |
|
84 | 'SparseMatrix, number | BigNumber': function (x, y) {
|
85 | return algorithm11(x, y, atan2, false)
|
86 | },
|
87 |
|
88 | 'DenseMatrix, number | BigNumber': function (x, y) {
|
89 | return algorithm14(x, y, atan2, false)
|
90 | },
|
91 |
|
92 | 'number | BigNumber, SparseMatrix': function (x, y) {
|
93 |
|
94 | return algorithm12(y, x, atan2, true)
|
95 | },
|
96 |
|
97 | 'number | BigNumber, DenseMatrix': function (x, y) {
|
98 |
|
99 | return algorithm14(y, x, atan2, true)
|
100 | },
|
101 |
|
102 | 'Array, number | BigNumber': function (x, y) {
|
103 | return algorithm14(matrix(x), y, atan2, false).valueOf()
|
104 | },
|
105 |
|
106 | 'number | BigNumber, Array': function (x, y) {
|
107 | return algorithm14(matrix(y), x, atan2, true).valueOf()
|
108 | }
|
109 | })
|
110 |
|
111 | atan2.toTex = { 2: `\\mathrm{atan2}\\left(\${args}\\right)` }
|
112 |
|
113 | return atan2
|
114 | }
|
115 |
|
116 | exports.name = 'atan2'
|
117 | exports.factory = factory
|