UNPKG

@antv/f6-wx

Version:

微信小程序f6组件

1 lines 102 kB
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.f6=r():t.f6=r()}(this,(function(){return function(t){var r={};function e(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=r,e.d=function(t,r,o){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var n in t)e.d(o,n,function(r){return t[r]}.bind(null,n));return o},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=408)}({10:function(t,r,e){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,e,o){void 0===o&&(o=e),Object.defineProperty(t,o,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,o){void 0===o&&(o=e),t[o]=r[e]}),n=this&&this.__exportStar||function(t,r){for(var e in t)"default"===e||Object.prototype.hasOwnProperty.call(r,e)||o(r,t,e)};Object.defineProperty(r,"__esModule",{value:!0}),n(e(11),r),n(e(12),r),n(e(13),r),n(e(14),r),n(e(15),r),n(e(16),r)},102:function(t,r,e){"use strict";e.r(r),e.d(r,"AbstractMatrix",(function(){return Q})),e.d(r,"default",(function(){return K})),e.d(r,"Matrix",(function(){return K})),e.d(r,"MatrixColumnView",(function(){return at})),e.d(r,"MatrixColumnSelectionView",(function(){return yt})),e.d(r,"MatrixFlipColumnView",(function(){return xt})),e.d(r,"MatrixFlipRowView",(function(){return _t})),e.d(r,"MatrixRowView",(function(){return Vt})),e.d(r,"MatrixRowSelectionView",(function(){return Ut})),e.d(r,"MatrixSelectionView",(function(){return Xt})),e.d(r,"MatrixSubView",(function(){return or})),e.d(r,"MatrixTransposeView",(function(){return cr})),e.d(r,"wrap",(function(){return Or})),e.d(r,"WrapperMatrix1D",(function(){return wr})),e.d(r,"WrapperMatrix2D",(function(){return Er})),e.d(r,"solve",(function(){return Vr})),e.d(r,"inverse",(function(){return Ir})),e.d(r,"determinant",(function(){return qr})),e.d(r,"linearDependencies",(function(){return Br})),e.d(r,"pseudoInverse",(function(){return Lr})),e.d(r,"covariance",(function(){return Ur})),e.d(r,"correlation",(function(){return Qr})),e.d(r,"SingularValueDecomposition",(function(){return Nr})),e.d(r,"SVD",(function(){return Nr})),e.d(r,"EigenvalueDecomposition",(function(){return Hr})),e.d(r,"EVD",(function(){return Hr})),e.d(r,"CholeskyDecomposition",(function(){return re})),e.d(r,"CHO",(function(){return re})),e.d(r,"LuDecomposition",(function(){return jr})),e.d(r,"LU",(function(){return jr})),e.d(r,"QrDecomposition",(function(){return Tr})),e.d(r,"QR",(function(){return Tr})),e.d(r,"Nipals",(function(){return oe})),e.d(r,"NIPALS",(function(){return oe}));var o=Object.prototype.toString;function n(t){return o.call(t).endsWith("Array]")}var i=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var e=r.fromIndex,o=void 0===e?0:e,i=r.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var u=t[o],a=o+1;a<s;a++)t[a]>u&&(u=t[a]);return u};var s=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var e=r.fromIndex,o=void 0===e?0:e,i=r.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var u=t[o],a=o+1;a<s;a++)t[a]<u&&(u=t[a]);return u};var u=function(t){var r,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==e.output){if(!n(e.output))throw new TypeError("output option must be an array if specified");r=e.output}else r=new Array(t.length);var o=s(t),u=i(t);if(o===u)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=e.min,f=void 0===a?e.autoMinMax?o:0:a,c=e.max,h=void 0===c?e.autoMinMax?u:1:c;if(f>=h)throw new RangeError("min option must be smaller than max option");for(var l=(h-f)/(u-o),p=0;p<t.length;p++)r[p]=(t[p]-o)*l+f;return r},a=" ".repeat(2),f=" ".repeat(4);function c(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=r.maxRows,o=void 0===e?15:e,n=r.maxColumns,i=void 0===n?10:n,s=r.maxNumSize,u=void 0===s?8:s;return"".concat(t.constructor.name," {\n").concat(a,"[\n").concat(f).concat(h(t,o,i,u),"\n").concat(a,"]\n").concat(a,"rows: ").concat(t.rows,"\n").concat(a,"columns: ").concat(t.columns,"\n}")}function h(t,r,e,o){for(var n=t.rows,i=t.columns,s=Math.min(n,r),u=Math.min(i,e),a=[],c=0;c<s;c++){for(var h=[],p=0;p<u;p++)h.push(l(t.get(c,p),o));a.push("".concat(h.join(" ")))}return u!==i&&(a[a.length-1]+=" ... ".concat(i-e," more columns")),s!==n&&a.push("... ".concat(n-r," more rows")),a.join("\n".concat(f))}function l(t,r){var e=String(t);if(e.length<=r)return e.padEnd(r," ");var o=t.toPrecision(r-2);if(o.length<=r)return o;var n=t.toExponential(r-2),i=n.indexOf("e"),s=n.slice(i);return n.slice(0,r-s.length)+s}function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,r,e){var o=e?t.rows:t.rows-1;if(r<0||r>o)throw new RangeError("Row index out of range")}function y(t,r,e){var o=e?t.columns:t.columns-1;if(r<0||r>o)throw new RangeError("Column index out of range")}function m(t,r){if(r.to1DArray&&(r=r.to1DArray()),r.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return r}function g(t,r){if(r.to1DArray&&(r=r.to1DArray()),r.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return r}function w(t,r,e){return{row:b(t,r),column:d(t,e)}}function b(t,r){if("object"!==p(r))throw new TypeError("unexpected type for row indices");if(r.some((function(r){return r<0||r>=t.rows})))throw new RangeError("row indices are out of range");return Array.isArray(r)||(r=Array.from(r)),r}function d(t,r){if("object"!==p(r))throw new TypeError("unexpected type for column indices");if(r.some((function(r){return r<0||r>=t.columns})))throw new RangeError("column indices are out of range");return Array.isArray(r)||(r=Array.from(r)),r}function M(t,r,e,o,n){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(k("startRow",r),k("endRow",e),k("startColumn",o),k("endColumn",n),r>e||o>n||r<0||r>=t.rows||e<0||e>=t.rows||o<0||o>=t.columns||n<0||n>=t.columns)throw new RangeError("Submatrix indices are out of range")}function x(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=[],o=0;o<t;o++)e.push(r);return e}function k(t,r){if("number"!=typeof r)throw new TypeError("".concat(t," must be a number"))}function S(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}function E(t,r,e){for(var o=t.rows,n=t.columns,i=[],s=0;s<o;s++){for(var u=0,a=0,f=0,c=0;c<n;c++)u+=f=t.get(s,c)-e[s],a+=f*f;r?i.push((a-u*u/n)/(n-1)):i.push((a-u*u/n)/n)}return i}function O(t,r,e){for(var o=t.rows,n=t.columns,i=[],s=0;s<n;s++){for(var u=0,a=0,f=0,c=0;c<o;c++)u+=f=t.get(c,s)-e[s],a+=f*f;r?i.push((a-u*u/o)/(o-1)):i.push((a-u*u/o)/o)}return i}function R(t,r,e){for(var o=t.rows,n=t.columns,i=o*n,s=0,u=0,a=0,f=0;f<o;f++)for(var c=0;c<n;c++)s+=a=t.get(f,c)-e,u+=a*a;return r?(u-s*s/i)/(i-1):(u-s*s/i)/i}function j(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)-r[e])}function _(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)-r[o])}function P(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)-r)}function T(t){for(var r=[],e=0;e<t.rows;e++){for(var o=0,n=0;n<t.columns;n++)o+=Math.pow(t.get(e,n),2)/(t.columns-1);r.push(Math.sqrt(o))}return r}function A(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)/r[e])}function C(t){for(var r=[],e=0;e<t.columns;e++){for(var o=0,n=0;n<t.rows;n++)o+=Math.pow(t.get(n,e),2)/(t.rows-1);r.push(Math.sqrt(o))}return r}function N(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)/r[o])}function I(t){for(var r=t.size-1,e=0,o=0;o<t.columns;o++)for(var n=0;n<t.rows;n++)e+=Math.pow(t.get(n,o),2)/r;return Math.sqrt(e)}function V(t,r){for(var e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)t.set(e,o,t.get(e,o)/r)}function q(t,r){return(q=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function D(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,o=B(t);if(r){var n=B(this).constructor;e=Reflect.construct(o,arguments,n)}else e=o.apply(this,arguments);return F(this,e)}}function F(t,r){return!r||"object"!==L(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):r}function B(t){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function z(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function U(t,r){for(var e=0;e<r.length;e++){var o=r[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function W(t,r,e){return r&&U(t.prototype,r),e&&U(t,e),t}var Q=function(){function t(){z(this,t)}return W(t,[{key:"size",get:function(){return this.rows*this.columns}},{key:"apply",value:function(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.call(this,r,e);return this}},{key:"to1DArray",value:function(){for(var t=[],r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.push(this.get(r,e));return t}},{key:"to2DArray",value:function(){for(var t=[],r=0;r<this.rows;r++){t.push([]);for(var e=0;e<this.columns;e++)t[r].push(this.get(r,e))}return t}},{key:"toJSON",value:function(){return this.to2DArray()}},{key:"isRowVector",value:function(){return 1===this.rows}},{key:"isColumnVector",value:function(){return 1===this.columns}},{key:"isVector",value:function(){return 1===this.rows||1===this.columns}},{key:"isSquare",value:function(){return this.rows===this.columns}},{key:"isEmpty",value:function(){return 0===this.rows||0===this.columns}},{key:"isSymmetric",value:function(){if(this.isSquare()){for(var t=0;t<this.rows;t++)for(var r=0;r<=t;r++)if(this.get(t,r)!==this.get(r,t))return!1;return!0}return!1}},{key:"isEchelonForm",value:function(){for(var t=0,r=0,e=-1,o=!0,n=!1;t<this.rows&&o;){for(r=0,n=!1;r<this.columns&&!1===n;)0===this.get(t,r)?r++:1===this.get(t,r)&&r>e?(n=!0,e=r):(o=!1,n=!0);t++}return o}},{key:"isReducedEchelonForm",value:function(){for(var t=0,r=0,e=-1,o=!0,n=!1;t<this.rows&&o;){for(r=0,n=!1;r<this.columns&&!1===n;)0===this.get(t,r)?r++:1===this.get(t,r)&&r>e?(n=!0,e=r):(o=!1,n=!0);for(var i=r+1;i<this.rows;i++)0!==this.get(t,i)&&(o=!1);t++}return o}},{key:"echelonForm",value:function(){for(var t=this.clone(),r=0,e=0;r<t.rows&&e<t.columns;){for(var o=r,n=r;n<t.rows;n++)t.get(n,e)>t.get(o,e)&&(o=n);if(0===t.get(o,e))e++;else{t.swapRows(r,o);for(var i=t.get(r,e),s=e;s<t.columns;s++)t.set(r,s,t.get(r,s)/i);for(var u=r+1;u<t.rows;u++){var a=t.get(u,e)/t.get(r,e);t.set(u,e,0);for(var f=e+1;f<t.columns;f++)t.set(u,f,t.get(u,f)-t.get(r,f)*a)}r++,e++}}return t}},{key:"reducedEchelonForm",value:function(){for(var t=this.echelonForm(),r=t.columns,e=t.rows,o=e-1;o>=0;)if(0===t.maxRow(o))o--;else{for(var n=0,i=!1;n<e&&!1===i;)1===t.get(o,n)?i=!0:n++;for(var s=0;s<o;s++)for(var u=t.get(s,n),a=n;a<r;a++){var f=t.get(s,a)-u*t.get(o,a);t.set(s,a,f)}o--}return t}},{key:"set",value:function(){throw new Error("set method is unimplemented")}},{key:"get",value:function(){throw new Error("get method is unimplemented")}},{key:"repeat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==L(t))throw new TypeError("options must be an object");var r=t.rows,e=void 0===r?1:r,o=t.columns,n=void 0===o?1:o;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");for(var i=new K(this.rows*e,this.columns*n),s=0;s<e;s++)for(var u=0;u<n;u++)i.setSubMatrix(this,this.rows*s,this.columns*u);return i}},{key:"fill",value:function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,t);return this}},{key:"neg",value:function(){return this.mulS(-1)}},{key:"getRow",value:function(t){v(this,t);for(var r=[],e=0;e<this.columns;e++)r.push(this.get(t,e));return r}},{key:"getRowVector",value:function(t){return K.rowVector(this.getRow(t))}},{key:"setRow",value:function(t,r){v(this,t),r=m(this,r);for(var e=0;e<this.columns;e++)this.set(t,e,r[e]);return this}},{key:"swapRows",value:function(t,r){v(this,t),v(this,r);for(var e=0;e<this.columns;e++){var o=this.get(t,e);this.set(t,e,this.get(r,e)),this.set(r,e,o)}return this}},{key:"getColumn",value:function(t){y(this,t);for(var r=[],e=0;e<this.rows;e++)r.push(this.get(e,t));return r}},{key:"getColumnVector",value:function(t){return K.columnVector(this.getColumn(t))}},{key:"setColumn",value:function(t,r){y(this,t),r=g(this,r);for(var e=0;e<this.rows;e++)this.set(e,t,r[e]);return this}},{key:"swapColumns",value:function(t,r){y(this,t),y(this,r);for(var e=0;e<this.rows;e++){var o=this.get(e,t);this.set(e,t,this.get(e,r)),this.set(e,r,o)}return this}},{key:"addRowVector",value:function(t){t=m(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t[e]);return this}},{key:"subRowVector",value:function(t){t=m(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t[e]);return this}},{key:"mulRowVector",value:function(t){t=m(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t[e]);return this}},{key:"divRowVector",value:function(t){t=m(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t[e]);return this}},{key:"addColumnVector",value:function(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t[r]);return this}},{key:"subColumnVector",value:function(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t[r]);return this}},{key:"mulColumnVector",value:function(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t[r]);return this}},{key:"divColumnVector",value:function(t){t=g(this,t);for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t[r]);return this}},{key:"mulRow",value:function(t,r){v(this,t);for(var e=0;e<this.columns;e++)this.set(t,e,this.get(t,e)*r);return this}},{key:"mulColumn",value:function(t,r){y(this,t);for(var e=0;e<this.rows;e++)this.set(e,t,this.get(e,t)*r);return this}},{key:"max",value:function(){if(this.isEmpty())return NaN;for(var t=this.get(0,0),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.get(r,e)>t&&(t=this.get(r,e));return t}},{key:"maxIndex",value:function(){S(this);for(var t=this.get(0,0),r=[0,0],e=0;e<this.rows;e++)for(var o=0;o<this.columns;o++)this.get(e,o)>t&&(t=this.get(e,o),r[0]=e,r[1]=o);return r}},{key:"min",value:function(){if(this.isEmpty())return NaN;for(var t=this.get(0,0),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.get(r,e)<t&&(t=this.get(r,e));return t}},{key:"minIndex",value:function(){S(this);for(var t=this.get(0,0),r=[0,0],e=0;e<this.rows;e++)for(var o=0;o<this.columns;o++)this.get(e,o)<t&&(t=this.get(e,o),r[0]=e,r[1]=o);return r}},{key:"maxRow",value:function(t){if(v(this,t),this.isEmpty())return NaN;for(var r=this.get(t,0),e=1;e<this.columns;e++)this.get(t,e)>r&&(r=this.get(t,e));return r}},{key:"maxRowIndex",value:function(t){v(this,t),S(this);for(var r=this.get(t,0),e=[t,0],o=1;o<this.columns;o++)this.get(t,o)>r&&(r=this.get(t,o),e[1]=o);return e}},{key:"minRow",value:function(t){if(v(this,t),this.isEmpty())return NaN;for(var r=this.get(t,0),e=1;e<this.columns;e++)this.get(t,e)<r&&(r=this.get(t,e));return r}},{key:"minRowIndex",value:function(t){v(this,t),S(this);for(var r=this.get(t,0),e=[t,0],o=1;o<this.columns;o++)this.get(t,o)<r&&(r=this.get(t,o),e[1]=o);return e}},{key:"maxColumn",value:function(t){if(y(this,t),this.isEmpty())return NaN;for(var r=this.get(0,t),e=1;e<this.rows;e++)this.get(e,t)>r&&(r=this.get(e,t));return r}},{key:"maxColumnIndex",value:function(t){y(this,t),S(this);for(var r=this.get(0,t),e=[0,t],o=1;o<this.rows;o++)this.get(o,t)>r&&(r=this.get(o,t),e[0]=o);return e}},{key:"minColumn",value:function(t){if(y(this,t),this.isEmpty())return NaN;for(var r=this.get(0,t),e=1;e<this.rows;e++)this.get(e,t)<r&&(r=this.get(e,t));return r}},{key:"minColumnIndex",value:function(t){y(this,t),S(this);for(var r=this.get(0,t),e=[0,t],o=1;o<this.rows;o++)this.get(o,t)<r&&(r=this.get(o,t),e[0]=o);return e}},{key:"diag",value:function(){for(var t=Math.min(this.rows,this.columns),r=[],e=0;e<t;e++)r.push(this.get(e,e));return r}},{key:"norm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frobenius",r=0;if("max"===t)return this.max();if("frobenius"===t){for(var e=0;e<this.rows;e++)for(var o=0;o<this.columns;o++)r+=this.get(e,o)*this.get(e,o);return Math.sqrt(r)}throw new RangeError("unknown norm type: ".concat(t))}},{key:"cumulativeSum",value:function(){for(var t=0,r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t+=this.get(r,e),this.set(r,e,t);return this}},{key:"dot",value:function(r){t.isMatrix(r)&&(r=r.to1DArray());var e=this.to1DArray();if(e.length!==r.length)throw new RangeError("vectors do not have the same size");for(var o=0,n=0;n<e.length;n++)o+=e[n]*r[n];return o}},{key:"mmul",value:function(t){t=K.checkMatrix(t);for(var r=this.rows,e=this.columns,o=t.columns,n=new K(r,o),i=new Float64Array(e),s=0;s<o;s++){for(var u=0;u<e;u++)i[u]=t.get(u,s);for(var a=0;a<r;a++){for(var f=0,c=0;c<e;c++)f+=this.get(a,c)*i[c];n.set(a,s,f)}}return n}},{key:"strassen2x2",value:function(t){t=K.checkMatrix(t);var r=new K(2,2),e=this.get(0,0),o=t.get(0,0),n=this.get(0,1),i=t.get(0,1),s=this.get(1,0),u=t.get(1,0),a=this.get(1,1),f=t.get(1,1),c=(e+a)*(o+f),h=(s+a)*o,l=e*(i-f),p=a*(u-o),v=(e+n)*f,y=c+p-v+(n-a)*(u+f),m=l+v,g=h+p,w=c-h+l+(s-e)*(o+i);return r.set(0,0,y),r.set(0,1,m),r.set(1,0,g),r.set(1,1,w),r}},{key:"strassen3x3",value:function(t){t=K.checkMatrix(t);var r=new K(3,3),e=this.get(0,0),o=this.get(0,1),n=this.get(0,2),i=this.get(1,0),s=this.get(1,1),u=this.get(1,2),a=this.get(2,0),f=this.get(2,1),c=this.get(2,2),h=t.get(0,0),l=t.get(0,1),p=t.get(0,2),v=t.get(1,0),y=t.get(1,1),m=t.get(1,2),g=t.get(2,0),w=t.get(2,1),b=t.get(2,2),d=(e-i)*(-l+y),M=(-e+i+s)*(h-l+y),x=(i+s)*(-h+l),k=e*h,S=(-e+a+f)*(h-p+m),E=(-e+a)*(p-m),O=(a+f)*(-h+p),R=(-n+f+c)*(y+g-w),j=(n-c)*(y-w),_=n*g,P=(f+c)*(-g+w),T=(-n+s+u)*(m+g-b),A=(n-u)*(m-b),C=(s+u)*(-g+b),N=k+_+o*v,I=(e+o+n-i-s-f-c)*y+M+x+k+R+_+P,V=k+S+O+(e+o+n-s-u-a-f)*m+_+T+C,q=d+s*(-h+l+v-y-m-g+b)+M+k+_+T+A,D=d+M+x+k+u*w,F=_+T+A+C+i*p,B=k+S+E+f*(-h+p+v-y-m-g+w)+R+j+_,L=R+j+_+P+a*l,z=k+S+E+O+c*b;return r.set(0,0,N),r.set(0,1,I),r.set(0,2,V),r.set(1,0,q),r.set(1,1,D),r.set(1,2,F),r.set(2,0,B),r.set(2,1,L),r.set(2,2,z),r}},{key:"mmulStrassen",value:function(r){r=K.checkMatrix(r);var e=this.clone(),o=e.rows,n=e.columns,i=r.rows,s=r.columns;function u(r,e,o){var n=r.rows,i=r.columns;if(n===e&&i===o)return r;var s=t.zeros(e,o);return s=s.setSubMatrix(r,0,0)}n!==i&&console.warn("Multiplying ".concat(o," x ").concat(n," and ").concat(i," x ").concat(s," matrix: dimensions do not match."));var a=Math.max(o,i),f=Math.max(n,s);return function r(e,o,n,i){if(n<=512||i<=512)return e.mmul(o);n%2==1&&i%2==1?(e=u(e,n+1,i+1),o=u(o,n+1,i+1)):n%2==1?(e=u(e,n+1,i),o=u(o,n+1,i)):i%2==1&&(e=u(e,n,i+1),o=u(o,n,i+1));var s=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),f=e.subMatrix(0,s-1,0,a-1),c=o.subMatrix(0,s-1,0,a-1),h=e.subMatrix(0,s-1,a,e.columns-1),l=o.subMatrix(0,s-1,a,o.columns-1),p=e.subMatrix(s,e.rows-1,0,a-1),v=o.subMatrix(s,o.rows-1,0,a-1),y=e.subMatrix(s,e.rows-1,a,e.columns-1),m=o.subMatrix(s,o.rows-1,a,o.columns-1),g=r(t.add(f,y),t.add(c,m),s,a),w=r(t.add(p,y),c,s,a),b=r(f,t.sub(l,m),s,a),d=r(y,t.sub(v,c),s,a),M=r(t.add(f,h),m,s,a),x=r(t.sub(p,f),t.add(c,l),s,a),k=r(t.sub(h,y),t.add(v,m),s,a),S=t.add(g,d);S.sub(M),S.add(k);var E=t.add(b,M),O=t.add(w,d),R=t.sub(g,w);R.add(b),R.add(x);var j=t.zeros(2*S.rows,2*S.columns);return(j=(j=(j=(j=j.setSubMatrix(S,0,0)).setSubMatrix(E,S.rows,0)).setSubMatrix(O,0,S.columns)).setSubMatrix(R,S.rows,S.columns)).subMatrix(0,n-1,0,i-1)}(e=u(e,a,f),r=u(r,a,f),a,f)}},{key:"scaleRows",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==L(t))throw new TypeError("options must be an object");var r=t.min,e=void 0===r?0:r,o=t.max,n=void 0===o?1:o;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");for(var i=new K(this.rows,this.columns),s=0;s<this.rows;s++){var a=this.getRow(s);a.length>0&&u(a,{min:e,max:n,output:a}),i.setRow(s,a)}return i}},{key:"scaleColumns",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==L(t))throw new TypeError("options must be an object");var r=t.min,e=void 0===r?0:r,o=t.max,n=void 0===o?1:o;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");for(var i=new K(this.rows,this.columns),s=0;s<this.columns;s++){var a=this.getColumn(s);a.length&&u(a,{min:e,max:n,output:a}),i.setColumn(s,a)}return i}},{key:"flipRows",value:function(){for(var t=Math.ceil(this.columns/2),r=0;r<this.rows;r++)for(var e=0;e<t;e++){var o=this.get(r,e),n=this.get(r,this.columns-1-e);this.set(r,e,n),this.set(r,this.columns-1-e,o)}return this}},{key:"flipColumns",value:function(){for(var t=Math.ceil(this.rows/2),r=0;r<this.columns;r++)for(var e=0;e<t;e++){var o=this.get(e,r),n=this.get(this.rows-1-e,r);this.set(e,r,n),this.set(this.rows-1-e,r,o)}return this}},{key:"kroneckerProduct",value:function(t){t=K.checkMatrix(t);for(var r=this.rows,e=this.columns,o=t.rows,n=t.columns,i=new K(r*o,e*n),s=0;s<r;s++)for(var u=0;u<e;u++)for(var a=0;a<o;a++)for(var f=0;f<n;f++)i.set(o*s+a,n*u+f,this.get(s,u)*t.get(a,f));return i}},{key:"kroneckerSum",value:function(t){if(t=K.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");var r=this.rows,e=t.rows,o=this.kroneckerProduct(K.eye(e,e)),n=K.eye(r,r).kroneckerProduct(t);return o.add(n)}},{key:"transpose",value:function(){for(var t=new K(this.columns,this.rows),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.set(e,r,this.get(r,e));return t}},{key:"sortRows",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:J,r=0;r<this.rows;r++)this.setRow(r,this.getRow(r).sort(t));return this}},{key:"sortColumns",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:J,r=0;r<this.columns;r++)this.setColumn(r,this.getColumn(r).sort(t));return this}},{key:"subMatrix",value:function(t,r,e,o){M(this,t,r,e,o);for(var n=new K(r-t+1,o-e+1),i=t;i<=r;i++)for(var s=e;s<=o;s++)n.set(i-t,s-e,this.get(i,s));return n}},{key:"subMatrixRow",value:function(t,r,e){if(void 0===r&&(r=0),void 0===e&&(e=this.columns-1),r>e||r<0||r>=this.columns||e<0||e>=this.columns)throw new RangeError("Argument out of range");for(var o=new K(t.length,e-r+1),n=0;n<t.length;n++)for(var i=r;i<=e;i++){if(t[n]<0||t[n]>=this.rows)throw new RangeError("Row index out of range: ".concat(t[n]));o.set(n,i-r,this.get(t[n],i))}return o}},{key:"subMatrixColumn",value:function(t,r,e){if(void 0===r&&(r=0),void 0===e&&(e=this.rows-1),r>e||r<0||r>=this.rows||e<0||e>=this.rows)throw new RangeError("Argument out of range");for(var o=new K(e-r+1,t.length),n=0;n<t.length;n++)for(var i=r;i<=e;i++){if(t[n]<0||t[n]>=this.columns)throw new RangeError("Column index out of range: ".concat(t[n]));o.set(i-r,n,this.get(i,t[n]))}return o}},{key:"setSubMatrix",value:function(t,r,e){if((t=K.checkMatrix(t)).isEmpty())return this;M(this,r,r+t.rows-1,e,e+t.columns-1);for(var o=0;o<t.rows;o++)for(var n=0;n<t.columns;n++)this.set(r+o,e+n,t.get(o,n));return this}},{key:"selection",value:function(t,r){for(var e=w(this,t,r),o=new K(t.length,r.length),n=0;n<e.row.length;n++)for(var i=e.row[n],s=0;s<e.column.length;s++){var u=e.column[s];o.set(n,s,this.get(i,u))}return o}},{key:"trace",value:function(){for(var t=Math.min(this.rows,this.columns),r=0,e=0;e<t;e++)r+=this.get(e,e);return r}},{key:"clone",value:function(){for(var t=new K(this.rows,this.columns),r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)t.set(r,e,this.get(r,e));return t}},{key:"sum",value:function(t){switch(t){case"row":return function(t){for(var r=x(t.rows),e=0;e<t.rows;++e)for(var o=0;o<t.columns;++o)r[e]+=t.get(e,o);return r}(this);case"column":return function(t){for(var r=x(t.columns),e=0;e<t.rows;++e)for(var o=0;o<t.columns;++o)r[o]+=t.get(e,o);return r}(this);case void 0:return function(t){for(var r=0,e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)r+=t.get(e,o);return r}(this);default:throw new Error("invalid option: ".concat(t))}}},{key:"product",value:function(t){switch(t){case"row":return function(t){for(var r=x(t.rows,1),e=0;e<t.rows;++e)for(var o=0;o<t.columns;++o)r[e]*=t.get(e,o);return r}(this);case"column":return function(t){for(var r=x(t.columns,1),e=0;e<t.rows;++e)for(var o=0;o<t.columns;++o)r[o]*=t.get(e,o);return r}(this);case void 0:return function(t){for(var r=1,e=0;e<t.rows;e++)for(var o=0;o<t.columns;o++)r*=t.get(e,o);return r}(this);default:throw new Error("invalid option: ".concat(t))}}},{key:"mean",value:function(t){var r=this.sum(t);switch(t){case"row":for(var e=0;e<this.rows;e++)r[e]/=this.columns;return r;case"column":for(var o=0;o<this.columns;o++)r[o]/=this.rows;return r;case void 0:return r/this.size;default:throw new Error("invalid option: ".concat(t))}}},{key:"variance",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===L(t)&&(r=t,t=void 0),"object"!==L(r))throw new TypeError("options must be an object");var e=r,o=e.unbiased,n=void 0===o||o,i=e.mean,s=void 0===i?this.mean(t):i;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Array.isArray(s))throw new TypeError("mean must be an array");return E(this,n,s);case"column":if(!Array.isArray(s))throw new TypeError("mean must be an array");return O(this,n,s);case void 0:if("number"!=typeof s)throw new TypeError("mean must be a number");return R(this,n,s);default:throw new Error("invalid option: ".concat(t))}}},{key:"standardDeviation",value:function(t,r){"object"===L(t)&&(r=t,t=void 0);var e=this.variance(t,r);if(void 0===t)return Math.sqrt(e);for(var o=0;o<e.length;o++)e[o]=Math.sqrt(e[o]);return e}},{key:"center",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===L(t)&&(r=t,t=void 0),"object"!==L(r))throw new TypeError("options must be an object");var e=r,o=e.center,n=void 0===o?this.mean(t):o;switch(t){case"row":if(!Array.isArray(n))throw new TypeError("center must be an array");return j(this,n),this;case"column":if(!Array.isArray(n))throw new TypeError("center must be an array");return _(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return P(this,n),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"scale",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===L(t)&&(r=t,t=void 0),"object"!==L(r))throw new TypeError("options must be an object");var e=r.scale;switch(t){case"row":if(void 0===e)e=T(this);else if(!Array.isArray(e))throw new TypeError("scale must be an array");return A(this,e),this;case"column":if(void 0===e)e=C(this);else if(!Array.isArray(e))throw new TypeError("scale must be an array");return N(this,e),this;case void 0:if(void 0===e)e=I(this);else if("number"!=typeof e)throw new TypeError("scale must be a number");return V(this,e),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"toString",value:function(t){return c(this,t)}}],[{key:"from1DArray",value:function(t,r,e){if(t*r!==e.length)throw new RangeError("data length does not match given dimensions");for(var o=new K(t,r),n=0;n<t;n++)for(var i=0;i<r;i++)o.set(n,i,e[n*r+i]);return o}},{key:"rowVector",value:function(t){for(var r=new K(1,t.length),e=0;e<t.length;e++)r.set(0,e,t[e]);return r}},{key:"columnVector",value:function(t){for(var r=new K(t.length,1),e=0;e<t.length;e++)r.set(e,0,t[e]);return r}},{key:"zeros",value:function(t,r){return new K(t,r)}},{key:"ones",value:function(t,r){return new K(t,r).fill(1)}},{key:"rand",value:function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==L(e))throw new TypeError("options must be an object");for(var o=e.random,n=void 0===o?Math.random:o,i=new K(t,r),s=0;s<t;s++)for(var u=0;u<r;u++)i.set(s,u,n());return i}},{key:"randInt",value:function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==L(e))throw new TypeError("options must be an object");var o=e.min,n=void 0===o?0:o,i=e.max,s=void 0===i?1e3:i,u=e.random,a=void 0===u?Math.random:u;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(n>=s)throw new RangeError("min must be smaller than max");for(var f=s-n,c=new K(t,r),h=0;h<t;h++)for(var l=0;l<r;l++){var p=n+Math.round(a()*f);c.set(h,l,p)}return c}},{key:"eye",value:function(t,r,e){void 0===r&&(r=t),void 0===e&&(e=1);for(var o=Math.min(t,r),n=this.zeros(t,r),i=0;i<o;i++)n.set(i,i,e);return n}},{key:"diag",value:function(t,r,e){var o=t.length;void 0===r&&(r=o),void 0===e&&(e=r);for(var n=Math.min(o,r,e),i=this.zeros(r,e),s=0;s<n;s++)i.set(s,s,t[s]);return i}},{key:"min",value:function(t,r){t=this.checkMatrix(t),r=this.checkMatrix(r);for(var e=t.rows,o=t.columns,n=new K(e,o),i=0;i<e;i++)for(var s=0;s<o;s++)n.set(i,s,Math.min(t.get(i,s),r.get(i,s)));return n}},{key:"max",value:function(t,r){t=this.checkMatrix(t),r=this.checkMatrix(r);for(var e=t.rows,o=t.columns,n=new this(e,o),i=0;i<e;i++)for(var s=0;s<o;s++)n.set(i,s,Math.max(t.get(i,s),r.get(i,s)));return n}},{key:"checkMatrix",value:function(r){return t.isMatrix(r)?r:new K(r)}},{key:"isMatrix",value:function(t){return null!=t&&"Matrix"===t.klass}}]),t}();function J(t,r){return t-r}Q.prototype.klass="Matrix","undefined"!=typeof Symbol&&(Q.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return c(this)}),Q.random=Q.rand,Q.randomInt=Q.randInt,Q.diagonal=Q.diag,Q.prototype.diagonal=Q.prototype.diag,Q.identity=Q.eye,Q.prototype.negate=Q.prototype.neg,Q.prototype.tensorProduct=Q.prototype.kroneckerProduct;var Y,H,K=function(t){!function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&q(t,r)}(e,t);var r=D(e);function e(t,o){var n;if(z(this,e),n=r.call(this),e.isMatrix(t))return F(n,t.clone());if(Number.isInteger(t)&&t>=0){if(n.data=[],!(Number.isInteger(o)&&o>=0))throw new TypeError("nColumns must be a positive integer");for(var i=0;i<t;i++)n.data.push(new Float64Array(o))}else{if(!Array.isArray(t))throw new TypeError("First argument must be a positive number or an array");var s=t;if("number"!=typeof(o=(t=s.length)?s[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");n.data=[];for(var u=0;u<t;u++){if(s[u].length!==o)throw new RangeError("Inconsistent array dimensions");n.data.push(Float64Array.from(s[u]))}}return n.rows=t,n.columns=o,n}return W(e,[{key:"set",value:function(t,r,e){return this.data[t][r]=e,this}},{key:"get",value:function(t,r){return this.data[t][r]}},{key:"removeRow",value:function(t){return v(this,t),this.data.splice(t,1),this.rows-=1,this}},{key:"addRow",value:function(t,r){return void 0===r&&(r=t,t=this.rows),v(this,t,!0),r=Float64Array.from(m(this,r)),this.data.splice(t,0,r),this.rows+=1,this}},{key:"removeColumn",value:function(t){y(this,t);for(var r=0;r<this.rows;r++){for(var e=new Float64Array(this.columns-1),o=0;o<t;o++)e[o]=this.data[r][o];for(var n=t+1;n<this.columns;n++)e[n-1]=this.data[r][n];this.data[r]=e}return this.columns-=1,this}},{key:"addColumn",value:function(t,r){void 0===r&&(r=t,t=this.columns),y(this,t,!0),r=g(this,r);for(var e=0;e<this.rows;e++){for(var o=new Float64Array(this.columns+1),n=0;n<t;n++)o[n]=this.data[e][n];for(o[n++]=r[e];n<this.columns+1;n++)o[n]=this.data[e][n-1];this.data[e]=o}return this.columns+=1,this}}]),e}(Q);function X(t){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function G(t,r){return(G=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function Z(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,o=tt(t);if(r){var n=tt(this).constructor;e=Reflect.construct(o,arguments,n)}else e=o.apply(this,arguments);return $(this,e)}}function $(t,r){return!r||"object"!==X(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):r}function tt(t){return(tt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}H=K,(Y=Q).prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},Y.prototype.addS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t);return this},Y.prototype.addM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)+t.get(r,e));return this},Y.add=function(t,r){return new H(t).add(r)},Y.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},Y.prototype.subS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t);return this},Y.prototype.subM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)-t.get(r,e));return this},Y.sub=function(t,r){return new H(t).sub(r)},Y.prototype.subtract=Y.prototype.sub,Y.prototype.subtractS=Y.prototype.subS,Y.prototype.subtractM=Y.prototype.subM,Y.subtract=Y.sub,Y.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},Y.prototype.mulS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t);return this},Y.prototype.mulM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)*t.get(r,e));return this},Y.mul=function(t,r){return new H(t).mul(r)},Y.prototype.multiply=Y.prototype.mul,Y.prototype.multiplyS=Y.prototype.mulS,Y.prototype.multiplyM=Y.prototype.mulM,Y.multiply=Y.mul,Y.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},Y.prototype.divS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t);return this},Y.prototype.divM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)/t.get(r,e));return this},Y.div=function(t,r){return new H(t).div(r)},Y.prototype.divide=Y.prototype.div,Y.prototype.divideS=Y.prototype.divS,Y.prototype.divideM=Y.prototype.divM,Y.divide=Y.div,Y.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},Y.prototype.modS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)%t);return this},Y.prototype.modM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)%t.get(r,e));return this},Y.mod=function(t,r){return new H(t).mod(r)},Y.prototype.modulus=Y.prototype.mod,Y.prototype.modulusS=Y.prototype.modS,Y.prototype.modulusM=Y.prototype.modM,Y.modulus=Y.mod,Y.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},Y.prototype.andS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)&t);return this},Y.prototype.andM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)&t.get(r,e));return this},Y.and=function(t,r){return new H(t).and(r)},Y.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},Y.prototype.orS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)|t);return this},Y.prototype.orM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)|t.get(r,e));return this},Y.or=function(t,r){return new H(t).or(r)},Y.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},Y.prototype.xorS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)^t);return this},Y.prototype.xorM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)^t.get(r,e));return this},Y.xor=function(t,r){return new H(t).xor(r)},Y.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},Y.prototype.leftShiftS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)<<t);return this},Y.prototype.leftShiftM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)<<t.get(r,e));return this},Y.leftShift=function(t,r){return new H(t).leftShift(r)},Y.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},Y.prototype.signPropagatingRightShiftS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)>>t);return this},Y.prototype.signPropagatingRightShiftM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)>>t.get(r,e));return this},Y.signPropagatingRightShift=function(t,r){return new H(t).signPropagatingRightShift(r)},Y.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},Y.prototype.rightShiftS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)>>>t);return this},Y.prototype.rightShiftM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,this.get(r,e)>>>t.get(r,e));return this},Y.rightShift=function(t,r){return new H(t).rightShift(r)},Y.prototype.zeroFillRightShift=Y.prototype.rightShift,Y.prototype.zeroFillRightShiftS=Y.prototype.rightShiftS,Y.prototype.zeroFillRightShiftM=Y.prototype.rightShiftM,Y.zeroFillRightShift=Y.rightShift,Y.prototype.not=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,~this.get(t,r));return this},Y.not=function(t){return new H(t).not()},Y.prototype.abs=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.abs(this.get(t,r)));return this},Y.abs=function(t){return new H(t).abs()},Y.prototype.acos=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.acos(this.get(t,r)));return this},Y.acos=function(t){return new H(t).acos()},Y.prototype.acosh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.acosh(this.get(t,r)));return this},Y.acosh=function(t){return new H(t).acosh()},Y.prototype.asin=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.asin(this.get(t,r)));return this},Y.asin=function(t){return new H(t).asin()},Y.prototype.asinh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.asinh(this.get(t,r)));return this},Y.asinh=function(t){return new H(t).asinh()},Y.prototype.atan=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.atan(this.get(t,r)));return this},Y.atan=function(t){return new H(t).atan()},Y.prototype.atanh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.atanh(this.get(t,r)));return this},Y.atanh=function(t){return new H(t).atanh()},Y.prototype.cbrt=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.cbrt(this.get(t,r)));return this},Y.cbrt=function(t){return new H(t).cbrt()},Y.prototype.ceil=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.ceil(this.get(t,r)));return this},Y.ceil=function(t){return new H(t).ceil()},Y.prototype.clz32=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.clz32(this.get(t,r)));return this},Y.clz32=function(t){return new H(t).clz32()},Y.prototype.cos=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.cos(this.get(t,r)));return this},Y.cos=function(t){return new H(t).cos()},Y.prototype.cosh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.cosh(this.get(t,r)));return this},Y.cosh=function(t){return new H(t).cosh()},Y.prototype.exp=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.exp(this.get(t,r)));return this},Y.exp=function(t){return new H(t).exp()},Y.prototype.expm1=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.expm1(this.get(t,r)));return this},Y.expm1=function(t){return new H(t).expm1()},Y.prototype.floor=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.floor(this.get(t,r)));return this},Y.floor=function(t){return new H(t).floor()},Y.prototype.fround=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.fround(this.get(t,r)));return this},Y.fround=function(t){return new H(t).fround()},Y.prototype.log=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.log(this.get(t,r)));return this},Y.log=function(t){return new H(t).log()},Y.prototype.log1p=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.log1p(this.get(t,r)));return this},Y.log1p=function(t){return new H(t).log1p()},Y.prototype.log10=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.log10(this.get(t,r)));return this},Y.log10=function(t){return new H(t).log10()},Y.prototype.log2=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.log2(this.get(t,r)));return this},Y.log2=function(t){return new H(t).log2()},Y.prototype.round=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.round(this.get(t,r)));return this},Y.round=function(t){return new H(t).round()},Y.prototype.sign=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.sign(this.get(t,r)));return this},Y.sign=function(t){return new H(t).sign()},Y.prototype.sin=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.sin(this.get(t,r)));return this},Y.sin=function(t){return new H(t).sin()},Y.prototype.sinh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.sinh(this.get(t,r)));return this},Y.sinh=function(t){return new H(t).sinh()},Y.prototype.sqrt=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.sqrt(this.get(t,r)));return this},Y.sqrt=function(t){return new H(t).sqrt()},Y.prototype.tan=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.tan(this.get(t,r)));return this},Y.tan=function(t){return new H(t).tan()},Y.prototype.tanh=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.tanh(this.get(t,r)));return this},Y.tanh=function(t){return new H(t).tanh()},Y.prototype.trunc=function(){for(var t=0;t<this.rows;t++)for(var r=0;r<this.columns;r++)this.set(t,r,Math.trunc(this.get(t,r)));return this},Y.trunc=function(t){return new H(t).trunc()},Y.pow=function(t,r){return new H(t).pow(r)},Y.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},Y.prototype.powS=function(t){for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,Math.pow(this.get(r,e),t));return this},Y.prototype.powM=function(t){if(t=H.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var e=0;e<this.columns;e++)this.set(r,e,Math.pow(this.get(r,e),t.get(r,e)));return this};var rt=function(t){!function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&G(t,r)}(e,t);var r=Z(e);function e(t,o,n){var i;return function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),(i=r.call(this)).matrix=t,i.rows=o,i.columns=n,i}return e}(Q);function et(t){return(et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(t,r){for(var e=0;e<r.length;e++){var o=r[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function nt(t,r){return(nt=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function it(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,o=ut(t);if(r){var n=ut(this).constructor;e=Reflect.construct(o,arguments,n)}else e=o.apply(this,arguments);return st(this,e)}}function st(t,r){return!r||"object"!==et(r)&&"function"!=typeof r?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):r}function ut(t){return(ut=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var at=function(t){!function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writab