-
Notifications
You must be signed in to change notification settings - Fork 0
/
math.custom.min.js
214 lines (214 loc) · 107 KB
/
math.custom.min.js
1
2
3
4
5
6
7
8
9
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
36
37
38
39
40
41
42
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
(function(L,p){"object"===typeof exports&&"object"===typeof module?module.exports=p():"function"===typeof define&&define.amd?define([],p):"object"===typeof exports?exports.math=p():L.math=p()})(this,function(){return function(L){function p(B){if(h[B])return h[B].exports;var u=h[B]={exports:{},id:B,loaded:!1};L[B].call(u.exports,u,u.exports,p);u.loaded=!0;return u.exports}var h={};p.m=L;p.c=h;p.p="";return p(0)}([function(L,p,h){p=h(1).create();p.import(h(15));p.import(h(24));p.import(h(27));p.import(h(29));
p.import(h(30));p.import(h(31));p.import(h(58));p.import(h(47));p.import(h(65));p.import(h(68));p.import(h(69));p.import(h(70));p.import(h(71));L.exports=p},function(L,p,h){L.exports=h(2)},function(L,p,h){h(3);var B=h(4).isFactory,u=h(6),n=h(10),m=h(12),g=h(14);p.create=function(d){function b(t){if(!B(t))throw Error("Factory object with properties `type`, `name`, and `factory` expected");var e=k.indexOf(t);-1===e?(e=!0===t.math?t.factory(r.type,A,b,r.typed,r):t.factory(r.type,A,b,r.typed),k.push(t),
c.push(e)):e=c[e];return e}if("function"!==typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var k=[],c=[],r=n.mixin({});r.type={};r.expression={transform:{},mathWithTransform:{}};r.typed=u.create(r.type);var A={epsilon:1E-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};r["import"]=b(m);r.config=b(g);r.expression.mathWithTransform.config=r.config;d&&r.config(d);return r}},
function(L,p){Number.isFinite=Number.isFinite||function(h){return"number"===typeof h&&isFinite(h)};Number.isNaN=Number.isNaN||function(h){return h!==h}},function(L,p,h){function B(n){B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(m){return typeof m}:function(m){return m&&"function"===typeof Symbol&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};return B(n)}var u=h(5);p.clone=function g(m){var d=B(m);if("number"===d||"string"===d||"boolean"===d||null===m||
void 0===m)return m;if("function"===typeof m.clone)return m.clone();if(Array.isArray(m))return m.map(function(b){return g(b)});if(m instanceof Date)return new Date(m.valueOf());if(u(m))return m;if(m instanceof RegExp)throw new TypeError("Cannot clone "+m);return p.map(m,g)};p.map=function(m,g){var d={},b;for(b in m)p.hasOwnProperty(m,b)&&(d[b]=g(m[b]));return d};p.extend=function(m,g){for(var d in g)p.hasOwnProperty(g,d)&&(m[d]=g[d]);return m};p.deepExtend=function b(g,d){if(Array.isArray(d))throw new TypeError("Arrays are not supported by deepExtend");
for(var k in d)if(p.hasOwnProperty(d,k))if(d[k]&&d[k].constructor===Object)void 0===g[k]&&(g[k]={}),g[k].constructor===Object?b(g[k],d[k]):g[k]=d[k];else{if(Array.isArray(d[k]))throw new TypeError("Arrays are not supported by deepExtend");g[k]=d[k]}return g};p.deepEqual=function(g,d){var b;if(Array.isArray(g)){if(!Array.isArray(d)||g.length!==d.length)return!1;var k=0;for(b=g.length;k<b;k++)if(!p.deepEqual(g[k],d[k]))return!1;return!0}if(g instanceof Object){if(Array.isArray(d)||!(d instanceof Object))return!1;
for(k in g)if(!p.deepEqual(g[k],d[k]))return!1;for(k in d)if(!p.deepEqual(g[k],d[k]))return!1;return!0}return g===d};p.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(g){}return!1};p.lazy=function(g,d,b){if(p.canDefineProperty()){var k=!0,c;Object.defineProperty(g,d,{get:function(){k&&(c=b(),k=!1);return c},set:function(r){c=r;k=!1},configurable:!0,enumerable:!0})}else g[d]=b()};p.traverse=function(g,d){if(d){d=d.split(".");
for(var b=0;b<d.length;b++){var k=d[b];k in g||(g[k]={});g=g[k]}}return g};p.hasOwnProperty=function(g,d){return g&&Object.hasOwnProperty.call(g,d)};p.isFactory=function(g){return g&&"function"===typeof g.factory}},function(L,p){L.exports=function(h){return h&&h.constructor.prototype.isBigNumber||!1}},function(L,p,h){function B(b){B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(k){return typeof k}:function(k){return k&&"function"===typeof Symbol&&k.constructor===Symbol&&k!==
Symbol.prototype?"symbol":typeof k};return B(b)}var u=h(7),n=h(8).digits,m=h(5),g=h(9),d=function(){d=u.create;return u};p.create=function(b){b.isNumber=function(c){return"number"===typeof c};b.isComplex=function(c){return b.Complex&&c instanceof b.Complex||!1};b.isBigNumber=m;b.isFraction=function(c){return b.Fraction&&c instanceof b.Fraction||!1};b.isUnit=function(c){return c&&c.constructor.prototype.isUnit||!1};b.isString=function(c){return"string"===typeof c};b.isArray=Array.isArray;b.isMatrix=
g;b.isDenseMatrix=function(c){return c&&c.isDenseMatrix&&c.constructor.prototype.isMatrix||!1};b.isSparseMatrix=function(c){return c&&c.isSparseMatrix&&c.constructor.prototype.isMatrix||!1};b.isRange=function(c){return c&&c.constructor.prototype.isRange||!1};b.isIndex=function(c){return c&&c.constructor.prototype.isIndex||!1};b.isBoolean=function(c){return"boolean"===typeof c};b.isResultSet=function(c){return c&&c.constructor.prototype.isResultSet||!1};b.isHelp=function(c){return c&&c.constructor.prototype.isHelp||
!1};b.isFunction=function(c){return"function"===typeof c};b.isDate=function(c){return c instanceof Date};b.isRegExp=function(c){return c instanceof RegExp};b.isObject=function(c){return"object"===B(c)&&c.constructor===Object&&!b.isComplex(c)&&!b.isFraction(c)};b.isNull=function(c){return null===c};b.isUndefined=function(c){return void 0===c};b.isAccessorNode=function(c){return c&&c.isAccessorNode&&c.constructor.prototype.isNode||!1};b.isArrayNode=function(c){return c&&c.isArrayNode&&c.constructor.prototype.isNode||
!1};b.isAssignmentNode=function(c){return c&&c.isAssignmentNode&&c.constructor.prototype.isNode||!1};b.isBlockNode=function(c){return c&&c.isBlockNode&&c.constructor.prototype.isNode||!1};b.isConditionalNode=function(c){return c&&c.isConditionalNode&&c.constructor.prototype.isNode||!1};b.isConstantNode=function(c){return c&&c.isConstantNode&&c.constructor.prototype.isNode||!1};b.isFunctionAssignmentNode=function(c){return c&&c.isFunctionAssignmentNode&&c.constructor.prototype.isNode||!1};b.isFunctionNode=
function(c){return c&&c.isFunctionNode&&c.constructor.prototype.isNode||!1};b.isIndexNode=function(c){return c&&c.isIndexNode&&c.constructor.prototype.isNode||!1};b.isNode=function(c){return c&&c.isNode&&c.constructor.prototype.isNode||!1};b.isObjectNode=function(c){return c&&c.isObjectNode&&c.constructor.prototype.isNode||!1};b.isOperatorNode=function(c){return c&&c.isOperatorNode&&c.constructor.prototype.isNode||!1};b.isParenthesisNode=function(c){return c&&c.isParenthesisNode&&c.constructor.prototype.isNode||
!1};b.isRangeNode=function(c){return c&&c.isRangeNode&&c.constructor.prototype.isNode||!1};b.isSymbolNode=function(c){return c&&c.isSymbolNode&&c.constructor.prototype.isNode||!1};b.isChain=function(c){return c&&c.constructor.prototype.isChain||!1};var k=d();k.types=[{name:"number",test:b.isNumber},{name:"Complex",test:b.isComplex},{name:"BigNumber",test:b.isBigNumber},{name:"Fraction",test:b.isFraction},{name:"Unit",test:b.isUnit},{name:"string",test:b.isString},{name:"Array",test:b.isArray},{name:"Matrix",
test:b.isMatrix},{name:"DenseMatrix",test:b.isDenseMatrix},{name:"SparseMatrix",test:b.isSparseMatrix},{name:"Range",test:b.isRange},{name:"Index",test:b.isIndex},{name:"boolean",test:b.isBoolean},{name:"ResultSet",test:b.isResultSet},{name:"Help",test:b.isHelp},{name:"function",test:b.isFunction},{name:"Date",test:b.isDate},{name:"RegExp",test:b.isRegExp},{name:"null",test:b.isNull},{name:"undefined",test:b.isUndefined},{name:"OperatorNode",test:b.isOperatorNode},{name:"ConstantNode",test:b.isConstantNode},
{name:"SymbolNode",test:b.isSymbolNode},{name:"ParenthesisNode",test:b.isParenthesisNode},{name:"FunctionNode",test:b.isFunctionNode},{name:"FunctionAssignmentNode",test:b.isFunctionAssignmentNode},{name:"ArrayNode",test:b.isArrayNode},{name:"AssignmentNode",test:b.isAssignmentNode},{name:"BlockNode",test:b.isBlockNode},{name:"ConditionalNode",test:b.isConditionalNode},{name:"IndexNode",test:b.isIndexNode},{name:"RangeNode",test:b.isRangeNode},{name:"Node",test:b.isNode},{name:"Object",test:b.isObject}];
k.conversions=[{from:"number",to:"BigNumber",convert:function(c){if(15<n(c))throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+c+"). Use function bignumber(x) to convert to BigNumber.");return new b.BigNumber(c)}},{from:"number",to:"Complex",convert:function(c){return new b.Complex(c,0)}},{from:"number",to:"string",convert:function(c){return c+""}},{from:"BigNumber",to:"Complex",convert:function(c){return new b.Complex(c.toNumber(),0)}},{from:"Fraction",
to:"BigNumber",convert:function(c){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.");}},{from:"Fraction",to:"Complex",convert:function(c){return new b.Complex(c.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(c){if((new b.Fraction(c)).valueOf()!==c)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+
c+"). Use function fraction(x) to convert to Fraction.");return new b.Fraction(c)}},{from:"string",to:"number",convert:function(c){var r=Number(c);if(isNaN(r))throw Error('Cannot convert "'+c+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(c){try{return new b.BigNumber(c)}catch(r){throw Error('Cannot convert "'+c+'" to BigNumber');}}},{from:"string",to:"Fraction",convert:function(c){try{return new b.Fraction(c)}catch(r){throw Error('Cannot convert "'+c+'" to Fraction');
}}},{from:"string",to:"Complex",convert:function(c){try{return new b.Complex(c)}catch(r){throw Error('Cannot convert "'+c+'" to Complex');}}},{from:"boolean",to:"number",convert:function(c){return+c}},{from:"boolean",to:"BigNumber",convert:function(c){return new b.BigNumber(+c)}},{from:"boolean",to:"Fraction",convert:function(c){return new b.Fraction(+c)}},{from:"boolean",to:"string",convert:function(c){return+c}},{from:"Array",to:"Matrix",convert:function(c){return new b.DenseMatrix(c)}},{from:"Matrix",
to:"Array",convert:function(c){return c.valueOf()}}];return k}},function(L,p,h){var B,u,n;"use strict";(function(m,g){!(u=[],B=g,n="function"===typeof B?B.apply(p,u):B,void 0!==n&&(L.exports=n))})(this,function(){function m(){return!0}function g(){return!1}function d(){}function b(){function k(F){var K=V(ca.types,function(N){return N.name===F});if(K)return K;if("any"===F)return ia;K=V(ca.types,function(N){return N.name.toLowerCase()===F.toLowerCase()});throw new TypeError('Unknown type "'+F+'"'+(K?
'. Did you mean "'+K.name+'"?':""));}function c(F){var K=V(ca.types,function(N){return N.test(F)});if(K)return K.name;throw new TypeError("Value has unknown type. Value: "+F);}function r(F){return F.map(function(K){var N=K.types.map(y);return(K.restParam?"...":"")+N.join("|")}).join(",")}function A(F,K){var N=0===F.indexOf("..."),M=(N?3<F.length?F.slice(3):"any":F).split("|").map(S).filter(Y).filter(P);F=I(K,M);M=M.map(function(Q){var aa=k(Q);return{name:Q,typeIndex:aa===ia?999:ca.types.indexOf(aa),
test:aa.test,conversion:null,conversionIndex:-1}});F=F.map(function(Q){var aa=k(Q.from);return{name:Q.from,typeIndex:aa===ia?999:ca.types.indexOf(aa),test:aa.test,conversion:Q,conversionIndex:K.indexOf(Q)}});return{types:M.concat(F),restParam:N}}function t(F,K,N){var M=[];""!==F.trim()&&(M=F.split(",").map(S).map(function(Q,aa,Z){var T=A(Q,N);if(T.restParam&&aa!==Z.length-1)throw new SyntaxError('Unexpected rest parameter "'+Q+'": only allowed for the last parameter');return T}));return M.some(W)?
null:{params:M,fn:K}}function e(F){return(F=F[F.length-1])?F.restParam:!1}function f(F){return F.types.some(function(K){return null!=K.conversion})}function a(F){if(F&&0!==F.types.length){if(1===F.types.length)return k(F.types[0].name).test;if(2===F.types.length){var K=k(F.types[0].name).test,N=k(F.types[1].name).test;return function(Q){return K(Q)||N(Q)}}var M=F.types.map(function(Q){return k(Q.name).test});return function(Q){for(var aa=0;aa<M.length;aa++)if(M[aa](Q))return!0;return!1}}return m}
function x(F){if(e(F)){var K=F.slice(0,F.length-1).map(a);var N=K.length,M=a(F[F.length-1]);return function(Z){for(var T=0;T<K.length;T++)if(!K[T](Z[T]))return!1;a:{for(T=N;T<Z.length;T++)if(!M(Z[T])){T=!1;break a}T=!0}return T&&Z.length>=N+1}}if(0===F.length)return function(Z){return 0===Z.length};if(1===F.length){var Q=a(F[0]);return function(Z){return Q(Z[0])&&1===Z.length}}if(2===F.length){Q=a(F[0]);var aa=a(F[1]);return function(Z){return Q(Z[0])&&aa(Z[1])&&2===Z.length}}K=F.map(a);return function(Z){for(var T=
0;T<K.length;T++)if(!K[T](Z[T]))return!1;return Z.length===K.length}}function v(F,K){K<F.params.length?F=F.params[K]:e(F.params)?(F=F.params,F=F[F.length-1]):F=null;return F}function q(F,K,N){F=v(F,K);return(F?N?F.types.filter(l):F.types:[]).map(y)}function y(F){return F.name}function l(F){return null===F.conversion||void 0===F.conversion}function w(F,K){F=da(ba(F,function(N){return q(N,K,!1)}));return-1!==F.indexOf("any")?["any"]:F}function C(F,K,N){F=F||"unnamed";var M;for(M=0;M<K.length;M++){var Q=
N.filter(function(Z){var T=a(v(Z,M));return(M<Z.params.length||e(Z.params))&&T(K[M])});if(0===Q.length){if(Q=w(N,M),0<Q.length){var aa=c(K[M]);N=new TypeError("Unexpected type of argument in function "+F+" (expected: "+Q.join(" or ")+", actual: "+aa+", index: "+M+")");N.data={category:"wrongType",fn:F,index:M,actual:aa,expected:Q};return N}}else N=Q}Q=N.map(function(Z){return e(Z.params)?Infinity:Z.params.length});if(K.length<Math.min.apply(null,Q))return Q=w(N,M),N=new TypeError("Too few arguments in function "+
F+" (expected: "+Q.join(" or ")+", index: "+K.length+")"),N.data={category:"tooFewArgs",fn:F,index:K.length,expected:Q},N;Q=Math.max.apply(null,Q);if(K.length>Q)return N=new TypeError("Too many arguments in function "+F+" (expected: "+Q+", actual: "+K.length+")"),N.data={category:"tooManyArgs",fn:F,index:K.length,expectedLength:Q},N;N=new TypeError('Arguments of type "'+K.join(", ")+'" do not match any of the defined signatures of function '+F+".");N.data={category:"mismatch",actual:K.map(c)};return N}
function z(F){for(var K=999,N=0;N<F.types.length;N++)l(F.types[N])&&(K=Math.min(K,F.types[N].typeIndex));return K}function E(F){for(var K=999,N=0;N<F.types.length;N++)l(F.types[N])||(K=Math.min(K,F.types[N].conversionIndex));return K}function J(F,K){var N=Math.min(F.params.length,K.params.length),M;var Q=F.params.some(f)-K.params.some(f);if(0!==Q)return Q;for(M=0;M<N;M++)if(Q=f(F.params[M])-f(K.params[M]),0!==Q)return Q;for(M=0;M<N;M++){var aa=F.params[M],Z=K.params[M];Q=aa.restParam-Z.restParam;
0===Q&&(Q=f(aa)-f(Z),0===Q&&(Q=z(aa)-z(Z),Q=0!==Q?Q:E(aa)-E(Z)));if(0!==Q)return Q}return F.params.length-K.params.length}function I(F,K){var N={};F.forEach(function(M){-1!==K.indexOf(M.from)||-1===K.indexOf(M.to)||N[M.from]||(N[M.from]=M)});return Object.keys(N).map(function(M){return N[M]})}function G(F,K){var N=K;if(F.some(f)){var M=e(F),Q=F.map(H);N=function(){for(var T=[],ha=M?arguments.length-1:arguments.length,la=0;la<ha;la++)T[la]=Q[la](arguments[la]);M&&(T[ha]=arguments[ha].map(Q[ha]));return K.apply(null,
T)}}var aa=N;if(e(F)){var Z=F.length-1;aa=function(){return N.apply(null,Array.prototype.slice.call(arguments,0,Z).concat([Array.prototype.slice.call(arguments,Z,void 0)]))}}return aa}function H(F){var K=[],N=[];F.types.forEach(function(T){T.conversion&&(K.push(k(T.conversion.from).test),N.push(T.conversion.convert))});switch(N.length){case 0:return function(T){return T};case 1:var M=K[0];var Q=N[0];return function(T){return M(T)?Q(T):T};case 2:M=K[0];var aa=K[1];Q=N[0];var Z=N[1];return function(T){return M(T)?
Q(T):aa(T)?Z(T):T};default:return function(T){for(var ha=0;ha<N.length;ha++)if(K[ha](T))return N[ha](T);return T}}}function D(F){var K={};F.forEach(function(N){N.params.some(f)||O(N.params,!0).forEach(function(M){K[r(M)]=N.fn})});return K}function O(F,K){function N(M,Q,aa){if(Q<M.length){var Z=M[Q],T=K?Z.types.filter(l):Z.types;Z.restParam?(Z=T.filter(l),T=Z.length<T.length?[Z,T]:[T]):T=T.map(function(ha){return[ha]});return ba(T,function(ha){return N(M,Q+1,aa.concat([ha]))})}return[aa.map(function(ha,
la){return{types:ha,restParam:la===M.length-1&&e(M)}})]}return N(F,0,[])}function R(F,K){if(0===Object.keys(K).length)throw new SyntaxError("No signatures provided");var N=[];Object.keys(K).map(function(ea){return t(ea,K[ea],ca.conversions)}).filter(U).forEach(function(ea){var ma=V(N,function(na){a:{for(var sa=Math.max(na.params.length,ea.params.length),oa=0;oa<sa;oa++){var pa=q(na,oa,!0),ua=q(ea,oa,!0);b:{for(var ta=0;ta<pa.length;ta++)if(-1!==ua.indexOf(pa[ta])){pa=!0;break b}pa=!1}if(!pa){na=!1;
break a}}sa=na.params.length;oa=ea.params.length;na=e(na.params);pa=e(ea.params);na=na?pa?sa===oa:oa>=sa:pa?sa>=oa:sa===oa}return na});if(ma)throw new TypeError('Conflicting signatures "'+r(ma.params)+'" and "'+r(ea.params)+'".');N.push(ea)});var M=ba(N,function(ea){return(ea?O(ea.params,!1):[]).map(function(ma){return{params:ma,fn:ea.fn}})}).filter(U);M.sort(J);var Q=M[0]&&2>=M[0].params.length&&!e(M[0].params),aa=M[1]&&2>=M[1].params.length&&!e(M[1].params),Z=M[2]&&2>=M[2].params.length&&!e(M[2].params),
T=M[3]&&2>=M[3].params.length&&!e(M[3].params),ha=M[4]&&2>=M[4].params.length&&!e(M[4].params),la=M[5]&&2>=M[5].params.length&&!e(M[5].params),va=Q&&aa&&Z&&T&&ha&&la,wa=M.map(function(ea){return x(ea.params)}),xa=Q?a(M[0].params[0]):g,ya=aa?a(M[1].params[0]):g,za=Z?a(M[2].params[0]):g,Aa=T?a(M[3].params[0]):g,Ba=ha?a(M[4].params[0]):g,Ca=la?a(M[5].params[0]):g,Da=Q?a(M[0].params[1]):g,Ea=aa?a(M[1].params[1]):g,Fa=Z?a(M[2].params[1]):g,Ga=T?a(M[3].params[1]):g,Ha=ha?a(M[4].params[1]):g,Ia=la?a(M[5].params[1]):
g,qa=M.map(function(ea){return G(ea.params,ea.fn)}),Ja=Q?qa[0]:d,Ka=aa?qa[1]:d,La=Z?qa[2]:d,Ma=T?qa[3]:d,Na=ha?qa[4]:d,Oa=la?qa[5]:d,Pa=Q?M[0].params.length:-1,Qa=aa?M[1].params.length:-1,Ra=Z?M[2].params.length:-1,Sa=T?M[3].params.length:-1,Ta=ha?M[4].params.length:-1,Ua=la?M[5].params.length:-1,Va=va?6:0,Wa=M.length,Xa=function(){for(var ea=Va;ea<Wa;ea++)if(wa[ea](arguments))return qa[ea].apply(null,arguments);throw C(F,arguments,M);};Q=function(ea,ma){return arguments.length===Pa&&xa(ea)&&Da(ma)?
Ja.apply(null,arguments):arguments.length===Qa&&ya(ea)&&Ea(ma)?Ka.apply(null,arguments):arguments.length===Ra&&za(ea)&&Fa(ma)?La.apply(null,arguments):arguments.length===Sa&&Aa(ea)&&Ga(ma)?Ma.apply(null,arguments):arguments.length===Ta&&Ba(ea)&&Ha(ma)?Na.apply(null,arguments):arguments.length===Ua&&Ca(ea)&&Ia(ma)?Oa.apply(null,arguments):Xa.apply(null,arguments)};try{Object.defineProperty(Q,"name",{value:F})}catch(ea){}Q.signatures=D(M);return Q}function P(F){return-1===ca.ignore.indexOf(F)}function S(F){return F.trim()}
function Y(F){return!!F}function U(F){return null!==F}function W(F){return 0===F.types.length}function V(F,K){for(var N=0;N<F.length;N++)if(K(F[N]))return F[N]}function da(F){for(var K={},N=0;N<F.length;N++)K[F[N]]=!0;return Object.keys(K)}function ba(F,K){return Array.prototype.concat.apply([],F.map(K))}function fa(F){for(var K="",N=0;N<F.length;N++){var M=F[N];if(("object"===typeof M.signatures||"string"===typeof M.signature)&&""!==M.name)if(""===K)K=M.name;else if(K!==M.name)throw F=Error("Function names do not match (expected: "+
K+", actual: "+M.name+")"),F.data={actual:M.name,expected:K},F;}return K}function X(F){function K(T,ha){if(M.hasOwnProperty(T)&&ha!==M[T])throw N=Error('Signature "'+T+'" is defined twice'),N.data={signature:T},N;}for(var N,M={},Q=0;Q<F.length;Q++){var aa=F[Q];if("object"===typeof aa.signatures)for(var Z in aa.signatures)aa.signatures.hasOwnProperty(Z)&&(K(Z,aa.signatures[Z]),M[Z]=aa.signatures[Z]);else if("string"===typeof aa.signature)K(aa.signature,aa),M[aa.signature]=aa;else throw N=new TypeError("Function is no typed-function (index: "+
Q+")"),N.data={index:Q},N;}return M}var ja=[{name:"number",test:function(F){return"number"===typeof F}},{name:"string",test:function(F){return"string"===typeof F}},{name:"boolean",test:function(F){return"boolean"===typeof F}},{name:"Function",test:function(F){return"function"===typeof F}},{name:"Array",test:Array.isArray},{name:"Date",test:function(F){return F instanceof Date}},{name:"RegExp",test:function(F){return F instanceof RegExp}},{name:"Object",test:function(F){return"object"===typeof F&&
F.constructor===Object}},{name:"null",test:function(F){return null===F}},{name:"undefined",test:function(F){return void 0===F}}],ia={name:"any",test:m},ka=[],ra=[],ca={types:ja,conversions:ra,ignore:ka};ca=R("typed",{"string, Object":R,Object:function(F){var K=[],N;for(N in F)F.hasOwnProperty(N)&&K.push(F[N]);K=fa(K);return R(K,F)},"...Function":function(F){return R(fa(F),X(F))},"string, ...Function":function(F,K){return R(F,X(K))}});ca.create=b;ca.types=ja;ca.conversions=ra;ca.ignore=ka;ca.convert=
function(F,K){var N=c(F);if(K===N)return F;for(var M=0;M<ca.conversions.length;M++){var Q=ca.conversions[M];if(Q.from===N&&Q.to===K)return Q.convert(F)}throw Error("Cannot convert from "+N+" to "+K);};ca.find=function(F,K){if(!F.signatures)throw new TypeError("Function is no typed-function");if("string"===typeof K){K=K.split(",");for(var N=0;N<K.length;N++)K[N]=K[N].trim()}else if(!Array.isArray(K))throw new TypeError("String array or a comma separated string expected");N=K.join(",");if(N=F.signatures[N])return N;
throw new TypeError("Signature not found (signature: "+(F.name||"unnamed")+"("+K.join(", ")+"))");};ca.addType=function(F,K){if(!F||"string"!==typeof F.name||"function"!==typeof F.test)throw new TypeError("Object with properties {name: string, test: function} expected");if(!1!==K)for(K=0;K<ca.types.length;K++)if("Object"===ca.types[K].name){ca.types.splice(K,0,F);return}ca.types.push(F)};ca.addConversion=function(F){if(!F||"string"!==typeof F.from||"string"!==typeof F.to||"function"!==typeof F.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");
ca.conversions.push(F)};return ca}return b()})},function(L,p,h){function B(n){for(var m=[],g=0;g<n;g++)m.push(0);return m}var u=h(4);p.isNumber=function(n){return"number"===typeof n};p.isInteger=function(n){return"boolean"===typeof n?!0:isFinite(n)?n===Math.round(n):!1};p.sign=Math.sign||function(n){return 0<n?1:0>n?-1:0};p.format=function(n,m){if("function"===typeof m)return m(n);if(Infinity===n)return"Infinity";if(-Infinity===n)return"-Infinity";if(isNaN(n))return"NaN";var g="auto";if(m)if(m.notation&&
(g=m.notation),p.isNumber(m))var d=m;else p.isNumber(m.precision)&&(d=m.precision);switch(g){case "fixed":return p.toFixed(n,d);case "exponential":return p.toExponential(n,d);case "engineering":return p.toEngineering(n,d);case "auto":return m&&m.exponential&&(void 0!==m.exponential.lower||void 0!==m.exponential.upper)?(g=u.map(m,function(b){return b}),g.exponential=void 0,void 0!==m.exponential.lower&&(g.lowerExp=Math.round(Math.log(m.exponential.lower)/Math.LN10)),void 0!==m.exponential.upper&&(g.upperExp=
Math.round(Math.log(m.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(m)+" with "+JSON.stringify(g)),p.toPrecision(n,d,g)):p.toPrecision(n,d,m&&m).replace(/((\.\d*?)(0+))($|e)/,function(b,k,c,r,A){return"."!==c?c+A:A});default:throw Error('Unknown notation "'+
g+'". Choose "auto", "exponential", or "fixed".');}};p.splitNumber=function(n){var m=String(n).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!m)throw new SyntaxError("Invalid number "+n);n=m[1];var g=m[2],d=parseFloat(m[4]||"0");m=g.indexOf(".");d+=-1!==m?m-1:g.length-1;m=g.replace(".","").replace(/^0*/,function(b){d-=b.length;return""}).replace(/0*$/,"").split("").map(function(b){return parseInt(b)});0===m.length&&(m.push(0),d++);return{sign:n,coefficients:m,exponent:d}};p.toEngineering=
function(n,m){if(isNaN(n)||!isFinite(n))return String(n);n=p.roundDigits(p.splitNumber(n),m);var g=n.exponent,d=n.coefficients,b=0===g%3?g:0>g?g-3-g%3:g-g%3;if(p.isNumber(m))for(;m>d.length||g-b+1>d.length;)d.push(0);else for(var k=0<=g?g:Math.abs(b);d.length-1<k;)d.push(0);var c=Math.abs(g-b);for(k=1;0<c;)k++,c--;c=d.slice(k).join("");m=p.isNumber(m)&&c.length||c.match(/[1-9]/)?"."+c:"";m=d.slice(0,k).join("")+m+"e"+(0<=g?"+":"")+b.toString();return n.sign+m};p.toFixed=function(n,m){if(isNaN(n)||
!isFinite(n))return String(n);n=p.splitNumber(n);n="number"===typeof m?p.roundDigits(n,n.exponent+1+m):n;var g=n.coefficients,d=n.exponent+1;m=d+(m||0);g.length<m&&(g=g.concat(B(m-g.length)));0>d&&(g=B(-d+1).concat(g),d=1);d<g.length&&g.splice(d,0,0===d?"0.":".");return n.sign+g.join("")};p.toExponential=function(n,m){if(isNaN(n)||!isFinite(n))return String(n);n=p.splitNumber(n);n=m?p.roundDigits(n,m):n;var g=n.coefficients,d=n.exponent;g.length<m&&(g=g.concat(B(m-g.length)));m=g.shift();return n.sign+
m+(0<g.length?"."+g.join(""):"")+"e"+(0<=d?"+":"")+d};p.toPrecision=function(n,m,g){if(isNaN(n)||!isFinite(n))return String(n);var d=g&&void 0!==g.lowerExp?g.lowerExp:-3;g=g&&void 0!==g.upperExp?g.upperExp:5;var b=p.splitNumber(n);if(b.exponent<d||b.exponent>=g)return p.toExponential(n,m);n=m?p.roundDigits(b,m):b;d=n.coefficients;g=n.exponent;d.length<m&&(d=d.concat(B(m-d.length)));d=d.concat(B(g-d.length+1+(d.length<m?m-d.length:0)));d=B(-g).concat(d);m=0<g?g:0;m<d.length-1&&d.splice(m+1,0,".");
return n.sign+d.join("")};p.roundDigits=function(n,m){n={sign:n.sign,coefficients:n.coefficients,exponent:n.exponent};for(var g=n.coefficients;0>=m;)g.unshift(0),n.exponent++,m++;if(g.length>m&&5<=g.splice(m,g.length-m)[0])for(--m,g[m]++;10===g[m];)g.pop(),0===m&&(g.unshift(0),n.exponent++,m++),m--,g[m]++;return n};p.digits=function(n){return n.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length};p.DBL_EPSILON=Number.EPSILON||2.220446049250313E-16;p.nearlyEqual=function(n,m,g){if(null===
g||void 0===g)return n===m;if(n===m)return!0;if(isNaN(n)||isNaN(m))return!1;if(isFinite(n)&&isFinite(m)){var d=Math.abs(n-m);return d<p.DBL_EPSILON?!0:d<=Math.max(Math.abs(n),Math.abs(m))*g}return!1}},function(L,p){L.exports=function(h){return h&&h.constructor.prototype.isMatrix||!1}},function(L,p,h){var B=h(11);p.mixin=function(u){var n=new B;u.on=n.on.bind(n);u.off=n.off.bind(n);u.once=n.once.bind(n);u.emit=n.emit.bind(n);return u}},function(L,p){function h(){}h.prototype={on:function(B,u,n){var m=
this.e||(this.e={});(m[B]||(m[B]=[])).push({fn:u,ctx:n});return this},once:function(B,u,n){function m(){g.off(B,m);u.apply(n,arguments)}var g=this;m._=u;return this.on(B,m,n)},emit:function(B){var u=[].slice.call(arguments,1),n=((this.e||(this.e={}))[B]||[]).slice(),m=0,g=n.length;for(m;m<g;m++)n[m].fn.apply(n[m].ctx,u);return this},off:function(B,u){var n=this.e||(this.e={}),m=n[B],g=[];if(m&&u)for(var d=0,b=m.length;d<b;d++)m[d].fn!==u&&m[d].fn._!==u&&g.push(m[d]);g.length?n[B]=g:delete n[B];return this}};
L.exports=h;L.exports.TinyEmitter=h},function(L,p,h){function B(d){B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(b){return typeof b}:function(b){return b&&"function"===typeof Symbol&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b};return B(d)}var u=h(4).lazy,n=h(4).isFactory,m=h(4).traverse,g=h(13);p.math=!0;p.name="import";p.factory=function(d,b,k,c,r){function A(l,w){var C=arguments.length;if(1!==C&&2!==C)throw new g("import",C,1,2);w||={};if(n(l))x(l,
w);else if(Array.isArray(l))l.forEach(function(E){A(E,w)});else if("object"===B(l))for(var z in l)l.hasOwnProperty(z)&&(C=l[z],v(C)?t(z,C,w):n(l)?x(l,w):A(C,w));else if(!w.silent)throw new TypeError("Factory, Object, or Array expected");}function t(l,w,C){C.wrap&&"function"===typeof w&&(w=a(w));if(q(r[l])&&q(w))w=C.override?c(l,w.signatures):c(r[l],w),r[l]=w,e(l,w),r.emit("import",l,function(){return w});else if(void 0===r[l]||C.override)r[l]=w,e(l,w),r.emit("import",l,function(){return w});else if(!C.silent)throw Error('Cannot import "'+
l+'": already exists');}function e(l,w){w&&"function"===typeof w.transform?(r.expression.transform[l]=w.transform,y.hasOwnProperty(l)||(r.expression.mathWithTransform[l]=w.transform)):(delete r.expression.transform[l],y.hasOwnProperty(l)||(r.expression.mathWithTransform[l]=w))}function f(l){delete r.expression.transform[l];y.hasOwnProperty(l)?delete r.expression.mathWithTransform[l]:r.expression.mathWithTransform[l]=r[l]}function a(l){var w=function(){for(var C=[],z=0,E=arguments.length;z<E;z++){var J=
arguments[z];C[z]=J&&J.valueOf()}return l.apply(r,C)};l.transform&&(w.transform=l.transform);return w}function x(l,w){if("string"===typeof l.name){var C=l.name,z=C in r.expression.transform,E=l.path?m(r,l.path):r,J=E.hasOwnProperty(C)?E[C]:void 0,I=function(){var G=k(l);if(G&&"function"===typeof G.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(q(J)&&q(G))return w.override||(G=c(J,G)),
G;if(void 0===J||w.override)return G;if(!w.silent)throw Error('Cannot import "'+C+'": already exists');};if(!1!==l.lazy)u(E,C,I),z?f(C):("expression.transform"===l.path||void 0===l.path&&!y.hasOwnProperty(l.name))&&u(r.expression.mathWithTransform,C,I);else if(E[C]=I(),z)f(C);else if("expression.transform"===l.path||void 0===l.path&&!y.hasOwnProperty(l.name))r.expression.mathWithTransform[C]=I();r.emit("import",C,I,l.path)}else k(l)}function v(l){return"function"===typeof l||"number"===typeof l||
"string"===typeof l||"boolean"===typeof l||null===l||l&&d.isUnit(l)||l&&d.isComplex(l)||l&&d.isBigNumber(l)||l&&d.isFraction(l)||l&&d.isMatrix(l)||l&&Array.isArray(l)}function q(l){return"function"===typeof l&&"object"===B(l.signatures)}var y={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return A};p.lazy=!0},function(L,p){function h(B,u,n,m){if(!(this instanceof h))throw new SyntaxError("Constructor must be called with the new operator");this.fn=B;this.count=u;this.min=n;this.max=m;this.message=
"Wrong number of arguments in function "+B+" ("+u+" provided, "+n+(void 0!==m&&null!==m?"-"+m:"")+" expected)";this.stack=Error().stack}h.prototype=Error();h.prototype.constructor=Error;h.prototype.name="ArgumentsError";h.prototype.isArgumentsError=!0;L.exports=h},function(L,p,h){function B(m,g){return m.map(function(d){return d.toLowerCase()}).indexOf(g.toLowerCase())}function u(m,g,d){if(void 0!==m[g]&&-1===d.indexOf(m[g])){var b=B(d,m[g]);-1!==b?(console.warn('Warning: Wrong casing for configuration option "'+
g+'", should be "'+d[b]+'" instead of "'+m[g]+'".'),m[g]=d[b]):console.warn('Warning: Unknown value "'+m[g]+'" for configuration option "'+g+'". Available options: '+d.map(JSON.stringify).join(", ")+".")}}var n=h(4);p.name="config";p.math=!0;p.factory=function(m,g,d,b,k){function c(t){if(t){var e=n.map(g,n.clone);u(t,"matrix",r);u(t,"number",A);n.deepExtend(g,t);var f=n.map(g,n.clone);t=n.map(t,n.clone);k.emit("config",f,e,t);return f}return n.map(g,n.clone)}var r=["Matrix","Array"],A=["number","BigNumber",
"Fraction"];c.MATRIX=r;c.NUMBER=A;return c}},function(L,p,h){var B=h(16).string.isString;p.name="Matrix";p.path="type";p.factory=function(u,n,m,g){function d(){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");}d.prototype.type="Matrix";d.prototype.isMatrix=!0;d.storage=function(b){if(!B(b))throw new TypeError("format must be a string value");var k=d._storage[b];if(!k)throw new SyntaxError("Unsupported matrix storage format: "+b);return k};d._storage=
{};d.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface");};d.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface");};d.prototype.create=function(b,k){throw Error("Cannot invoke create on a Matrix interface");};d.prototype.subset=function(b,k,c){throw Error("Cannot invoke subset on a Matrix interface");};d.prototype.get=function(b){throw Error("Cannot invoke get on a Matrix interface");};d.prototype.set=function(b,k,c){throw Error("Cannot invoke set on a Matrix interface");
};d.prototype.resize=function(b,k){throw Error("Cannot invoke resize on a Matrix interface");};d.prototype.reshape=function(b,k){throw Error("Cannot invoke reshape on a Matrix interface");};d.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface");};d.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface");};d.prototype.map=function(b,k){throw Error("Cannot invoke map on a Matrix interface");};d.prototype.forEach=function(b){throw Error("Cannot invoke forEach on a Matrix interface");
};d.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface");};d.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface");};d.prototype.format=function(b){throw Error("Cannot invoke format on a Matrix interface");};d.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface");};return d}},function(L,p,h){p.array=h(17);p["boolean"]=h(22);p["function"]=h(23);p.number=h(8);p.object=h(4);p.string=h(18);p.emitter=
h(10)},function(L,p,h){function B(e){return e&&e.__esModule?e:{"default":e}}function u(e){for(var f=[];Array.isArray(e);)f.push(e.length),e=e[0];return f}function n(e,f,a){var x=e.length;if(x!==f[a])throw new A["default"](x,f[a]);if(a<f.length-1){var v=a+1;for(a=0;a<x;a++){if(!Array.isArray(e[a]))throw new A["default"](f.length-1,f.length,"<");n(e[a],f,v)}}else for(a=0;a<x;a++)if(Array.isArray(e[a]))throw new A["default"](f.length+1,f.length,">");}function m(e,f,a,x){var v=f[a],q=Math.min(e.length,
v);e.length=v;if(a<f.length-1){var y=a+1;for(a=0;a<q;a++){var l=e[a];Array.isArray(l)||(l=[l],e[a]=l);m(l,f,y,x)}for(a=q;a<v;a++)l=[],e[a]=l,m(l,f,y,x)}else{for(a=0;a<q;a++)for(;Array.isArray(e[a]);)e[a]=e[a][0];for(a=q;a<v;a++)e[a]=x}}function g(e,f){for(var a,x=f.length-1;0<x;x--){var v=f[x];a=[];for(var q=e.length/v,y=0;y<q;y++)a.push(e.slice(y*v,(y+1)*v));e=a}return e}function d(e,f,a){var x;if(a<f){var v=a+1;a=0;for(x=e.length;a<x;a++)e[a]=d(e[a],f,v)}else for(;Array.isArray(e);)e=e[0];return e}
function b(e,f,a){var x;if(Array.isArray(e)){var v=a+1;a=0;for(x=e.length;a<x;a++)e[a]=b(e[a],f,v)}else for(;a<f;a++)e=[e];return e}function k(e){if(!Array.isArray(e))return e;var f=[];e.forEach(function v(x){Array.isArray(x)?x.forEach(v):f.push(x)});return f}Object.defineProperty(p,"__esModule",{value:!0});p.size=u;p.validate=function(e,f){if(0===f.length){if(Array.isArray(e))throw new A["default"](e.length,0);}else n(e,f,0)};p.validateIndex=function(e,f){if(!c["default"].isNumber(e)||!c["default"].isInteger(e))throw new TypeError("Index must be an integer (value: "+
e+")");if(0>e||"number"===typeof f&&e>=f)throw new t["default"](e,f);};p.resize=function(e,f,a){if(!Array.isArray(e)||!Array.isArray(f))throw new TypeError("Array expected");if(0===f.length)throw Error("Resizing to scalar is not supported");f.forEach(function(x){if(!c["default"].isNumber(x)||!c["default"].isInteger(x)||0>x)throw new TypeError("Invalid size, must contain positive integers (size: "+r["default"].format(f)+")");});m(e,f,0,void 0!==a?a:0);return e};p.reshape=function(e,f){function a(l){return l.reduce(function(w,
C){return w*C})}var x=k(e);if(!Array.isArray(e)||!Array.isArray(f))throw new TypeError("Array expected");if(0===f.length)throw new A["default"](0,a(u(e)),"!=");for(var v=1,q=0;q<f.length;q++)v*=f[q];if(x.length!==v)throw new A["default"](a(f),a(u(e)),"!=");try{var y=g(x,f)}catch(l){if(l instanceof A["default"])throw new A["default"](a(f),a(u(e)),"!=");throw l;}return y};p.squeeze=function(e,f){for(f=f||u(e);Array.isArray(e)&&1===e.length;)e=e[0],f.shift();for(var a=f.length;1===f[a-1];)a--;a<f.length&&
(e=d(e,a,0),f.length=a);return e};p.unsqueeze=function(e,f,a,x){x=x||u(e);if(a)for(var v=0;v<a;v++)e=[e],x.unshift(1);for(e=b(e,f,0);x.length<f;)x.push(1);return e};p.flatten=k;p.map=function(e,f){return Array.prototype.map.call(e,f)};p.forEach=function(e,f){Array.prototype.forEach.call(e,f)};p.filter=function(e,f){if(1!==u(e).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,f)};p.filterRegExp=function(e,f){if(1!==u(e).length)throw Error("Only one dimensional matrices supported");
return Array.prototype.filter.call(e,function(a){return f.test(a)})};p.join=function(e,f){return Array.prototype.join.call(e,f)};p.identify=function(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var f=[],a=0;f[0]={value:e[0],identifier:0};for(var x=1;x<e.length;x++)e[x]===e[x-1]?a++:a=0,f.push({value:e[x],identifier:a});return f};p.generalize=function(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var f=
[],a=0;a<e.length;a++)f.push(e[a].value);return f};var c=B(h(8)),r=B(h(18)),A=B(h(20)),t=B(h(21))},function(L,p,h){function B(d){B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(b){return typeof b}:function(b){return b&&"function"===typeof Symbol&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b};return B(d)}function u(d,b){if(Array.isArray(d)){for(var k="[",c=d.length,r=0;r<c;r++)0!==r&&(k+=", "),k+=u(d[r],b);return k+"]"}return p.format(d,b)}var n=h(8).format,
m=h(19).format,g=h(5);p.isString=function(d){return"string"===typeof d};p.endsWith=function(d,b){return d.substring(d.length-b.length,d.length)===b};p.format=function(d,b){if("number"===typeof d)return n(d,b);if(g(d))return m(d,b);if(d&&"object"===B(d)&&"number"===typeof d.s&&"number"===typeof d.n&&"number"===typeof d.d)return b&&"decimal"===b.fraction?d.toString():d.s*d.n+"/"+d.d;if(Array.isArray(d))return u(d,b);if(p.isString(d))return'"'+d+'"';if("function"===typeof d)return d.syntax?String(d.syntax):
"function";if(d&&"object"===B(d)){if("function"===typeof d.format)return d.format(b);if(d&&d.toString()!=={}.toString())return d.toString();var k=[],c;for(c in d)d.hasOwnProperty(c)&&k.push('"'+c+'": '+p.format(d[c],b));return"{"+k.join(", ")+"}"}return String(d)};p.stringify=function(d){d=String(d);for(var b="",k=0;k<d.length;){var c=d.charAt(k);if("\\"===c){b+=c;k++;c=d.charAt(k);if(""===c||-1==='"\\/bfnrtu'.indexOf(c))b+="\\";b+=c}else b='"'===c?b+'\\"':b+c;k++}return'"'+b+'"'};p.escape=function(d){d=
String(d);return d=d.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}},function(L,p,h){var B=h(4);p.format=function(u,n){if("function"===typeof n)return n(u);if(!u.isFinite())return u.isNaN()?"NaN":u.gt(0)?"Infinity":"-Infinity";var m="auto";if(void 0!==n)if(n.notation&&(m=n.notation),"number"===typeof n)var g=n;else n.precision&&(g=n.precision);switch(m){case "fixed":return p.toFixed(u,g);case "exponential":return p.toExponential(u,g);
case "engineering":return p.toEngineering(u,g);case "auto":if(n&&n.exponential&&(void 0!==n.exponential.lower||void 0!==n.exponential.upper))return g=B.map(n,function(b){return b}),g.exponential=void 0,void 0!==n.exponential.lower&&(g.lowerExp=Math.round(Math.log(n.exponential.lower)/Math.LN10)),void 0!==n.exponential.upper&&(g.upperExp=Math.round(Math.log(n.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+
JSON.stringify(n)+" with "+JSON.stringify(g)),p.format(u,g);m=n&&void 0!==n.lowerExp?n.lowerExp:-3;n=n&&void 0!==n.upperExp?n.upperExp:5;if(u.isZero())return"0";var d=u.e;return(d>=m&&d<n?u.toSignificantDigits(g).toFixed():p.toExponential(u,g)).replace(/((\.\d*?)(0+))($|e)/,function(b,k,c,r,A){return"."!==c?c+A:A});default:throw Error('Unknown notation "'+m+'". Choose "auto", "exponential", or "fixed".');}};p.toEngineering=function(u,n){var m=u.e,g=0===m%3?m:0>m?m-3-m%3:m-m%3;u=u.mul(Math.pow(10,
-g));n=u.toPrecision(n);-1!==n.indexOf("e")&&(n=u.toString());return n+"e"+(0<=m?"+":"")+g.toString()};p.toExponential=function(u,n){return void 0!==n?u.toExponential(n-1):u.toExponential()};p.toFixed=function(u,n){return u.toFixed(n)}},function(L,p){function h(B,u,n){if(!(this instanceof h))throw new SyntaxError("Constructor must be called with the new operator");this.actual=B;this.expected=u;this.relation=n;this.message="Dimension mismatch ("+(Array.isArray(B)?"["+B.join(", ")+"]":B)+" "+(this.relation||
"!=")+" "+(Array.isArray(u)?"["+u.join(", ")+"]":u)+")";this.stack=Error().stack}h.prototype=new RangeError;h.prototype.constructor=RangeError;h.prototype.name="DimensionError";h.prototype.isDimensionError=!0;L.exports=h},function(L,p){function h(B,u,n){if(!(this instanceof h))throw new SyntaxError("Constructor must be called with the new operator");this.index=B;3>arguments.length?(this.min=0,this.max=u):(this.min=u,this.max=n);this.message=void 0!==this.min&&this.index<this.min?"Index out of range ("+
this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?"Index out of range ("+this.index+" > "+(this.max-1)+")":"Index out of range ("+this.index+")";this.stack=Error().stack}h.prototype=new RangeError;h.prototype.constructor=RangeError;h.prototype.name="IndexError";h.prototype.isIndexError=!0;L.exports=h},function(L,p){p.isBoolean=function(h){return"boolean"===typeof h}},function(L,p){function h(B){h="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(u){return typeof u}:
function(u){return u&&"function"===typeof Symbol&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};return h(B)}p.memoize=function(B,u){return function m(){"object"!==h(m.cache)&&(m.cache={});for(var g=[],d=0;d<arguments.length;d++)g[d]=arguments[d];d=u?u(g):JSON.stringify(g);d in m.cache||(m.cache[d]=B.apply(B,g));return m.cache[d]}};p.maxArgumentCount=function(B){return Object.keys(B.signatures||{}).reduce(function(u,n){n=(n.match(/,/g)||[]).length+1;return Math.max(u,n)},-1)};p.callWithRightArgumentCount=
function(B,u,n){return Object.keys(B.signatures||{}).reduce(function(m,g){g=(g.match(/,/g)||[]).length+1;return Math.max(m,g)},-1)}},function(L,p,h){var B=h(16),u=h(20),n=B.string,m=B.array,g=B.object;L=B.number;var d=Array.isArray,b=L.isNumber,k=L.isInteger,c=n.isString,r=m.validateIndex;p.name="DenseMatrix";p.path="type";p.factory=function(A,t,e,f){function a(z,E){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(E&&!c(E))throw Error("Invalid datatype: "+
E);if(A.isMatrix(z))"DenseMatrix"===z.type?(this._data=g.clone(z._data),this._size=g.clone(z._size)):(this._data=z.toArray(),this._size=z.size()),this._datatype=E||z._datatype;else if(z&&d(z.data)&&d(z.size))this._data=z.data,this._size=z.size,this._datatype=E||z.datatype;else{if(d(z))this._data=w(z),this._size=m.size(this._data),m.validate(this._data,this._size);else{if(z)throw new TypeError("Unsupported type of data ("+B.types.type(z)+")");this._data=[];this._size=[0]}this._datatype=E}}function x(z,
E,J,I){var G=I===J-1,H=E.dimension(I);return G?H.map(function(D){r(D,z.length);return z[D]}).valueOf():H.map(function(D){r(D,z.length);return x(z[D],E,J,I+1)}).valueOf()}function v(z,E,J,I){if(!E||!0!==E.isIndex)throw new TypeError("Invalid index");var G=E.size(),H=E.isScalar();if(A.isMatrix(J)){var D=J.size();J=J.valueOf()}else D=m.size(J);if(H){if(0!==D.length)throw new TypeError("Scalar expected");z.set(E.min(),J,I)}else{if(G.length<z._size.length)throw new u(G.length,z._size.length,"<");if(D.length<
G.length){for(var O=H=0;1===G[H]&&1===D[H];)H++;for(;1===G[H];)O++,H++;J=m.unsqueeze(J,G.length,O,D)}if(!g.deepEqual(G,D))throw new u(G,D,">");D=E.max().map(function(R){return R+1});l(z,D,I);q(z._data,E,J,G.length,0)}return z}function q(z,E,J,I,G){var H=G===I-1,D=E.dimension(G);H?D.forEach(function(O,R){r(O);z[O]=J[R[0]]}):D.forEach(function(O,R){r(O);q(z[O],E,J[R[0]],I,G+1)})}function y(z,E,J){if(0===E.length){for(z=z._data;d(z);)z=z[0];return z}z._size=E.slice(0);z._data=m.resize(z._data,z._size,
J);return z}function l(z,E,J){for(var I=z._size.slice(0),G=!1;I.length<E.length;)I.push(0),G=!0;for(var H=0,D=E.length;H<D;H++)E[H]>I[H]&&(I[H]=E[H],G=!0);G&&y(z,I,J)}function w(z){for(var E=0,J=z.length;E<J;E++){var I=z[E];d(I)?z[E]=w(I):I&&!0===I.isMatrix&&(z[E]=w(I.valueOf()))}return z}var C=e(h(25));t=e(h(15));a.prototype=new t;a.prototype.type="DenseMatrix";a.prototype.isDenseMatrix=!0;a.prototype.getDataType=function(){return C(this._data)};a.prototype.storage=function(){return"dense"};a.prototype.datatype=
function(){return this._datatype};a.prototype.create=function(z,E){return new a(z,E)};a.prototype.subset=function(z,E,J){switch(arguments.length){case 1:if(!A.isIndex(z))throw new TypeError("Invalid index");if(z.isScalar())var I=this.get(z.min());else{I=z.size();if(I.length!==this._size.length)throw new u(I.length,this._size.length);for(var G=z.min(),H=z.max(),D=0,O=this._size.length;D<O;D++)r(G[D],this._size[D]),r(H[D],this._size[D]);I=new a(x(this._data,z,I.length,0),this._datatype)}return I;case 2:case 3:return v(this,
z,E,J);default:throw new SyntaxError("Wrong number of arguments");}};a.prototype.get=function(z){if(!d(z))throw new TypeError("Array expected");if(z.length!==this._size.length)throw new u(z.length,this._size.length);for(var E=0;E<z.length;E++)r(z[E],this._size[E]);E=this._data;for(var J=0,I=z.length;J<I;J++){var G=z[J];r(G,E.length);E=E[G]}return E};a.prototype.set=function(z,E,J){if(!d(z))throw new TypeError("Array expected");if(z.length<this._size.length)throw new u(z.length,this._size.length,"<");
var I=z.map(function(D){return D+1});l(this,I,J);var G=this._data;J=0;for(I=z.length-1;J<I;J++){var H=z[J];r(H,G.length);G=G[H]}H=z[z.length-1];r(H,G.length);G[H]=E;return this};a.prototype.resize=function(z,E,J){if(!d(z))throw new TypeError("Array expected");J=J?this.clone():this;return y(J,z,E)};a.prototype.reshape=function(z,E){E=E?this.clone():this;E._data=m.reshape(E._data,z);E._size=z.slice(0);return E};a.prototype.clone=function(){return new a({data:g.clone(this._data),size:g.clone(this._size),
datatype:this._datatype})};a.prototype.size=function(){return this._size.slice(0)};a.prototype.map=function(z){var E=this;return new a({data:function H(I,G){return d(I)?I.map(function(D,O){return H(D,G.concat(O))}):z(I,G,E)}(this._data,[]),size:g.clone(this._size),datatype:this._datatype})};a.prototype.forEach=function(z){var E=this;(function H(I,G){d(I)?I.forEach(function(D,O){H(D,G.concat(O))}):z(I,G,E)})(this._data,[])};a.prototype.toArray=function(){return g.clone(this._data)};a.prototype.valueOf=
function(){return this._data};a.prototype.format=function(z){return n.format(this._data,z)};a.prototype.toString=function(){return n.format(this._data)};a.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}};a.prototype.diagonal=function(z){if(z){if(A.isBigNumber(z)&&(z=z.toNumber()),!b(z)||!k(z))throw new TypeError("The parameter k must be an integer number");}else z=0;var E=0<z?z:0;z=0>z?-z:0;for(var J=Math.min(this._size[0]-z,this._size[1]-
E),I=[],G=0;G<J;G++)I[G]=this._data[G+z][G+E];return new a({data:I,size:[J],datatype:this._datatype})};a.diagonal=function(z,E,J,I,G){if(!d(z))throw new TypeError("Array expected, size parameter");if(2!==z.length)throw Error("Only two dimensions matrix are supported");z=z.map(function(S){A.isBigNumber(S)&&(S=S.toNumber());if(!b(S)||!k(S)||1>S)throw Error("Size values must be positive integers");return S});if(J){if(A.isBigNumber(J)&&(J=J.toNumber()),!b(J)||!k(J))throw new TypeError("The parameter k must be an integer number");
}else J=0;I&&c(G)&&(I=f.convert(I,G));G=0<J?J:0;J=0>J?-J:0;var H=z[0],D=z[1],O=Math.min(H-J,D-G);if(d(E)){if(E.length!==O)throw Error("Invalid value array length");var R=function(S){return E[S]}}else if(A.isMatrix(E)){R=E.size();if(1!==R.length||R[0]!==O)throw Error("Invalid matrix length");R=function(S){return E.get([S])}}else R=function(){return E};I||=A.isBigNumber(R(0))?new A.BigNumber(0):0;var P=[];if(0<z.length)for(P=m.resize(P,z,I),z=0;z<O;z++)P[z+J][z+G]=R(z);return new a({data:P,size:[H,
D]})};a.fromJSON=function(z){return new a(z)};a.prototype.swapRows=function(z,E){if(!(b(z)&&k(z)&&b(E)&&k(E)))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");r(z,this._size[0]);r(E,this._size[0]);a._swapRows(z,E,this._data);return this};a._swapRows=function(z,E,J){var I=J[z];J[z]=J[E];J[E]=I};A.Matrix._storage.dense=a;return A.Matrix._storage["default"]=a};p.lazy=!1},function(L,p,h){p.factory=function(B,u,n,m){function g(b){for(var k,
c=0,r=0;r<b.length;r++){var A=b[r],t=Array.isArray(A);0===r&&t&&(c=A.length);if(t&&A.length!==c)return;A=t?g(A):d(A);if(void 0===k)k=A;else if(k!==A)return"mixed"}return k}var d=n(h(26));return g}},function(L,p){function h(B){h="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(u){return typeof u}:function(u){return u&&"function"===typeof Symbol&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};return h(B)}p.name="typeof";p.factory=function(B,u,n,m){u=m("_typeof",
{any:function(g){var d=h(g);return"object"===d?null===g?"null":Array.isArray(g)?"Array":g instanceof Date?"Date":g instanceof RegExp?"RegExp":B.isBigNumber(g)?"BigNumber":B.isComplex(g)?"Complex":B.isFraction(g)?"Fraction":B.isMatrix(g)?"Matrix":B.isUnit(g)?"Unit":B.isIndex(g)?"Index":B.isRange(g)?"Range":B.isResultSet(g)?"ResultSet":B.isNode(g)?g.type:B.isChain(g)?"Chain":B.isHelp(g)?"Help":"Object":"function"===d?"Function":d}});u.toTex=void 0;return u}},function(L,p,h){var B=h(28);p.name="sin";
p.factory=function(u,n,m,g){var d=g("sin",{number:Math.sin,Complex:function(b){return b.sin()},BigNumber:function(b){return b.sin()},Unit:function(b){if(!b.hasBase(u.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return d(b.value)},"Array | Matrix":function(b){return B(b,d,!0)}});d.toTex={1:"\\sin\\left(${args[0]}\\right)"};return d}},function(L,p){L.exports=function m(B,u,n){return B&&"function"===typeof B.map?B.map(function(g){return m(g,u,n)}):u(B)}},function(L,
p,h){var B=h(28);p.name="cos";p.factory=function(u,n,m,g){var d=g("cos",{number:Math.cos,Complex:function(b){return b.cos()},BigNumber:function(b){return b.cos()},Unit:function(b){if(!b.hasBase(u.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return d(b.value)},"Array | Matrix":function(b){return B(b,d)}});d.toTex={1:"\\cos\\left(${args[0]}\\right)"};return d}},function(L,p,h){var B=h(28);p.name="sqrt";p.factory=function(u,n,m,g){function d(k){return isNaN(k)?NaN:0<=
k||n.predictable?Math.sqrt(k):(new u.Complex(k,0)).sqrt()}var b=g("sqrt",{number:d,Complex:function(k){return k.sqrt()},BigNumber:function(k){return!k.isNegative()||n.predictable?k.sqrt():d(k.toNumber())},"Array | Matrix":function(k){return B(k,b,!0)},Unit:function(k){return k.pow(.5)}});b.toTex={1:"\\sqrt{${args[0]}}"};return b}},function(L,p,h){p.name="norm";p.factory=function(B,u,n,m){function g(v,q){var y=v.size();if(1===y.length){if(q===Number.POSITIVE_INFINITY||"inf"===q){var l=0;v.forEach(function(H){H=
d(H);e(H,l)&&(l=H)},!0);return l}if(q===Number.NEGATIVE_INFINITY||"-inf"===q){var w;v.forEach(function(H){H=d(H);if(!w||f(H,w))w=H},!0);return w||0}if("fro"===q)return g(v,2);if("number"===typeof q&&!isNaN(q)){if(!t(q,0)){var C=0;v.forEach(function(H){C=b(k(d(H),q),C)},!0);return k(C,1/q)}return Number.POSITIVE_INFINITY}throw Error("Unsupported parameter value");}if(2===y.length){if(1===q){var z=[],E=0;v.forEach(function(H,D){D=D[1];H=b(z[D]||0,d(H));e(H,E)&&(E=H);z[D]=H},!0);return E}if(q===Number.POSITIVE_INFINITY||
"inf"===q){var J=[],I=0;v.forEach(function(H,D){D=D[0];H=b(J[D]||0,d(H));e(H,I)&&(I=H);J[D]=H},!0);return I}if("fro"===q){var G=0;v.forEach(function(H,D){G=b(G,A(H,c(H)))});return d(r(G))}if(2===q)throw Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw Error("Unsupported parameter value");}}var d=n(h(32)),b=n(h(33)),k=n(h(45)),c=n(h(52)),r=n(h(30)),A=n(h(47)),t=n(h(40)),e=n(h(53)),f=n(h(57)),a=n(h(34)),x=m("norm",{number:Math.abs,Complex:function(v){return v.abs()},
BigNumber:function(v){return v.abs()},"boolean":function(v){return Math.abs(v)},Array:function(v){return g(a(v),2)},Matrix:function(v){return g(v,2)},"number | Complex | BigNumber | boolean, number | BigNumber | string":function(v){return x(v)},"Array, number | BigNumber | string":function(v,q){return g(a(v),q)},"Matrix, number | BigNumber | string":function(v,q){return g(v,q)}});x.toTex={1:"\\left\\|${args[0]}\\right\\|",2:void 0};return x}},function(L,p,h){var B=h(28);p.name="abs";p.factory=function(u,
n,m,g){var d=g("abs",{number:Math.abs,Complex:function(b){return b.abs()},BigNumber:function(b){return b.abs()},Fraction:function(b){return b.abs()},"Array | Matrix":function(b){return B(b,d,!0)},Unit:function(b){return b.abs()}});d.toTex={1:"\\left|${args[0]}\\right|"};return d}},function(L,p,h){var B=h(4).extend;p.name="add";p.factory=function(u,n,m,g){var d=m(h(34)),b=m(h(35));u=h(36);var k=m(h(38)),c=m(h(39)),r=m(h(42)),A=m(h(43)),t=m(h(44)),e=g("add",B({"DenseMatrix, DenseMatrix":function(f,
a){return A(f,a,b)},"DenseMatrix, SparseMatrix":function(f,a){return k(f,a,b,!1)},"SparseMatrix, DenseMatrix":function(f,a){return k(a,f,b,!0)},"SparseMatrix, SparseMatrix":function(f,a){return c(f,a,b)},"Array, Array":function(f,a){return e(d(f),d(a)).valueOf()},"Array, Matrix":function(f,a){return e(d(f),a)},"Matrix, Array":function(f,a){return e(f,d(a))},"DenseMatrix, any":function(f,a){return t(f,a,b,!1)},"SparseMatrix, any":function(f,a){return r(f,a,b,!1)},"any, DenseMatrix":function(f,a){return t(a,
f,b,!0)},"any, SparseMatrix":function(f,a){return r(a,f,b,!0)},"Array, any":function(f,a){return t(d(f),a,b,!1).valueOf()},"any, Array":function(f,a){return t(d(a),f,b,!0).valueOf()},"any, any":b,"any, any, ...any":function(f,a,x){f=e(f,a);for(a=0;a<x.length;a++)f=e(f,x[a]);return f}},b.signatures));e.toTex={2:"\\left(${args[0]}".concat(u.operators.add,"${args[1]}\\right)")};return e}},function(L,p){p.name="matrix";p.factory=function(h,B,u,n){function m(g,d,b){return new (h.Matrix.storage(d||"default"))(g,
b)}B=n("matrix",{"":function(){return m([])},string:function(g){return m([],g)},"string, string":function(g,d){return m([],g,d)},Array:function(g){return m(g)},Matrix:function(g){return m(g,g.storage())},"Array | Matrix, string":m,"Array | Matrix, string, string":m});B.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"};return B}},function(L,p){p.factory=function(h,B,u,n){var m=n("add",{"number, number":function(g,d){return g+d},"Complex, Complex":function(g,
d){return g.add(d)},"BigNumber, BigNumber":function(g,d){return g.plus(d)},"Fraction, Fraction":function(g,d){return g.add(d)},"Unit, Unit":function(g,d){if(null===g.value||void 0===g.value)throw Error("Parameter x contains a unit with undefined value");if(null===d.value||void 0===d.value)throw Error("Parameter y contains a unit with undefined value");if(!g.equalBase(d))throw Error("Units do not match");g=g.clone();g.value=m(g.value,d.value);g.fixPrefix=!1;return g}});return m}},function(L,p,h){var B=
h(37);p.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",
Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega","true":"\\mathrm{True}","false":"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"};p.operators={transpose:"^\\top",ctranspose:"^H",factorial:"!",
pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"};p.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var u={deg:"^\\circ"};
p.escape=function(n){return B(n,{preserveFormatting:!0})};p.toSymbol=function(n,m){return("undefined"===typeof m?0:m)?u.hasOwnProperty(n)?u[n]:"\\mathrm{"+p.escape(n)+"}":p.symbols.hasOwnProperty(n)?p.symbols[n]:p.escape(n)}},function(L,p){var h=Object.assign||function(m){for(var g=1;g<arguments.length;g++){var d=arguments[g],b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&(m[b]=d[b])}return m},B={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",
_:"\\_","~":"\\textasciitilde{}"},u={"\u2013":"\\--","\u2014":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},n=function(m,g){return h({},m,g)};L.exports=function(m){var g=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},d=g.preserveFormatting;d=void 0===d?!1:d;g=g.escapeMapFn;var b=String(m),k="",c=(void 0===g?n:g)(h({},B),d?h({},u):{}),r=Object.keys(c);for(g=function(){var A=!1;r.forEach(function(t,e){!A&&b.length>=t.length&&b.slice(0,t.length)===t&&(k+=c[r[e]],
b=b.slice(t.length,b.length),A=!0)});A||(k+=b.slice(0,1),b=b.slice(1,b.length))};b;)g();return k}},function(L,p,h){var B=h(20);p.name="algorithm01";p.factory=function(u,n,m,g){var d=u.DenseMatrix;return function(b,k,c,r){var A=b._data,t=b._size,e=b._datatype;b=k._values;var f=k._index,a=k._ptr,x=k._size,v=k._datatype;if(t.length!==x.length)throw new B(t.length,x.length);if(t[0]!==x[0]||t[1]!==x[1])throw new RangeError("Dimension mismatch. Matrix A ("+t+") must match Matrix B ("+x+")");if(!b)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");
k=t[0];t=t[1];c=(e="string"===typeof e&&e===v?e:void 0)?g.find(c,[e,e]):c;var q=[];for(v=0;v<k;v++)q[v]=[];var y=[],l=[];for(x=0;x<t;x++){for(var w=x+1,C=a[x+1],z=a[x];z<C;z++)v=f[z],y[v]=r?c(b[z],A[v][x]):c(A[v][x],b[z]),l[v]=w;for(v=0;v<k;v++)q[v][x]=l[v]===w?y[v]:A[v][x]}return new d({data:q,size:[k,t],datatype:e})}}},function(L,p,h){var B=h(20);p.name="algorithm04";p.factory=function(u,n,m,g){var d=m(h(40)),b=u.SparseMatrix;return function(k,c,r){var A=k._values,t=k._index,e=k._ptr,f=k._size,
a=k._datatype;k=c._values;var x=c._index,v=c._ptr,q=c._size,y=c._datatype;if(f.length!==q.length)throw new B(f.length,q.length);if(f[0]!==q[0]||f[1]!==q[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+q+")");var l=f[0];f=f[1];c=d;q=0;var w=r;if("string"===typeof a&&a===y){var C=a;c=g.find(d,[C,C]);q=g.convert(0,C);w=g.find(r,[C,C])}r=A&&k?[]:void 0;a=[];y=[];C=new b({values:r,index:a,ptr:y,size:[l,f],datatype:C});l=A&&k?[]:void 0;var z=A&&k?[]:void 0,E=[],J=[],
I,G;for(I=0;I<f;I++){y[I]=a.length;var H=I+1;var D=e[I];var O=e[I+1];for(G=D;G<O;G++)D=t[G],a.push(D),E[D]=H,l&&(l[D]=A[G]);D=v[I];O=v[I+1];for(G=D;G<O;G++)if(D=x[G],E[D]===H){if(l){var R=w(l[D],k[G]);c(R,q)?E[D]=null:l[D]=R}}else a.push(D),J[D]=H,z&&(z[D]=k[G]);if(l&&z)for(G=y[I];G<a.length;)D=a[G],E[D]===H?(r[G]=l[D],G++):J[D]===H?(r[G]=z[D],G++):a.splice(G,1)}y[f]=a.length;return C}}},function(L,p,h){var B=h(8).nearlyEqual,u=h(41);p.factory=function(n,m,g,d){var b=d("equalScalar",{"boolean, boolean":function(k,
c){return k===c},"number, number":function(k,c){return k===c||B(k,c,m.epsilon)},"BigNumber, BigNumber":function(k,c){return k.eq(c)||u(k,c,m.epsilon)},"Fraction, Fraction":function(k,c){return k.equals(c)},"Complex, Complex":function(k,c){return k.equals(c)},"Unit, Unit":function(k,c){if(!k.equalBase(c))throw Error("Cannot compare units with different base");return b(k.value,c.value)}});return b}},function(L,p){L.exports=function(h,B,u){if(null===u||void 0===u)return h.eq(B);if(h.eq(B))return!0;if(h.isNaN()||
B.isNaN())return!1;if(h.isFinite()&&B.isFinite()){var n=h.minus(B).abs();if(n.isZero())return!0;h=h.constructor.max(h.abs(),B.abs());return n.lte(h.times(u))}return!1}},function(L,p){p.name="algorithm10";p.factory=function(h,B,u,n){var m=h.DenseMatrix;return function(g,d,b,k){var c=g._values,r=g._index,A=g._ptr,t=g._size,e=g._datatype;if(!c)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");g=t[0];t=t[1];var f=b;if("string"===typeof e){var a=e;d=n.convert(d,a);f=n.find(b,
[a,a])}b=[];a=new m({data:b,size:[g,t],datatype:a});e=[];for(var x=[],v=0;v<t;v++){for(var q=v+1,y=A[v+1],l=A[v];l<y;l++){var w=r[l];e[w]=c[l];x[w]=q}for(y=0;y<g;y++)0===v&&(b[y]=[]),b[y][v]=x[y]===q?k?f(d,e[y]):f(e[y],d):d}return a}}},function(L,p,h){var B=h(20);p.name="algorithm13";p.factory=function(u,n,m,g){function d(k,c,r,A,t,e){var f=[];if(c===r.length-1)for(c=0;c<A;c++)f[c]=k(t[c],e[c]);else for(var a=0;a<A;a++)f[a]=d(k,c+1,r,r[c+1],t[a],e[a]);return f}var b=u.DenseMatrix;return function(k,
c,r){var A=k._data,t=k._size;k=k._datatype;var e=c._data,f=c._size,a=c._datatype;c=[];if(t.length!==f.length)throw new B(t.length,f.length);for(var x=0;x<t.length;x++){if(t[x]!==f[x])throw new RangeError("Dimension mismatch. Matrix A ("+t+") must match Matrix B ("+f+")");c[x]=t[x]}t=r;if("string"===typeof k&&k===a){var v=k;t=g.find(r,[v,v])}r=0<c.length?d(t,0,c,c[0],A,e):[];return new b({data:r,size:c,datatype:v})}}},function(L,p,h){var B=h(4).clone;p.name="algorithm14";p.factory=function(u,n,m,g){function d(k,
c,r,A,t,e,f){var a=[];if(c===r.length-1)for(c=0;c<A;c++)a[c]=f?k(e,t[c]):k(t[c],e);else for(var x=0;x<A;x++)a[x]=d(k,c+1,r,r[c+1],t[x],e,f);return a}var b=u.DenseMatrix;return function(k,c,r,A){var t=k._data,e=k._size;k=k._datatype;var f=r;if("string"===typeof k){var a=k;c=g.convert(c,a);f=g.find(r,[a,a])}c=0<e.length?d(f,0,e,e[0],t,c,A):[];return new b({data:c,size:B(e),datatype:a})}}},function(L,p,h){var B=h(8).isInteger,u=h(17).size;p.name="pow";p.factory=function(n,m,g,d){function b(x,v){if(m.predictable&&
!B(v)&&0>x)try{var q=f(v),y=a(q);if((v===y||1E-14>Math.abs((v-y)/v))&&1===q.d%2)return(0===q.n%2?1:-1)*Math.pow(-x,v)}catch(l){}return 1>x*x&&Infinity===v||1<x*x&&-Infinity===v?0:m.predictable&&(-1>x&&Infinity===v||-1<x&&0>x&&-Infinity===v)?NaN:B(v)||0<=x||m.predictable?Math.pow(x,v):(new n.Complex(x,0)).pow(v,0)}function k(x,v){if(!B(v)||0>v)throw new TypeError("For A^b, b must be a positive integer (value is "+v+")");var q=u(x);if(2!==q.length)throw Error("For A^b, A must be 2 dimensional (A has "+
q.length+" dimensions)");if(q[0]!==q[1])throw Error("For A^b, A must be square (size is "+q[0]+"x"+q[1]+")");for(q=A(q[0]).valueOf();1<=v;)1===(v&1)&&(q=t(x,q)),v>>=1,x=t(x,x);return q}function c(x,v){return e(k(x.valueOf(),v))}var r=h(36),A=g(h(46)),t=g(h(47)),e=g(h(34)),f=g(h(50)),a=g(h(51));g=d("pow",{"number, number":b,"Complex, Complex":function(x,v){return x.pow(v)},"BigNumber, BigNumber":function(x,v){return v.isInteger()||0<=x||m.predictable?x.pow(v):(new n.Complex(x.toNumber(),0)).pow(v.toNumber(),
0)},"Fraction, Fraction":function(x,v){if(1!==v.d){if(m.predictable)throw Error("Function pow does not support non-integer exponents for fractions.");return b(x.valueOf(),v.valueOf())}return x.pow(v)},"Array, number":k,"Array, BigNumber":function(x,v){return k(x,v.toNumber())},"Matrix, number":c,"Matrix, BigNumber":function(x,v){return c(x,v.toNumber())},"Unit, number | BigNumber":function(x,v){return x.pow(v)}});g.toTex={2:"\\left(${args[0]}\\right)".concat(r.operators.pow,"{${args[1]}}")};return g}},
function(L,p,h){var B=h(17),u=h(8).isInteger;p.name="identity";p.factory=function(n,m,g,d){function b(r,A){switch(r.length){case 0:return A?c(A):[];case 1:return k(r[0],r[0],A);case 2:return k(r[0],r[1],A);default:throw Error("Vector containing two values expected");}}function k(r,A,t){var e=n.isBigNumber(r)||n.isBigNumber(A)?n.BigNumber:null;n.isBigNumber(r)&&(r=r.toNumber());n.isBigNumber(A)&&(A=A.toNumber());if(!u(r)||1>r)throw Error("Parameters in function identity must be positive integers");
if(!u(A)||1>A)throw Error("Parameters in function identity must be positive integers");var f=e?new n.BigNumber(1):1;e=e?new e(0):0;var a=[r,A];if(t)return n.Matrix.storage(t).diagonal(a,f,0,e);t=B.resize([],a,e);r=r<A?r:A;for(A=0;A<r;A++)t[A][A]=f;return t}var c=g(h(34));g=d("identity",{"":function(){return"Matrix"===m.matrix?c([]):[]},string:function(r){return c(r)},"number | BigNumber":function(r){return k(r,r,"Matrix"===m.matrix?"default":void 0)},"number | BigNumber, string":function(r,A){return k(r,
r,A)},"number | BigNumber, number | BigNumber":function(r,A){return k(r,A,"Matrix"===m.matrix?"default":void 0)},"number | BigNumber, number | BigNumber, string":function(r,A,t){return k(r,A,t)},Array:function(r){return b(r)},"Array, string":function(r,A){return b(r,A)},Matrix:function(r){return b(r.valueOf(),r.storage())},"Matrix, string":function(r,A){return b(r.valueOf(),A)}});g.toTex=void 0;return g}},function(L,p,h){var B=h(4).extend,u=h(17);p.name="multiply";p.factory=function(n,m,g,d){function b(y,
l){switch(y.length){case 1:switch(l.length){case 1:if(y[0]!==l[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(y[0]!==l[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+y[0]+") must match Matrix rows ("+l[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+l.length+" dimensions)");}break;case 2:switch(l.length){case 1:if(y[1]!==l[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+
y[1]+") must match Vector length ("+l[0]+")");break;case 2:if(y[1]!==l[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+y[1]+") must match Matrix B rows ("+l[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+l.length+" dimensions)");}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+y.length+" dimensions)");}}m=h(36);var k=g(h(34)),c=g(h(35)),r=g(h(48)),A=g(h(40)),t=g(h(49)),e=g(h(44)),
f=n.DenseMatrix,a=n.SparseMatrix,x=d("multiply",B({"Array, Array":function(y,l){b(u.size(y),u.size(l));y=x(k(y),k(l));return n.isMatrix(y)?y.valueOf():y},"Matrix, Matrix":function(y,l){var w=y.size(),C=l.size();b(w,C);if(1===w.length){if(1===C.length){var z=w[0];if(0===z)throw Error("Cannot multiply two empty vectors");w=y._data;var E=y._datatype;C=l._data;var J=l._datatype;l=c;y=r;E&&J&&E===J&&"string"===typeof E&&(l=d.find(c,[E,E]),y=d.find(r,[E,E]));E=y(w[0],C[0]);for(J=1;J<z;J++)E=l(E,y(w[J],
C[J]));return E}if("dense"!==l.storage())throw Error("Support for SparseMatrix not implemented");w=y._data;var I=y._datatype;C=l._data;var G=l._datatype;y=y._size[0];l=l._size[1];E=c;J=r;I&&G&&I===G&&"string"===typeof I&&(z=I,E=d.find(c,[z,z]),J=d.find(r,[z,z]));I=[];for(G=0;G<l;G++){for(var H=J(w[0],C[0][G]),D=1;D<y;D++)H=E(H,J(w[D],C[D][G]));I[G]=H}return new f({data:I,size:[l],datatype:z})}return 1===C.length?v(y,l):q(y,l)},"Matrix, Array":function(y,l){return x(y,k(l))},"Array, Matrix":function(y,
l){return x(k(y,l.storage()),l)},"SparseMatrix, any":function(y,l){return t(y,l,r,!1)},"DenseMatrix, any":function(y,l){return e(y,l,r,!1)},"any, SparseMatrix":function(y,l){return t(l,y,r,!0)},"any, DenseMatrix":function(y,l){return e(l,y,r,!0)},"Array, any":function(y,l){return e(k(y),l,r,!1).valueOf()},"any, Array":function(y,l){return e(k(l),y,r,!0).valueOf()},"any, any":r,"any, any, ...any":function(y,l,w){y=x(y,l);for(l=0;l<w.length;l++)y=x(y,w[l]);return y}},r.signatures)),v=d("_multiplyMatrixVector",
{"DenseMatrix, any":function(y,l){var w=y._data,C=y._size,z=y._datatype;y=l._data;var E=l._datatype;l=C[0];C=C[1];var J=c,I=r;if(z&&E&&z===E&&"string"===typeof z){var G=z;J=d.find(c,[G,G]);I=d.find(r,[G,G])}z=[];for(E=0;E<l;E++){for(var H=w[E],D=I(H[0],y[0]),O=1;O<C;O++)D=J(D,I(H[O],y[O]));z[E]=D}return new f({data:z,size:[l],datatype:G})},"SparseMatrix, any":function(y,l){var w=y._values,C=y._index,z=y._ptr,E=y._datatype;if(!w)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");
var J=l._data,I=l._datatype;y=y._size[0];var G=l._size[0];l=[];var H=[],D=[],O=c,R=r,P=A,S=0;if(E&&I&&E===I&&"string"===typeof E){var Y=E;O=d.find(c,[Y,Y]);R=d.find(r,[Y,Y]);P=d.find(A,[Y,Y]);S=d.convert(0,Y)}E=[];I=[];for(var U=D[0]=0;U<G;U++){var W=J[U];if(!P(W,S))for(var V=z[U+1],da=z[U];da<V;da++){var ba=C[da];I[ba]?E[ba]=O(E[ba],R(W,w[da])):(I[ba]=!0,H.push(ba),E[ba]=R(W,w[da]))}}w=H.length;for(C=0;C<w;C++)l[C]=E[H[C]];D[1]=H.length;return new a({values:l,index:H,ptr:D,size:[y,1],datatype:Y})}}),
q=d("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(y,l){var w=y._data,C=y._size,z=y._datatype;y=l._data;var E=l._datatype,J=C[0];C=C[1];l=l._size[1];var I=c,G=r;if(z&&E&&z===E&&"string"===typeof z){var H=z;I=d.find(c,[H,H]);G=d.find(r,[H,H])}z=[];for(E=0;E<J;E++){var D=w[E];z[E]=[];for(var O=0;O<l;O++){for(var R=G(D[0],y[0][O]),P=1;P<C;P++)R=I(R,G(D[P],y[P][O]));z[E][O]=R}}return new f({data:z,size:[J,l],datatype:H})},"DenseMatrix, SparseMatrix":function(y,l){var w=y._data,C=y._size,
z=y._datatype;y=l._values;var E=l._index,J=l._ptr,I=l._size,G=l._datatype;if(!y)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");C=C[0];I=I[1];l=c;var H=r,D=A,O=0;if(z&&G&&z===G&&"string"===typeof z){var R=z;l=d.find(c,[R,R]);H=d.find(r,[R,R]);D=d.find(A,[R,R]);O=d.convert(0,R)}z=[];G=[];var P=[];R=new a({values:z,index:G,ptr:P,size:[C,I],datatype:R});for(var S=0;S<I;S++){P[S]=G.length;var Y=J[S],U=J[S+1];if(U>Y)for(var W=0,V=0;V<C;V++){for(var da=V+1,ba=void 0,fa=Y;fa<U;fa++){var X=
E[fa];W!==da?(ba=H(w[V][X],y[fa]),W=da):ba=l(ba,H(w[V][X],y[fa]))}W!==da||D(ba,O)||(G.push(V),z.push(ba))}}P[I]=G.length;return R},"SparseMatrix, DenseMatrix":function(y,l){var w=y._values,C=y._index,z=y._ptr,E=y._datatype;if(!w)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var J=l._data,I=l._datatype,G=y._size[0];y=l._size[0];l=l._size[1];var H=c,D=r,O=A,R=0;if(E&&I&&E===I&&"string"===typeof E){var P=E;H=d.find(c,[P,P]);D=d.find(r,[P,P]);O=d.find(A,[P,P]);R=d.convert(0,P)}E=
[];I=[];var S=[];P=new a({values:E,index:I,ptr:S,size:[G,l],datatype:P});G=[];for(var Y=[],U=0;U<l;U++){S[U]=I.length;for(var W=U+1,V=0;V<y;V++){var da=J[V][U];if(!O(da,R))for(var ba=z[V+1],fa=z[V];fa<ba;fa++){var X=C[fa];Y[X]!==W?(Y[X]=W,I.push(X),G[X]=D(da,w[fa])):G[X]=H(G[X],D(da,w[fa]))}}W=I.length;for(V=S[U];V<W;V++)E[V]=G[I[V]]}S[l]=I.length;return P},"SparseMatrix, SparseMatrix":function(y,l){var w=y._values,C=y._index,z=y._ptr,E=y._datatype,J=l._values,I=l._index,G=l._ptr,H=l._datatype,D=
y._size[0];l=l._size[1];y=w&&J;var O=c,R=r;if(E&&H&&E===H&&"string"===typeof E){var P=E;O=d.find(c,[P,P]);R=d.find(r,[P,P])}E=y?[]:void 0;H=[];var S=[];P=new a({values:E,index:H,ptr:S,size:[D,l],datatype:P});D=y?[]:void 0;for(var Y=[],U,W,V,da,ba,fa=0;fa<l;fa++){S[fa]=H.length;var X=fa+1;V=G[fa];for(da=G[fa+1];V<da;V++)if(W=I[V],y)for(U=z[W],W=z[W+1];U<W;U++)ba=C[U],Y[ba]!==X?(Y[ba]=X,H.push(ba),D[ba]=R(J[V],w[U])):D[ba]=O(D[ba],R(J[V],w[U]));else for(U=z[W],W=z[W+1];U<W;U++)ba=C[U],Y[ba]!==X&&(Y[ba]=
X,H.push(ba));if(y)for(da=H.length,X=S[fa];X<da;X++)E[X]=D[H[X]]}S[l]=H.length;return P}});x.toTex={2:"\\left(${args[0]}".concat(m.operators.multiply,"${args[1]}\\right)")};return x}},function(L,p){p.factory=function(h,B,u,n){var m=n("multiplyScalar",{"number, number":function(g,d){return g*d},"Complex, Complex":function(g,d){return g.mul(d)},"BigNumber, BigNumber":function(g,d){return g.times(d)},"Fraction, Fraction":function(g,d){return g.mul(d)},"number | Fraction | BigNumber | Complex, Unit":function(g,
d){d=d.clone();d.value=null===d.value?d._normalize(g):m(d.value,g);return d},"Unit, number | Fraction | BigNumber | Complex":function(g,d){g=g.clone();g.value=null===g.value?g._normalize(d):m(g.value,d);return g},"Unit, Unit":function(g,d){return g.multiply(d)}});return m}},function(L,p,h){p.name="algorithm11";p.factory=function(B,u,n,m){var g=n(h(40)),d=B.SparseMatrix;return function(b,k,c,r){var A=b._values,t=b._index,e=b._ptr,f=b._size,a=b._datatype;if(!A)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");
var x=f[0];f=f[1];b=g;var v=0,q=c;if("string"===typeof a){var y=a;b=m.find(g,[y,y]);v=m.convert(0,y);k=m.convert(k,y);q=m.find(c,[y,y])}c=[];a=[];var l=[];y=new d({values:c,index:a,ptr:l,size:[x,f],datatype:y});for(x=0;x<f;x++){l[x]=a.length;for(var w=e[x+1],C=e[x];C<w;C++){var z=t[C],E=r?q(k,A[C]):q(A[C],k);b(E,v)||(a.push(z),c.push(E))}}l[f]=a.length;return y}}},function(L,p,h){var B=h(28);p.name="fraction";p.factory=function(u,n,m,g){var d=g("fraction",{number:function(b){if(!isFinite(b)||isNaN(b))throw Error(b+
" cannot be represented as a fraction");return new u.Fraction(b)},string:function(b){return new u.Fraction(b)},"number, number":function(b,k){return new u.Fraction(b,k)},"null":function(b){return new u.Fraction(0)},BigNumber:function(b){return new u.Fraction(b.toString())},Fraction:function(b){return b},Object:function(b){return new u.Fraction(b)},"Array | Matrix":function(b){return B(b,d)}});return d}},function(L,p,h){var B=h(28);p.name="number";p.factory=function(u,n,m,g){var d=g("number",{"":function(){return 0},
number:function(b){return b},string:function(b){if("NaN"===b)return NaN;var k=Number(b);if(isNaN(k))throw new SyntaxError('String "'+b+'" is no valid number');return k},BigNumber:function(b){return b.toNumber()},Fraction:function(b){return b.valueOf()},Unit:function(b){throw Error("Second argument with valueless unit expected");},"null":function(b){return 0},"Unit, string | Unit":function(b,k){return b.toNumber(k)},"Array | Matrix":function(b){return B(b,d)}});d.toTex={0:"0",1:"\\left(${args[0]}\\right)",
2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"};return d}},function(L,p,h){var B=h(28);p.name="conj";p.factory=function(u,n,m,g){var d=g("conj",{number:function(b){return b},BigNumber:function(b){return b},Complex:function(b){return b.conjugate()},"Array | Matrix":function(b){return B(b,d)}});d.toTex={1:"\\left(${args[0]}\\right)^*"};return d}},function(L,p,h){var B=h(8).nearlyEqual,u=h(41);p.name="larger";p.factory=function(n,m,g,d){var b=g(h(34)),k=g(h(54)),c=g(h(55)),r=g(h(56)),A=g(h(43)),
t=g(h(44));n=h(36);var e=d("larger",{"boolean, boolean":function(f,a){return f>a},"number, number":function(f,a){return f>a&&!B(f,a,m.epsilon)},"BigNumber, BigNumber":function(f,a){return f.gt(a)&&!u(f,a,m.epsilon)},"Fraction, Fraction":function(f,a){return 1===f.compare(a)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(f,a){if(!f.equalBase(a))throw Error("Cannot compare units with different base");return e(f.value,
a.value)},"SparseMatrix, SparseMatrix":function(f,a){return c(f,a,e)},"SparseMatrix, DenseMatrix":function(f,a){return k(a,f,e,!0)},"DenseMatrix, SparseMatrix":function(f,a){return k(f,a,e,!1)},"DenseMatrix, DenseMatrix":function(f,a){return A(f,a,e)},"Array, Array":function(f,a){return e(b(f),b(a)).valueOf()},"Array, Matrix":function(f,a){return e(b(f),a)},"Matrix, Array":function(f,a){return e(f,b(a))},"SparseMatrix, any":function(f,a){return r(f,a,e,!1)},"DenseMatrix, any":function(f,a){return t(f,
a,e,!1)},"any, SparseMatrix":function(f,a){return r(a,f,e,!0)},"any, DenseMatrix":function(f,a){return t(a,f,e,!0)},"Array, any":function(f,a){return t(b(f),a,e,!1).valueOf()},"any, Array":function(f,a){return t(b(a),f,e,!0).valueOf()}});e.toTex={2:"\\left(${args[0]}".concat(n.operators.larger,"${args[1]}\\right)")};return e}},function(L,p,h){var B=h(20);p.name="algorithm03";p.factory=function(u,n,m,g){var d=u.DenseMatrix;return function(b,k,c,r){var A=b._data,t=b._size,e=b._datatype;b=k._values;
var f=k._index,a=k._ptr,x=k._size,v=k._datatype;if(t.length!==x.length)throw new B(t.length,x.length);if(t[0]!==x[0]||t[1]!==x[1])throw new RangeError("Dimension mismatch. Matrix A ("+t+") must match Matrix B ("+x+")");if(!b)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");k=t[0];t=t[1];x=0;var q=c;if("string"===typeof e&&e===v){var y=e;x=g.convert(0,y);q=g.find(c,[y,y])}c=[];for(e=0;e<k;e++)c[e]=[];e=[];v=[];for(var l=0;l<t;l++){for(var w=l+1,C=a[l+1],z=a[l];z<C;z++){var E=
f[z];e[E]=r?q(b[z],A[E][l]):q(A[E][l],b[z]);v[E]=w}for(C=0;C<k;C++)c[C][l]=v[C]===w?e[C]:r?q(x,A[C][l]):q(A[C][l],x)}return new d({data:c,size:[k,t],datatype:y})}}},function(L,p,h){var B=h(20);p.name="algorithm07";p.factory=function(u,n,m,g){function d(k,c,r,A,t){var e=k._values,f=k._index,a=k._ptr;k=a[c];for(c=a[c+1];k<c;k++)a=f[k],r[a]=t,A[a]=e[k]}var b=u.DenseMatrix;return function(k,c,r){var A=k._size,t=k._datatype,e=c._size,f=c._datatype;if(A.length!==e.length)throw new B(A.length,e.length);
if(A[0]!==e[0]||A[1]!==e[1])throw new RangeError("Dimension mismatch. Matrix A ("+A+") must match Matrix B ("+e+")");e=A[0];A=A[1];var a=0,x=r;if("string"===typeof t&&t===f){var v=t;a=g.convert(0,v);x=g.find(r,[v,v])}t=[];for(r=0;r<e;r++)t[r]=[];f=new b({data:t,size:[e,A],datatype:v});var q=[],y=[],l=[],w=[];for(v=0;v<A;v++){var C=v+1;d(k,v,l,q,C);d(c,v,w,y,C);for(r=0;r<e;r++)t[r][v]=x(l[r]===C?q[r]:a,w[r]===C?y[r]:a)}return f}}},function(L,p){p.name="algorithm12";p.factory=function(h,B,u,n){var m=
h.DenseMatrix;return function(g,d,b,k){var c=g._values,r=g._index,A=g._ptr,t=g._size,e=g._datatype;if(!c)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");g=t[0];t=t[1];var f=b;if("string"===typeof e){var a=e;d=n.convert(d,a);f=n.find(b,[a,a])}b=[];a=new m({data:b,size:[g,t],datatype:a});e=[];for(var x=[],v=0;v<t;v++){for(var q=v+1,y=A[v+1],l=A[v];l<y;l++){var w=r[l];e[w]=c[l];x[w]=q}for(y=0;y<g;y++)0===v&&(b[y]=[]),b[y][v]=x[y]===q?k?f(d,e[y]):f(e[y],d):k?f(d,0):f(0,
d)}return a}}},function(L,p,h){var B=h(8).nearlyEqual,u=h(41);p.name="smaller";p.factory=function(n,m,g,d){var b=g(h(34)),k=g(h(54)),c=g(h(55)),r=g(h(56)),A=g(h(43)),t=g(h(44));n=h(36);var e=d("smaller",{"boolean, boolean":function(f,a){return f<a},"number, number":function(f,a){return f<a&&!B(f,a,m.epsilon)},"BigNumber, BigNumber":function(f,a){return f.lt(a)&&!u(f,a,m.epsilon)},"Fraction, Fraction":function(f,a){return-1===f.compare(a)},"Complex, Complex":function(f,a){throw new TypeError("No ordering relation is defined for complex numbers");
},"Unit, Unit":function(f,a){if(!f.equalBase(a))throw Error("Cannot compare units with different base");return e(f.value,a.value)},"SparseMatrix, SparseMatrix":function(f,a){return c(f,a,e)},"SparseMatrix, DenseMatrix":function(f,a){return k(a,f,e,!0)},"DenseMatrix, SparseMatrix":function(f,a){return k(f,a,e,!1)},"DenseMatrix, DenseMatrix":function(f,a){return A(f,a,e)},"Array, Array":function(f,a){return e(b(f),b(a)).valueOf()},"Array, Matrix":function(f,a){return e(b(f),a)},"Matrix, Array":function(f,
a){return e(f,b(a))},"SparseMatrix, any":function(f,a){return r(f,a,e,!1)},"DenseMatrix, any":function(f,a){return t(f,a,e,!1)},"any, SparseMatrix":function(f,a){return r(a,f,e,!0)},"any, DenseMatrix":function(f,a){return t(a,f,e,!0)},"Array, any":function(f,a){return t(b(f),a,e,!1).valueOf()},"any, Array":function(f,a){return t(b(a),f,e,!0).valueOf()}});e.toTex={2:"\\left(${args[0]}".concat(n.operators.smaller,"${args[1]}\\right)")};return e}},function(L,p,h){var B=h(4).extend;p.name="divide";p.factory=
function(u,n,m,g){var d=m(h(59)),b=m(h(47)),k=m(h(62)),c=m(h(34)),r=m(h(49)),A=m(h(44));u=g("divide",B({"Array | Matrix, Array | Matrix":function(t,e){return b(t,k(e))},"DenseMatrix, any":function(t,e){return A(t,e,d,!1)},"SparseMatrix, any":function(t,e){return r(t,e,d,!1)},"Array, any":function(t,e){return A(c(t),e,d,!1).valueOf()},"any, Array | Matrix":function(t,e){return b(t,k(e))}},d.signatures));u.toTex={2:"\\frac{${args[0]}}{${args[1]}}"};return u}},function(L,p,h){p.factory=function(B,u,
n,m){var g=n(h(60)),d=n(h(26)),b=m("divide",{"number, number":function(k,c){return k/c},"Complex, Complex":function(k,c){return k.div(c)},"BigNumber, BigNumber":function(k,c){return k.div(c)},"Fraction, Fraction":function(k,c){return k.div(c)},"Unit, number | Fraction | BigNumber":function(k,c){k=k.clone();var r=g(1,d(c));k.value=b(null===k.value?k._normalize(r):k.value,c);return k},"number | Fraction | BigNumber, Unit":function(k,c){var r=c.clone();r=r.pow(-1);var A=g(1,d(k));r.value=b(k,null===
c.value?c._normalize(A):c.value);return r},"Unit, Unit":function(k,c){return k.divide(c)}});return b}},function(L,p,h){p.path="type";p.name="_numeric";p.factory=function(B,u,n,m){var g=n(h(26)),d={string:!0,number:!0,BigNumber:!0,Fraction:!0},b={number:n(h(51)),BigNumber:n(h(61)),Fraction:n(h(50))};B=function(k,c){var r=g(k);if(!(r in d))throw new TypeError("Cannot convert "+k+' of type "'+r+'"; valid input types are '+Object.keys(d).join(", "));if(!(c in b))throw new TypeError("Cannot convert "+
k+' to type "'+c+'"; valid output types are '+Object.keys(b).join(", "));return c===r?k:b[c](k)};B.toTex=function(k,c){return k.args[0].toTex()};return B}},function(L,p,h){var B=h(28);p.name="bignumber";p.factory=function(u,n,m,g){var d=g("bignumber",{"":function(){return new u.BigNumber(0)},number:function(b){return new u.BigNumber(b+"")},string:function(b){return new u.BigNumber(b)},BigNumber:function(b){return b},Fraction:function(b){return(new u.BigNumber(b.n)).div(b.d).times(b.s)},"null":function(b){return new u.BigNumber(0)},
"Array | Matrix":function(b){return B(b,d)}});d.toTex={0:"0",1:"\\left(${args[0]}\\right)"};return d}},function(L,p,h){var B=h(16);p.name="inv";p.factory=function(u,n,m,g){function d(a,x,v){if(1===x){x=a[0][0];if(0===x)throw Error("Cannot calculate inverse, determinant is zero");return[[k(1,x)]]}if(2===x){x=t(a);if(0===x)throw Error("Cannot calculate inverse, determinant is zero");return[[k(a[1][1],x),k(A(a[0][1]),x)],[k(A(a[1][0]),x),k(a[0][0],x)]]}var q=a.concat();for(a=0;a<x;a++)q[a]=q[a].concat();
for(var y=e(x).valueOf(),l=0;l<v;l++){var w=f(q[l][l]);var C=l;for(a=l+1;a<x;)f(q[a][l])>w&&(w=f(q[a][l]),C=a),a++;if(0===w)throw Error("Cannot calculate inverse, determinant is zero");a=C;a!==l&&(w=q[l],q[l]=q[a],q[a]=w,w=y[l],y[l]=y[a],y[a]=w);var z=q[l],E=y[l];for(a=0;a<x;a++){var J=q[a],I=y[a];if(a!==l){if(0!==J[l]){C=k(A(J[l]),z[l]);for(w=l;w<v;w++)J[w]=c(J[w],r(C,z[w]));for(w=0;w<v;w++)I[w]=c(I[w],r(C,E[w]))}}else{C=z[l];for(w=l;w<v;w++)J[w]=k(J[w],C);for(w=0;w<v;w++)I[w]=k(I[w],C)}}}return y}
var b=m(h(34)),k=m(h(59)),c=m(h(35)),r=m(h(47)),A=m(h(63)),t=m(h(64)),e=m(h(46)),f=m(h(32));n=g("inv",{"Array | Matrix":function(a){var x=u.isMatrix(a)?a.size():B.array.size(a);switch(x.length){case 1:if(1===x[0])return u.isMatrix(a)?b([k(1,a.valueOf()[0])]):[k(1,a[0])];throw new RangeError("Matrix must be square (size: "+B.string.format(x)+")");case 2:var v=x[0],q=x[1];if(v===q)return u.isMatrix(a)?b(d(a.valueOf(),v,q),a.storage()):d(a,v,q);throw new RangeError("Matrix must be square (size: "+B.string.format(x)+
")");default:throw new RangeError("Matrix must be two dimensional (size: "+B.string.format(x)+")");}},any:function(a){return k(1,a)}});n.toTex={1:"\\left(${args[0]}\\right)^{-1}"};return n}},function(L,p,h){var B=h(28);p.name="unaryMinus";p.factory=function(u,n,m,g){u=h(36);var d=g("unaryMinus",{number:function(b){return-b},Complex:function(b){return b.neg()},BigNumber:function(b){return b.neg()},Fraction:function(b){return b.neg()},Unit:function(b){var k=b.clone();k.value=d(b.value);return k},"Array | Matrix":function(b){return B(b,
d,!0)}});d.toTex={1:"".concat(u.operators.unaryMinus,"\\left(${args[0]}\\right)")};return d}},function(L,p,h){L=h(16);var B=L.object,u=L.string;p.name="det";p.factory=function(n,m,g,d){var b=g(h(34)),k=g(h(65)),c=g(h(47)),r=g(h(63)),A=g(h(67));m=d("det",{any:function(t){return B.clone(t)},"Array | Matrix":function(t){if(n.isMatrix(t))var e=t.size();else Array.isArray(t)?(t=b(t),e=t.size()):e=[];switch(e.length){case 0:return B.clone(t);case 1:if(1===e[0])return B.clone(t.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+
u.format(e)+")");case 2:var f=e[0];if(f===e[1]){t=t.clone().valueOf();if(1===f)f=B.clone(t[0][0]);else if(2===f)f=k(c(t[0][0],t[1][1]),c(t[1][0],t[0][1]));else{t=A(t);e=t.U[0][0];for(var a=1;a<f;a++)e=c(e,t.U[a][a]);for(var x=a=0,v=[];;){for(;v[x];)x++;if(x>=f)break;for(var q=x,y=0;!v[t.p[q]];)v[t.p[q]]=!0,q=t.p[q],y++;0===y%2&&a++}f=0===a%2?e:r(e)}return f}throw new RangeError("Matrix must be square (size: "+u.format(e)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+u.format(e)+
")");}}});m.toTex={1:"\\det\\left(${args[0]}\\right)"};return m}},function(L,p,h){function B(n,m){n=n.size();m=m.size();if(n.length!==m.length)throw new u(n.length,m.length);}var u=h(20);p.name="subtract";p.factory=function(n,m,g,d){n=h(36);var b=g(h(34)),k=g(h(35)),c=g(h(63)),r=g(h(38)),A=g(h(54)),t=g(h(66)),e=g(h(42)),f=g(h(43)),a=g(h(44)),x=d("subtract",{"number, number":function(v,q){return v-q},"Complex, Complex":function(v,q){return v.sub(q)},"BigNumber, BigNumber":function(v,q){return v.minus(q)},
"Fraction, Fraction":function(v,q){return v.sub(q)},"Unit, Unit":function(v,q){if(null===v.value)throw Error("Parameter x contains a unit with undefined value");if(null===q.value)throw Error("Parameter y contains a unit with undefined value");if(!v.equalBase(q))throw Error("Units do not match");v=v.clone();v.value=x(v.value,q.value);v.fixPrefix=!1;return v},"SparseMatrix, SparseMatrix":function(v,q){B(v,q);return t(v,q,x)},"SparseMatrix, DenseMatrix":function(v,q){B(v,q);return A(q,v,x,!0)},"DenseMatrix, SparseMatrix":function(v,
q){B(v,q);return r(v,q,x,!1)},"DenseMatrix, DenseMatrix":function(v,q){B(v,q);return f(v,q,x)},"Array, Array":function(v,q){return x(b(v),b(q)).valueOf()},"Array, Matrix":function(v,q){return x(b(v),q)},"Matrix, Array":function(v,q){return x(v,b(q))},"SparseMatrix, any":function(v,q){return e(v,c(q),k)},"DenseMatrix, any":function(v,q){return a(v,q,x)},"any, SparseMatrix":function(v,q){return e(q,v,x,!0)},"any, DenseMatrix":function(v,q){return a(q,v,x,!0)},"Array, any":function(v,q){return a(b(v),
q,x,!1).valueOf()},"any, Array":function(v,q){return a(b(q),v,x,!0).valueOf()}});x.toTex={2:"\\left(${args[0]}".concat(n.operators.subtract,"${args[1]}\\right)")};return x}},function(L,p,h){var B=h(20);p.name="algorithm05";p.factory=function(u,n,m,g){var d=m(h(40)),b=u.SparseMatrix;return function(k,c,r){var A=k._values,t=k._index,e=k._ptr,f=k._size,a=k._datatype;k=c._values;var x=c._index,v=c._ptr,q=c._size,y=c._datatype;if(f.length!==q.length)throw new B(f.length,q.length);if(f[0]!==q[0]||f[1]!==
q[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+q+")");var l=f[0];f=f[1];c=d;q=0;var w=r;if("string"===typeof a&&a===y){var C=a;c=g.find(d,[C,C]);q=g.convert(0,C);w=g.find(r,[C,C])}r=A&&k?[]:void 0;a=[];y=[];C=new b({values:r,index:a,ptr:y,size:[l,f],datatype:C});l=r?[]:void 0;var z=r?[]:void 0,E=[],J=[],I,G;for(I=0;I<f;I++){y[I]=a.length;var H=I+1;var D=e[I];for(G=e[I+1];D<G;D++){var O=t[D];a.push(O);E[O]=H;l&&(l[O]=A[D])}D=v[I];for(G=v[I+1];D<G;D++)O=x[D],
E[O]!==H&&a.push(O),J[O]=H,z&&(z[O]=k[D]);if(r)for(D=y[I];D<a.length;){O=a[D];G=E[O];var R=J[O];if(G===H||R===H)O=w(G===H?l[O]:q,R===H?z[O]:q),c(O,q)?a.splice(D,1):(r.push(O),D++)}}y[f]=a.length;return C}}},function(L,p,h){var B=h(16).object;p.name="lup";p.factory=function(u,n,m,g){function d(l){var w=l._size[0],C=l._size[1],z=Math.min(w,C),E=B.clone(l._data),J=[],I=[w,z],G=[];z=[z,C];var H,D,O=[];for(l=0;l<w;l++)O[l]=l;for(H=0;H<C;H++){if(0<H)for(l=0;l<w;l++){var R=Math.min(l,H),P=0;for(D=0;D<R;D++)P=
r(P,t(E[l][D],E[D][H]));E[l][H]=e(E[l][H],P)}D=H;P=R=0;for(l=H;l<w;l++){var S=E[l][H],Y=c(S);f(Y,R)&&(D=l,R=Y,P=S)}H!==D&&(O[H]=[O[D],O[D]=O[H]][0],q._swapRows(H,D,E));if(H<w)for(l=H+1;l<w;l++)a(E[l][H],0)||(E[l][H]=A(E[l][H],P))}for(H=0;H<C;H++)for(l=0;l<w;l++)0===H&&(l<C&&(G[l]=[]),J[l]=[]),l<H?(l<C&&(G[l][H]=E[l][H]),H<w&&(J[l][H]=0)):l===H?(l<C&&(G[l][H]=E[l][H]),H<w&&(J[l][H]=1)):(l<C&&(G[l][H]=0),H<w&&(J[l][H]=E[l][H]));w=new q({data:J,size:I});C=new q({data:G,size:z});G=[];l=0;for(z=O.length;l<
z;l++)G[O[l]]=l;return{L:w,U:C,p:G,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}function b(l){var w=l._size[0],C=l._size[1],z=Math.min(w,C),E=l._values,J=l._index,I=l._ptr,G=[],H=[],D=[],O=[w,z],R=[],P=[],S=[],Y=[z,C],U,W,V,da=[],ba=[];for(U=0;U<w;U++)da[U]=U,ba[U]=U;var fa=function(X,ja){var ia=ba[X],ka=ba[ja];da[ia]=ja;da[ka]=X;ba[X]=ka;ba[ja]=ia};l=function(){var X=new y;W<w&&(D.push(G.length),G.push(1),H.push(W));S.push(R.length);var ja=I[W+1];for(V=
I[W];V<ja;V++)U=J[V],X.set(da[U],E[V]);0<W&&X.forEach(0,W-1,function(ca,F){v._forEachRow(ca,G,H,D,function(K,N){K>ca&&X.accumulate(K,x(t(N,F)))})});var ia=W,ka=X.get(W),ra=c(ka);X.forEach(W+1,w-1,function(ca,F){var K=c(F);f(K,ra)&&(ia=ca,ra=K,ka=F)});W!==ia&&(v._swapRows(W,ia,O[1],G,H,D),v._swapRows(W,ia,Y[1],R,P,S),X.swap(W,ia),fa(W,ia));X.forEach(0,w-1,function(ca,F){ca<=W?(R.push(F),P.push(ca)):(F=A(F,ka),a(F,0)||(G.push(F),H.push(ca)))})};for(W=0;W<C;W++)l();S.push(R.length);D.push(G.length);
return{L:new v({values:G,index:H,ptr:D,size:O}),U:new v({values:R,index:P,ptr:S,size:Y}),p:da,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}var k=m(h(34)),c=m(h(32)),r=m(h(35)),A=m(h(59)),t=m(h(48)),e=m(h(65)),f=m(h(53)),a=m(h(40)),x=m(h(63)),v=u.SparseMatrix,q=u.DenseMatrix,y=u.Spa;return g("lup",{DenseMatrix:function(l){return d(l)},SparseMatrix:function(l){return b(l)},Array:function(l){l=k(l);l=d(l);return{L:l.L.valueOf(),U:l.U.valueOf(),p:l.p}}})}},
function(L,p,h){var B=h(17);p.name="cross";p.factory=function(u,n,m,g){function d(r,A){var t=Math.max(B.size(r).length,B.size(A).length);r=B.squeeze(r);A=B.squeeze(A);var e=B.size(r),f=B.size(A);if(1!==e.length||1!==f.length||3!==e[0]||3!==f[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+e.join(", ")+"], B = ["+f.join(", ")+"])");r=[k(c(r[1],A[2]),c(r[2],A[1])),k(c(r[2],A[0]),c(r[0],A[2])),k(c(r[0],A[1]),c(r[1],A[0]))];return 1<t?[r]:r}var b=m(h(34)),k=m(h(65)),c=m(h(47));u=
g("cross",{"Matrix, Matrix":function(r,A){return b(d(r.toArray(),A.toArray()))},"Matrix, Array":function(r,A){return b(d(r.toArray(),A))},"Array, Matrix":function(r,A){return b(d(r,A.toArray()))},"Array, Array":d});u.toTex={2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"};return u}},function(L,p,h){var B=h(17).size;p.name="dot";p.factory=function(u,n,m,g){function d(c,r){var A=B(c),t=B(r),e=A[0];if(1!==A.length||1!==t.length)throw new RangeError("Vector expected");if(A[0]!==t[0])throw new RangeError("Vectors must have equal length ("+
A[0]+" != "+t[0]+")");if(0===e)throw new RangeError("Cannot calculate the dot product of empty vectors");for(t=A=0;t<e;t++)A=b(A,k(c[t],r[t]));return A}var b=m(h(33)),k=m(h(47));u=g("dot",{"Matrix, Matrix":function(c,r){return d(c.toArray(),r.toArray())},"Matrix, Array":function(c,r){return d(c.toArray(),r)},"Array, Matrix":function(c,r){return d(c,r.toArray())},"Array, Array":d});u.toTex={2:"\\left(${args[0]}\\cdot${args[1]}\\right)"};return u}},function(L,p,h){var B=h(4).clone,u=h(18).format;p.name=
"transpose";p.factory=function(n,m,g,d){m=h(36);var b=g(h(34)),k=n.DenseMatrix,c=n.SparseMatrix,r=d("transpose",{Array:function(A){return r(b(A)).valueOf()},Matrix:function(A){var t=A.size();switch(t.length){case 1:var e=A.clone();break;case 2:var f=t[0],a=t[1];if(0===a)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+u(t)+")");switch(A.storage()){case "dense":t=A._data;e=[];for(var x,v=0;v<a;v++){x=e[v]=[];for(var q=0;q<f;q++)x[q]=B(t[q][v])}e=new k({data:e,size:[a,f],
datatype:A._datatype});break;case "sparse":t=A._values;e=A._index;x=A._ptr;v=t?[]:void 0;q=[];for(var y=[],l=[],w=0;w<f;w++)l[w]=0;var C;w=0;for(C=e.length;w<C;w++)l[e[w]]++;for(C=w=0;C<f;C++)y.push(w),w+=l[C],l[C]=y[C];y.push(w);for(w=0;w<a;w++){C=x[w+1];for(var z=x[w];z<C;z++){var E=l[e[z]]++;q[E]=w;t&&(v[E]=B(t[z]))}}e=new c({values:v,index:q,ptr:y,size:[a,f],datatype:A._datatype})}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+u(this._size)+")");}return e},
any:function(A){return B(A)}});r.toTex={1:"\\left(${args[0]}\\right)".concat(m.operators.transpose)};return r}},function(L,p,h){var B=Array.isArray;p.name="lusolve";p.factory=function(u,n,m,g){function d(a,x,v,q,y){a=f(a);x=f(x);y=A(a,y,!1);v&&(y._data=r(v,y._data));a=e(a,y);x=t(x,a);q&&(x._data=r(q,x._data));return x}var b=m(h(34)),k=m(h(67)),c=m(h(72)),r=m(h(91)),A=m(h(92)),t=m(h(93)),e=m(h(94)),f=function(a){if(u.isMatrix(a))return a;if(B(a))return b(a);throw new TypeError("Invalid Matrix LU decomposition");
};return g("lusolve",{"Array, Array | Matrix":function(a,x){a=b(a);a=k(a);return d(a.L,a.U,a.p,null,x).valueOf()},"DenseMatrix, Array | Matrix":function(a,x){a=k(a);return d(a.L,a.U,a.p,null,x)},"SparseMatrix, Array | Matrix":function(a,x){a=k(a);return d(a.L,a.U,a.p,null,x)},"SparseMatrix, Array | Matrix, number, number":function(a,x,v,q){a=c(a,v,q);return d(a.L,a.U,a.p,a.q,x)},"Object, Array | Matrix":function(a,x){return d(a.L,a.U,a.p,a.q,x)}})}},function(L,p,h){var B=h(16).number.isInteger;p.name=
"slu";p.factory=function(u,n,m,g){var d=m(h(73)),b=m(h(83));return g("slu",{"SparseMatrix, number, number":function(k,c,r){if(!B(c)||0>c||3<c)throw Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(0>r||1<r)throw Error("Partial pivoting threshold must be a number from 0 to 1");c=d(c,k,!1);k=b(k,c,r);return{L:k.L,U:k.U,p:k.pinv,q:c.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+
this.q.toString():"")+"\n"}}}})}},function(L,p,h){p.name="csSqr";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(74)),g=n(h(78)),d=n(h(79)),b=n(h(80)),k=n(h(81));return function(c,r,A){var t=r._ptr,e=r._size[1],f={};f.q=m(c,r);if(c&&!f.q)return null;if(A){A=c?g(r,null,f.q,0):r;f.parent=d(A,1);c=b(f.parent,e);f.cp=k(A,f.parent,c,1);if(c=A&&f.parent&&f.cp){c=A._ptr;r=A._index;t=A._size;A=t[0];t=t[1];f.pinv=[];f.leftmost=[];var a=f.parent,x=f.pinv,v=f.leftmost,q=[],y=A+t,l=A+2*t,w,C;for(C=
0;C<t;C++)q[A+C]=-1,q[y+C]=-1,q[l+C]=0;for(w=0;w<A;w++)v[w]=-1;for(C=t-1;0<=C;C--){var z=c[C];for(w=c[C+1];z<w;z++)v[r[z]]=C}for(w=A-1;0<=w;w--)x[w]=-1,C=v[w],-1!==C&&(0===q[l+C]++&&(q[y+C]=w),q[0+w]=q[A+C],q[A+C]=w);f.lnz=0;f.m2=A;for(C=0;C<t;C++)w=q[A+C],f.lnz++,0>w&&(w=f.m2++),x[w]=C,0>=--l[C]||(f.lnz+=q[l+C],c=a[C],-1!==c&&(0===q[l+c]&&(q[y+c]=q[y+C]),q[0+q[y+C]]=q[A+c],q[A+c]=q[0+w],q[l+c]+=q[l+C]));for(w=0;w<A;w++)0>x[w]&&(x[w]=C++);c=!0}if(c)for(c=f.unz=0;c<e;c++)f.unz+=f.cp[c]}else f.unz=
4*t[e]+e,f.lnz=f.unz;return f}}},function(L,p,h){p.name="csAmd";p.path="algebra.sparse";p.factory=function(B,u,n){function m(t,e,f,a,x){if(2>t||0>t+e){for(t=0;t<x;t++)0!==f[a+t]&&(f[a+t]=1);t=2}return t}function g(t,e){return t!==e}var d=n(h(75)),b=n(h(76)),k=n(h(77)),c=n(h(33)),r=n(h(47)),A=n(h(70));return function(t,e){if(!e||0>=t||3<t)return null;var f=e._size,a=f[0];f=f[1];var x=0,v=Math.max(16,10*Math.sqrt(f));v=Math.min(f-2,v);var q=e;e=v;var y=A(q);if(1===t&&f===a)e=c(q,y);else{if(2===t){t=
y._index;q=y._ptr;for(var l=0,w=0;w<a;w++){var C=q[w];q[w]=l;if(!(q[w+1]-C>e))for(var z=q[w+1];C<z;C++)t[l++]=t[C]}q[a]=l;q=A(y)}e=r(y,q)}b(e,g,null);a=e._index;e=e._ptr;y=e[f];t=[];q=[];l=f+1;w=2*(f+1);C=3*(f+1);z=4*(f+1);var E=5*(f+1),J=6*(f+1),I=7*(f+1),G;for(G=0;G<f;G++)q[0+G]=e[G+1]-e[G];for(G=q[0+f]=0;G<=f;G++)q[C+G]=-1,t[G]=-1,q[w+G]=-1,q[I+G]=-1,q[l+G]=1,q[J+G]=1,q[z+G]=0,q[E+G]=q[0+G];G=m(0,0,q,J,f);q[z+f]=-2;e[f]=-1;for(var H=q[J+f]=0,D=0;D<f;D++){var O=q[E+D];if(0===O)q[z+D]=-2,H++,e[D]=
-1,q[J+D]=0;else if(O>v)q[l+D]=0,q[z+D]=-1,H++,e[D]=d(f),q[l+f]++;else{var R=q[C+O];-1!==R&&(t[R]=D);q[w+D]=q[C+O];q[C+O]=D}}v=H;H=0;for(var P,S,Y,U,W,V,da;v<f;){for(O=-1;H<f&&-1===(O=q[C+H]);H++);-1!==q[w+O]&&(t[q[w+O]]=-1);q[C+H]=q[w+O];R=q[z+O];var ba=q[l+O];v+=ba;var fa=0;q[l+O]=-ba;var X=e[O],ja=0===R?X:y,ia=ja;for(S=1;S<=R+1;S++){S>R?(P=O,U=X,W=q[0+O]-R):(P=a[X++],U=e[P],W=q[0+P]);for(Y=1;Y<=W;Y++)D=a[U++],0>=(V=q[l+D])||(fa+=V,q[l+D]=-V,a[ia++]=D,-1!==q[w+D]&&(t[q[w+D]]=t[D]),-1!==t[D]?q[w+
t[D]]=q[w+D]:q[C+q[E+D]]=q[w+D]);P!==O&&(e[P]=d(O),q[J+P]=0)}0!==R&&(y=ia);q[E+O]=fa;e[O]=ja;q[0+O]=ia-ja;q[z+O]=-2;G=m(G,x,q,J,f);for(S=ja;S<ia;S++)if(D=a[S],!(0>=(Y=q[z+D])))for(V=-q[l+D],U=G-V,X=e[D],W=e[D]+Y-1;X<=W;X++)P=a[X],q[J+P]>=G?q[J+P]-=V:0!==q[J+P]&&(q[J+P]=q[E+P]+U);for(S=ja;S<ia;S++){D=a[S];W=e[D];da=W+q[z+D]-1;V=W;Y=U=0;for(X=W;X<=da;X++)if(P=a[X],0!==q[J+P]){var ka=q[J+P]-G;0<ka?(Y+=ka,a[V++]=P,U+=P):(e[P]=d(O),q[J+P]=0)}q[z+D]=V-W+1;ka=V;var ra=W+q[0+D];for(X=da+1;X<ra;X++)P=a[X],
da=q[l+P],0>=da||(Y+=da,a[V++]=P,U+=P);0===Y?(e[D]=d(O),V=-q[l+D],fa-=V,ba+=V,v+=V,q[l+D]=0,q[z+D]=-1):(q[E+D]=Math.min(q[E+D],Y),a[V]=a[ka],a[ka]=a[W],a[W]=O,q[0+D]=V-W+1,U=(0>U?-U:U)%f,q[w+D]=q[I+U],q[I+U]=D,t[D]=U)}q[E+O]=fa;x=Math.max(x,fa);G=m(G+x,x,q,J,f);for(S=ja;S<ia;S++)if(D=a[S],!(0<=q[l+D]))for(U=t[D],D=q[I+U],q[I+U]=-1;-1!==D&&-1!==q[w+D];D=q[w+D],G++){W=q[0+D];Y=q[z+D];for(X=e[D]+1;X<=e[D]+W-1;X++)q[J+a[X]]=G;V=D;for(P=q[w+D];-1!==P;){U=q[0+P]===W&&q[z+P]===Y;for(X=e[P]+1;U&&X<=e[P]+
W-1;X++)q[J+a[X]]!==G&&(U=0);U?(e[P]=d(D),q[l+D]+=q[l+P],q[l+P]=0,q[z+P]=-1,P=q[w+P],q[w+V]=P):(V=P,P=q[w+P])}}for(S=X=ja;S<ia;S++)D=a[S],0>=(V=-q[l+D])||(q[l+D]=V,Y=q[E+D]+fa-V,Y=Math.min(Y,f-v-V),-1!==q[C+Y]&&(t[q[C+Y]]=D),q[w+D]=q[C+Y],t[D]=-1,q[C+Y]=D,H=Math.min(H,Y),q[E+D]=Y,a[X++]=D);q[l+O]=ba;0===(q[0+O]=X-ja)&&(e[O]=-1,q[J+O]=0);0!==R&&(y=X)}for(D=0;D<f;D++)e[D]=d(e[D]);for(P=0;P<=f;P++)q[C+P]=-1;for(P=f;0<=P;P--)0<q[l+P]||(q[w+P]=q[C+e[P]],q[C+e[P]]=P);for(P=f;0<=P;P--)0>=q[l+P]||-1===e[P]||
(q[w+P]=q[C+e[P]],q[C+e[P]]=P);for(D=O=0;D<=f;D++)-1===e[D]&&(O=k(D,O,q,C,w,t,J));t.splice(t.length-1,1);return t}}},function(L,p){p.name="csFlip";p.path="algebra.sparse";p.factory=function(){return function(h){return-h-2}}},function(L,p){p.name="csFkeep";p.path="algebra.sparse";p.factory=function(){return function(h,B,u){var n=h._values,m=h._index,g=h._ptr;h=h._size[1];for(var d=0,b=0;b<h;b++){var k=g[b];for(g[b]=d;k<g[b+1];k++)B(m[k],b,n?n[k]:1,u)&&(m[d]=m[k],n&&(n[d]=n[k]),d++)}g[h]=d;m.splice(d,
m.length-d);n&&n.splice(d,n.length-d);return d}}},function(L,p){p.name="csTdfs";p.path="algebra.sparse";p.factory=function(){return function(h,B,u,n,m,g,d){var b=0;for(u[d]=h;0<=b;){h=u[d+b];var k=u[n+h];-1===k?(b--,g[B++]=h):(u[n+h]=u[m+k],++b,u[d+b]=k)}return B}}},function(L,p){p.name="csPermute";p.path="algebra.sparse";p.factory=function(h){var B=h.SparseMatrix;return function(u,n,m,g){var d=u._values,b=u._index,k=u._ptr,c=u._size,r=u._datatype,A=c[0];c=c[1];u=g&&u._values?[]:null;g=[];for(var t=
[],e=0,f=0;f<c;f++){t[f]=e;var a=m?m[f]:f,x=k[a+1];for(a=k[a];a<x;a++)g[e]=n?n[b[a]]:b[a],u&&(u[e]=d[a]),e++}t[c]=e;return new B({values:u,index:g,ptr:t,size:[A,c],datatype:r})}}},function(L,p){p.name="csEtree";p.path="algebra.sparse";p.factory=function(){return function(h,B){if(!h)return null;var u=h._index,n=h._ptr;h=h._size;var m=h[0];h=h[1];var g=[],d=[],b;if(B)for(b=0;b<m;b++)d[h+b]=-1;for(var k=0;k<h;k++){g[k]=-1;d[0+k]=-1;for(var c=n[k+1],r=n[k];r<c;r++){var A=u[r];for(b=B?d[h+A]:A;-1!==b&&
b<k;b=m)m=d[0+b],d[0+b]=k,-1===m&&(g[b]=k);B&&(d[h+A]=k)}}return g}}},function(L,p,h){p.name="csPost";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(77));return function(g,d){if(!g)return null;var b=0,k,c=[],r=[],A=2*d;for(k=0;k<d;k++)r[0+k]=-1;for(k=d-1;0<=k;k--)-1!==g[k]&&(r[d+k]=r[0+g[k]],r[0+g[k]]=k);for(k=0;k<d;k++)-1===g[k]&&(b=m(k,b,r,0,d,c,A));return c}}},function(L,p,h){p.name="csCounts";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(70)),g=n(h(82));return function(d,
b,k,c){if(!d||!b||!k)return null;var r=d._size,A=r[0];r=r[1];var t,e,f=4*r+(c?r+A+1:0),a=[],x=2*r,v=3*r,q=4*r,y=5*r+1;for(e=0;e<f;e++)a[e]=-1;f=[];e=m(d);d=e._index;var l=e._ptr;for(e=0;e<r;e++){var w=k[e];for(f[w]=-1===a[v+w]?1:0;-1!==w&&-1===a[v+w];w=b[w])a[v+w]=e}if(c){for(e=0;e<r;e++)a[k[e]]=e;for(t=0;t<A;t++){e=r;var C=l[t];for(w=l[t+1];C<w;C++)e=Math.min(e,a[d[C]]);a[y+t]=a[q+e];a[q+e]=t}}for(t=0;t<r;t++)a[0+t]=t;for(e=0;e<r;e++){w=k[e];-1!==b[w]&&f[b[w]]--;for(A=c?a[q+e]:w;-1!==A;A=c?a[y+A]:
-1)for(C=l[A];C<l[A+1];C++)t=d[C],t=g(t,w,a,v,r,x,0),1<=t.jleaf&&f[w]++,2===t.jleaf&&f[t.q]--;-1!==b[w]&&(a[0+w]=b[w])}for(w=0;w<r;w++)-1!==b[w]&&(f[b[w]]+=f[w]);return f}}},function(L,p){p.name="csLeaf";p.path="algebra.sparse";p.factory=function(){return function(h,B,u,n,m,g,d){if(h<=B||u[n+B]<=u[m+h])return-1;u[m+h]=u[n+B];n=u[g+h];u[g+h]=B;if(-1===n)B=1;else{B=2;for(h=n;h!==u[d+h];h=u[d+h]);for(g=n;g!==h;g=n)n=u[d+g],u[d+g]=h}return{jleaf:B,q:h}}}},function(L,p,h){p.name="csLu";p.path="algebra.sparse";
p.factory=function(B,u,n){var m=n(h(32)),g=n(h(59)),d=n(h(47)),b=n(h(53)),k=n(h(84)),c=n(h(85)),r=B.SparseMatrix;return function(A,t,e){if(!A)return null;var f=A._size[1],a;if(t)var x=t.q;var v=[],q=[],y=[],l=new r({values:v,index:q,ptr:y,size:[f,f]}),w=[],C=[],z=[],E=new r({values:w,index:C,ptr:z,size:[f,f]}),J=[],I,G,H=[],D=[];for(I=0;I<f;I++)H[I]=0,J[I]=-1,y[I+1]=0;for(var O=a=t=0;O<f;O++){y[O]=t;z[O]=a;var R=x?x[O]:O,P=c(l,A,R,D,H,J,1),S=-1,Y=-1;for(G=P;G<f;G++)if(I=D[G],0>J[I]){var U=m(H[I]);
b(U,Y)&&(Y=U,S=I)}else C[a]=J[I],w[a++]=H[I];if(-1===S||0>=Y)return null;0>J[R]&&k(m(H[R]),d(Y,e))&&(S=R);R=H[S];C[a]=O;w[a++]=R;J[S]=O;q[t]=S;v[t++]=1;for(G=P;G<f;G++)I=D[G],0>J[I]&&(q[t]=I,v[t++]=g(H[I],R)),H[I]=0}y[f]=t;z[f]=a;for(G=0;G<t;G++)q[G]=J[q[G]];v.splice(t,v.length-t);q.splice(t,q.length-t);w.splice(a,w.length-a);C.splice(a,C.length-a);return{L:l,U:E,pinv:J}}}},function(L,p,h){var B=h(8).nearlyEqual,u=h(41);p.name="largerEq";p.factory=function(n,m,g,d){var b=g(h(34)),k=g(h(54)),c=g(h(55)),
r=g(h(56)),A=g(h(43)),t=g(h(44));n=h(36);var e=d("largerEq",{"boolean, boolean":function(f,a){return f>=a},"number, number":function(f,a){return f>=a||B(f,a,m.epsilon)},"BigNumber, BigNumber":function(f,a){return f.gte(a)||u(f,a,m.epsilon)},"Fraction, Fraction":function(f,a){return-1!==f.compare(a)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(f,a){if(!f.equalBase(a))throw Error("Cannot compare units with different base");
return e(f.value,a.value)},"SparseMatrix, SparseMatrix":function(f,a){return c(f,a,e)},"SparseMatrix, DenseMatrix":function(f,a){return k(a,f,e,!0)},"DenseMatrix, SparseMatrix":function(f,a){return k(f,a,e,!1)},"DenseMatrix, DenseMatrix":function(f,a){return A(f,a,e)},"Array, Array":function(f,a){return e(b(f),b(a)).valueOf()},"Array, Matrix":function(f,a){return e(b(f),a)},"Matrix, Array":function(f,a){return e(f,b(a))},"SparseMatrix, any":function(f,a){return r(f,a,e,!1)},"DenseMatrix, any":function(f,
a){return t(f,a,e,!1)},"any, SparseMatrix":function(f,a){return r(a,f,e,!0)},"any, DenseMatrix":function(f,a){return t(a,f,e,!0)},"Array, any":function(f,a){return t(b(f),a,e,!1).valueOf()},"any, Array":function(f,a){return t(b(a),f,e,!0).valueOf()}});e.toTex={2:"\\left(${args[0]}".concat(n.operators.largerEq,"${args[1]}\\right)")};return e}},function(L,p,h){p.name="csSpsolve";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(59)),g=n(h(47)),d=n(h(65)),b=n(h(86));return function(k,c,r,A,
t,e,f){var a=k._values,x=k._index,v=k._ptr,q=k._size[1],y=c._values,l=c._index,w=c._ptr;for(c=k=b(k,c,r,A,e);c<q;c++)t[A[c]]=0;c=w[r];for(r=w[r+1];c<r;c++)t[l[c]]=y[c];for(y=k;y<q;y++)if(l=A[y],r=e?e[l]:l,!(0>r))for(c=v[r],r=v[r+1],t[l]=m(t[l],a[f?c:r-1]),c=f?c+1:c,r=f?r:r-1;c<r;c++)w=x[c],t[w]=d(t[w],g(a[c],t[l]));return k}}},function(L,p,h){p.name="csReach";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(87)),g=n(h(88)),d=n(h(89));return function(b,k,c,r,A){var t=b._ptr,e=k._index,f=
k._ptr;k=b._size[1];var a=k;var x=f[c];for(c=f[c+1];x<c;x++)f=e[x],g(t,f)||(a=m(f,b,a,r,A));for(x=a;x<k;x++)d(t,r[x]);return a}}},function(L,p,h){p.name="csDfs";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(88)),g=n(h(89)),d=n(h(90));return function(b,k,c,r,A){var t=k._index,e=k._ptr;k=k._size[1];var f,a=0;for(r[0]=b;0<=a;){b=r[a];var x=A?A[b]:b;m(e,b)||(g(e,b),r[k+a]=0>x?0:d(e[x]));var v=1;var q=r[k+a];for(f=0>x?0:d(e[x+1]);q<f;q++)if(x=t[q],!m(e,x)){r[k+a]=q;r[++a]=x;v=0;break}v&&
(a--,r[--c]=b)}return c}}},function(L,p){p.name="csMarked";p.path="algebra.sparse";p.factory=function(){return function(h,B){return 0>h[B]}}},function(L,p,h){p.name="csMark";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(75));return function(g,d){g[d]=m(g[d])}}},function(L,p,h){p.name="csUnflip";p.path="algebra.sparse";p.factory=function(B,u,n){var m=n(h(75));return function(g){return 0>g?m(g):g}}},function(L,p){p.name="csIpvec";p.path="algebra.sparse";p.factory=function(){return function(h,
B){var u,n=B.length,m=[];if(h)for(u=0;u<n;u++)m[h[u]]=B[u];else for(u=0;u<n;u++)m[u]=B[u];return m}}},function(L,p,h){L=h(16);var B=L.string,u=L.array,n=Array.isArray;p.factory=function(m){var g=m.DenseMatrix;return function(d,b,k){var c=d.size();if(2!==c.length)throw new RangeError("Matrix must be two dimensional (size: "+B.format(c)+")");d=c[0];if(d!==c[1])throw new RangeError("Matrix must be square (size: "+B.format(c)+")");if(m.isMatrix(b)){c=b.size();if(1===c.length){if(c[0]!==d)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");
k=[];var r=b._data;for(c=0;c<d;c++)k[c]=[r[c]];return new g({data:k,size:[d,1],datatype:b._datatype})}if(2===c.length){if(c[0]!==d||1!==c[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(m.isDenseMatrix(b)){if(k){k=[];r=b._data;for(c=0;c<d;c++)k[c]=[r[c][0]];return new g({data:k,size:[d,1],datatype:b._datatype})}return b}k=[];for(c=0;c<d;c++)k[c]=[0];r=b._values;var A=b._index;c=b._ptr;for(var t=c[1],e=c[0];e<t;e++)c=A[e],k[c][0]=r[e];return new g({data:k,
size:[d,1],datatype:b._datatype})}throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");}if(n(b)){k=u.size(b);if(1===k.length){if(k[0]!==d)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");k=[];for(c=0;c<d;c++)k[c]=[b[c]];return new g({data:k,size:[d,1]})}if(2===k.length){if(k[0]!==d||1!==k[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");k=[];for(c=0;c<d;c++)k[c]=[b[c][0]];return new g({data:k,
size:[d,1]})}throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");}}}},function(L,p,h){p.name="usolve";p.factory=function(B,u,n,m){function g(e,f){f=A(e,f,!0);f=f._data;var a=e._size[0],x=[],v=e._data;for(e=e._size[1]-1;0<=e;e--){var q=f[e][0]||0;if(r(q,0))q=0;else{var y=v[e][e];if(r(y,0))throw Error("Linear system cannot be solved since matrix is singular");q=b(q,y);for(y=e-1;0<=y;y--)f[y]=[c(f[y][0]||0,k(q,v[y][e]))]}x[e]=[q]}return new t({data:x,size:[a,1]})}var d=
n(h(34)),b=n(h(59)),k=n(h(48)),c=n(h(65)),r=n(h(40)),A=n(h(92)),t=B.DenseMatrix;return m("usolve",{"SparseMatrix, Array | Matrix":function(e,f){f=A(e,f,!0);f=f._data;for(var a=e._size[0],x=e._values,v=e._index,q=e._ptr,y,l=[],w=e._size[1]-1;0<=w;w--){var C=f[w][0]||0;if(r(C,0))l[w]=[0];else{var z=0,E=[],J=[],I=q[w],G=q[w+1];for(y=G-1;y>=I;y--)e=v[y],e===w?z=x[y]:e<w&&(E.push(x[y]),J.push(e));if(r(z,0))throw Error("Linear system cannot be solved since matrix is singular");C=b(C,z);y=0;for(G=J.length;y<
G;y++)e=J[y],f[e]=[c(f[e][0],k(C,E[y]))];l[w]=[C]}}return new t({data:l,size:[a,1]})},"DenseMatrix, Array | Matrix":function(e,f){return g(e,f)},"Array, Array | Matrix":function(e,f){e=d(e);return g(e,f).valueOf()}})}},function(L,p,h){p.name="lsolve";p.factory=function(B,u,n,m){function g(e,f){f=A(e,f,!0);f=f._data;var a=e._size[0],x=e._size[1],v=[];e=e._data;for(var q=0;q<x;q++){var y=f[q][0]||0;if(r(y,0))y=0;else{var l=e[q][q];if(r(l,0))throw Error("Linear system cannot be solved since matrix is singular");
y=b(y,l);for(l=q+1;l<a;l++)f[l]=[c(f[l][0]||0,k(y,e[l][q]))]}v[q]=[y]}return new t({data:v,size:[a,1]})}var d=n(h(34)),b=n(h(59)),k=n(h(48)),c=n(h(65)),r=n(h(40)),A=n(h(92)),t=B.DenseMatrix;return m("lsolve",{"SparseMatrix, Array | Matrix":function(e,f){f=A(e,f,!0);f=f._data;var a=e._size[0],x=e._size[1],v=e._values,q=e._index;e=e._ptr;for(var y,l,w=[],C=0;C<x;C++){var z=f[C][0]||0;if(r(z,0))w[C]=[0];else{var E=0,J=[],I=[],G=e[C+1];for(l=e[C];l<G;l++)y=q[l],y===C?E=v[l]:y>C&&(J.push(v[l]),I.push(y));
if(r(E,0))throw Error("Linear system cannot be solved since matrix is singular");z=b(z,E);l=0;for(G=I.length;l<G;l++)y=I[l],f[y]=[c(f[y][0]||0,k(z,J[l]))];w[C]=[z]}}return new t({data:w,size:[a,1]})},"DenseMatrix, Array | Matrix":function(e,f){return g(e,f)},"Array, Array | Matrix":function(e,f){e=d(e);return g(e,f).valueOf()}})}}])});