1 | 'use strict';
|
2 |
|
3 | function factory(type, config, load, typed) {
|
4 | var latex = require('../../utils/latex');
|
5 |
|
6 | var matrix = load(require('../../type/matrix/function/matrix'));
|
7 |
|
8 | var algorithm13 = load(require('../../type/matrix/utils/algorithm13'));
|
9 | var algorithm14 = load(require('../../type/matrix/utils/algorithm14'));
|
10 |
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | var to = typed('to', {
|
36 |
|
37 | 'Unit, Unit | string': function UnitUnitString(x, unit) {
|
38 | return x.to(unit);
|
39 | },
|
40 |
|
41 | 'Matrix, Matrix': function MatrixMatrix(x, y) {
|
42 |
|
43 | return algorithm13(x, y, to);
|
44 | },
|
45 |
|
46 | 'Array, Array': function ArrayArray(x, y) {
|
47 |
|
48 | return to(matrix(x), matrix(y)).valueOf();
|
49 | },
|
50 |
|
51 | 'Array, Matrix': function ArrayMatrix(x, y) {
|
52 |
|
53 | return to(matrix(x), y);
|
54 | },
|
55 |
|
56 | 'Matrix, Array': function MatrixArray(x, y) {
|
57 |
|
58 | return to(x, matrix(y));
|
59 | },
|
60 |
|
61 | 'Matrix, any': function MatrixAny(x, y) {
|
62 |
|
63 | return algorithm14(x, y, to, false);
|
64 | },
|
65 |
|
66 | 'any, Matrix': function anyMatrix(x, y) {
|
67 |
|
68 | return algorithm14(y, x, to, true);
|
69 | },
|
70 |
|
71 | 'Array, any': function ArrayAny(x, y) {
|
72 |
|
73 | return algorithm14(matrix(x), y, to, false).valueOf();
|
74 | },
|
75 |
|
76 | 'any, Array': function anyArray(x, y) {
|
77 |
|
78 | return algorithm14(matrix(y), x, to, true).valueOf();
|
79 | }
|
80 | });
|
81 |
|
82 | to.toTex = {
|
83 | 2: '\\left(${args[0]}' + latex.operators['to'] + '${args[1]}\\right)'
|
84 | };
|
85 |
|
86 | return to;
|
87 | }
|
88 |
|
89 | exports.name = 'to';
|
90 | exports.factory = factory; |
\ | No newline at end of file |