rakis / _next /static /chunks /994.9c06f9b54c3d1316.js
hrishioa's picture
Upload 74 files
a1de0a7 verified
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[994],{19456:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return a}});let o=Object.prototype.toString;function i(t){let e=o.call(t);return e.endsWith("Array]")&&!e.includes("Big")}let n=Object.prototype.toString,s=Object.prototype.toString;function a(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i(t)){if(0===t.length)throw TypeError("input must not be empty")}else throw TypeError("input must be an array");if(void 0!==r.output){if(!i(r.output))throw TypeError("output option must be an array if specified");e=r.output}else e=Array(t.length);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){let e=s.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw TypeError("input must be an array");if(0===t.length)throw TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,n=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw Error("fromIndex must be a positive integer smaller than length");if(n<=o||n>t.length||!Number.isInteger(n))throw Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],h=o+1;h<n;h++)t[h]<a&&(a=t[h]);return a}(t),a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){let e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw TypeError("input must be an array");if(0===t.length)throw TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],h=o+1;h<s;h++)t[h]>a&&(a=t[h]);return a}(t);if(o===a)throw RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var h=r.min,u=void 0===h?r.autoMinMax?o:0:h,l=r.max,f=void 0===l?r.autoMinMax?a:1:l;if(u>=f)throw RangeError("min option must be smaller than max option");for(var c=(f-u)/(a-o),m=0;m<t.length;m++)e[m]=(t[m]-o)*c+u;return e}},58958:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return u}});let o=Object.prototype.toString;function i(t){return o.call(t).endsWith("Array]")}function n(t,e,r){let o=0,i=r(e);for(let e=0;e<t.x.length;e++)o+=Math.abs(t.y[e]-i(t.x[e]));return o}var s=r(36360);s.XA,s.a_,s.yQ,s.Hs,s.Ec,s.dx,s.LU,s.Rm;let a=s.y3;s.qK,s.pb,s.j,s.sO,s.BZ,s.EK,s.Db,s.Fx,s.tU,s.Ym,s.rs,s.QR,s.TB,s.oH,s.Sc,s.BN,s.it,s.$r,s.QM,s.AV,s.y3,s.y3,s.GH;let h=s.SO;function u(t,e,r={}){let o,{maxIterations:s=100,gradientDifference:u=.1,damping:l=0,errorTolerance:f=.01,minValues:c,maxValues:m,initialValues:g}=r;if(l<=0)throw Error("The damping option must be a positive number");if(t.x&&t.y){if(!i(t.x)||t.x.length<2||!i(t.y)||t.y.length<2)throw Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw Error("The data parameter elements must have the same size")}else throw Error("The data parameter must have x and y elements");let p=g||Array(e.length).fill(1),d=p.length;if(m=m||Array(d).fill(Number.MAX_SAFE_INTEGER),c=c||Array(d).fill(Number.MIN_SAFE_INTEGER),m.length!==c.length)throw Error("minValues and maxValues must be the same size");if(!i(p))throw Error("initialValues must be an array");let w=n(t,p,e),y=w<=f;for(o=0;o<s&&!y;o++){p=function(t,e,r,o,i){let n=r*o*o,s=a.eye(e.length,e.length,n),u=i(e),l=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)l[e]=u(t.x[e]);let f=function(t,e,r,o,i){let n=r.length,s=t.x.length,h=Array(n);for(let a=0;a<n;a++){h[a]=Array(s);let n=r.slice();n[a]+=o;let u=i(n);for(let r=0;r<s;r++)h[a][r]=e[r]-u(t.x[r])}return new a(h)}(t,l,e,o,i),c=function(t,e){let r=t.x.length,o=Array(r);for(let i=0;i<r;i++)o[i]=[t.y[i]-e[i]];return new a(o)}(t,l),m=h(s.add(f.mmul(f.transpose())));return(e=(e=new a([e])).sub(m.mmul(f).mmul(c).mul(o).transpose())).to1DArray()}(t,p,l,u,e);for(let t=0;t<d;t++)p[t]=Math.min(Math.max(c[t],p[t]),m[t]);if(isNaN(w=n(t,p,e)))break;y=w<=f}return{parameterValues:p,parameterError:w,iterations:o}}s.uZ,s.yU,s.F1,s.re},36360:function(t,e,r){"use strict";var o=r(19068),i=r(19456);let n=" ".repeat(2),s=" ".repeat(4);function a(t,e={}){let{maxRows:r=15,maxColumns:o=10,maxNumSize:i=8,padMinus:a="auto"}=e;return`${t.constructor.name} {
${n}[
${s}${function(t,e,r,o,i){let{rows:n,columns:a}=t,u=Math.min(n,e),l=Math.min(a,r),f=[];if("auto"===i){i=!1;t:for(let e=0;e<u;e++)for(let r=0;r<l;r++)if(0>t.get(e,r)){i=!0;break t}}for(let e=0;e<u;e++){let r=[];for(let n=0;n<l;n++){var c,m;r.push((c=t.get(e,n),m=i,(c>=0&&m?` ${h(c,o-1)}`:h(c,o)).padEnd(o)))}f.push(`${r.join(" ")}`)}return l!==a&&(f[f.length-1]+=` ... ${a-r} more columns`),u!==n&&f.push(`... ${n-e} more rows`),f.join(`
${s}`)}(t,r,o,i,a)}
${n}]
${n}rows: ${t.rows}
${n}columns: ${t.columns}
}`}function h(t,e){let r=t.toString();if(r.length<=e)return r;let o=t.toFixed(e);if(o.length>e&&(o=t.toFixed(Math.max(0,e-(o.length-e)))),o.length<=e&&!o.startsWith("0.000")&&!o.startsWith("-0.000"))return o;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function u(t,e,r){let o=r?t.rows:t.rows-1;if(e<0||e>o)throw RangeError("Row index out of range")}function l(t,e,r){let o=r?t.columns:t.columns-1;if(e<0||e>o)throw RangeError("Column index out of range")}function f(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw RangeError("vector size must be the same as the number of columns");return e}function c(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw RangeError("vector size must be the same as the number of rows");return e}function m(t,e){if(!o.isAnyArray(e))throw TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw RangeError("row indices are out of range")}function g(t,e){if(!o.isAnyArray(e))throw TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw RangeError("column indices are out of range")}function p(t,e,r,o,i){if(5!=arguments.length)throw RangeError("expected 4 arguments");if(w("startRow",e),w("endRow",r),w("startColumn",o),w("endColumn",i),e>r||o>i||e<0||e>=t.rows||r<0||r>=t.rows||o<0||o>=t.columns||i<0||i>=t.columns)throw RangeError("Submatrix indices are out of range")}function d(t,e=0){let r=[];for(let o=0;o<t;o++)r.push(e);return r}function w(t,e){if("number"!=typeof e)throw TypeError(`${t} must be a number`)}function y(t){if(t.isEmpty())throw Error("Empty matrix has no elements to index")}class v{static from1DArray(t,e,r){if(t*e!==r.length)throw RangeError("data length does not match given dimensions");let o=new M(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)o.set(i,t,r[i*e+t]);return o}static rowVector(t){let e=new M(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new M(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new M(t,e)}static ones(t,e){return new M(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw TypeError("options must be an object");let{random:o=Math.random}=r,i=new M(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)i.set(r,t,o());return i}static randInt(t,e,r={}){if("object"!=typeof r)throw TypeError("options must be an object");let{min:o=0,max:i=1e3,random:n=Math.random}=r;if(!Number.isInteger(o))throw TypeError("min must be an integer");if(!Number.isInteger(i))throw TypeError("max must be an integer");if(o>=i)throw RangeError("min must be smaller than max");let s=i-o,a=new M(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=o+Math.round(n()*s);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let o=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<o;t++)i.set(t,t,r);return i}static diag(t,e,r){let o=t.length;void 0===e&&(e=o),void 0===r&&(r=e);let i=Math.min(o,e,r),n=this.zeros(e,r);for(let e=0;e<i;e++)n.set(e,e,t[e]);return n}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,o=t.columns,i=new M(r,o);for(let n=0;n<r;n++)for(let r=0;r<o;r++)i.set(n,r,Math.min(t.get(n,r),e.get(n,r)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,o=t.columns,i=new this(r,o);for(let n=0;n<r;n++)for(let r=0;r<o;r++)i.set(n,r,Math.max(t.get(n,r),e.get(n,r)));return i}static checkMatrix(t){return v.isMatrix(t)?t:new M(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,o=!0,i=!1;for(;t<this.rows&&o;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(i=!0,r=e):(o=!1,i=!0);t++}return o}isReducedEchelonForm(){let t=0,e=0,r=-1,o=!0,i=!1;for(;t<this.rows&&o;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(i=!0,r=e):(o=!1,i=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(o=!1);t++}return o}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let o=e;for(let i=e;i<t.rows;i++)t.get(i,r)>t.get(o,r)&&(o=i);if(0===t.get(o,r))r++;else{t.swapRows(e,o);let i=t.get(e,r);for(let o=r;o<t.columns;o++)t.set(e,o,t.get(e,o)/i);for(let o=e+1;o<t.rows;o++){let i=t.get(o,r)/t.get(e,r);t.set(o,r,0);for(let n=r+1;n<t.columns;n++)t.set(o,n,t.get(o,n)-t.get(e,n)*i)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,o=r-1;for(;o>=0;)if(0===t.maxRow(o))o--;else{let i=0,n=!1;for(;i<r&&!1===n;)1===t.get(o,i)?n=!0:i++;for(let r=0;r<o;r++){let n=t.get(r,i);for(let s=i;s<e;s++){let e=t.get(r,s)-n*t.get(o,s);t.set(r,s,e)}}o--}return t}set(){throw Error("set method is unimplemented")}get(){throw Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw TypeError("options must be an object");let{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw TypeError("columns must be a positive integer");let o=new M(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)o.setSubMatrix(this,this.rows*t,this.columns*e);return o}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){u(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return M.rowVector(this.getRow(t))}setRow(t,e){u(this,t),e=f(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){u(this,t),u(this,e);for(let r=0;r<this.columns;r++){let o=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,o)}return this}getColumn(t){l(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return M.columnVector(this.getColumn(t))}setColumn(t,e){l(this,t),e=c(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){l(this,t),l(this,e);for(let r=0;r<this.rows;r++){let o=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,o)}return this}addRowVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=f(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){u(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){l(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{let t=Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{let t=Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw Error(`invalid option: ${t}`)}}maxIndex(){y(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let o=0;o<this.columns;o++)this.get(r,o)>t&&(t=this.get(r,o),e[0]=r,e[1]=o);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{let t=Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{let t=Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw Error(`invalid option: ${t}`)}}minIndex(){y(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let o=0;o<this.columns;o++)this.get(r,o)<t&&(t=this.get(r,o),e[0]=r,e[1]=o);return e}maxRow(t){if(u(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){u(this,t),y(this);let e=this.get(t,0),r=[t,0];for(let o=1;o<this.columns;o++)this.get(t,o)>e&&(e=this.get(t,o),r[1]=o);return r}minRow(t){if(u(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){u(this,t),y(this);let e=this.get(t,0),r=[t,0];for(let o=1;o<this.columns;o++)this.get(t,o)<e&&(e=this.get(t,o),r[1]=o);return r}maxColumn(t){if(l(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){l(this,t),y(this);let e=this.get(0,t),r=[0,t];for(let o=1;o<this.rows;o++)this.get(o,t)>e&&(e=this.get(o,t),r[0]=o);return r}minColumn(t){if(l(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){l(this,t),y(this);let e=this.get(0,t),r=[0,t];for(let o=1;o<this.rows;o++)this.get(o,t)<e&&(e=this.get(o,t),r[0]=o);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){v.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw RangeError("vectors do not have the same size");let r=0;for(let o=0;o<e.length;o++)r+=e[o]*t[o];return r}mmul(t){t=M.checkMatrix(t);let e=this.rows,r=this.columns,o=t.columns,i=new M(e,o),n=new Float64Array(r);for(let s=0;s<o;s++){for(let e=0;e<r;e++)n[e]=t.get(e,s);for(let t=0;t<e;t++){let e=0;for(let o=0;o<r;o++)e+=this.get(t,o)*n[o];i.set(t,s,e)}}return i}strassen2x2(t){t=M.checkMatrix(t);let e=new M(2,2),r=this.get(0,0),o=t.get(0,0),i=this.get(0,1),n=t.get(0,1),s=this.get(1,0),a=t.get(1,0),h=this.get(1,1),u=t.get(1,1),l=(r+h)*(o+u),f=(s+h)*o,c=r*(n-u),m=h*(a-o),g=(r+i)*u;return e.set(0,0,l+m-g+(i-h)*(a+u)),e.set(0,1,c+g),e.set(1,0,f+m),e.set(1,1,l-f+c+(s-r)*(o+n)),e}strassen3x3(t){t=M.checkMatrix(t);let e=new M(3,3),r=this.get(0,0),o=this.get(0,1),i=this.get(0,2),n=this.get(1,0),s=this.get(1,1),a=this.get(1,2),h=this.get(2,0),u=this.get(2,1),l=this.get(2,2),f=t.get(0,0),c=t.get(0,1),m=t.get(0,2),g=t.get(1,0),p=t.get(1,1),d=t.get(1,2),w=t.get(2,0),y=t.get(2,1),v=t.get(2,2),b=(r-n)*(-c+p),x=(-r+n+s)*(f-c+p),S=(n+s)*(-f+c),E=r*f,R=(-r+h+u)*(f-m+d),k=(-r+h)*(m-d),N=(h+u)*(-f+m),z=(-i+u+l)*(p+w-y),_=(i-l)*(p-y),A=i*w,P=(u+l)*(-w+y),I=(-i+s+a)*(d+w-v),O=(i-a)*(d-v),C=(s+a)*(-w+v);return e.set(0,0,E+A+o*g),e.set(0,1,(r+o+i-n-s-u-l)*p+x+S+E+z+A+P),e.set(0,2,E+R+N+(r+o+i-s-a-h-u)*d+A+I+C),e.set(1,0,b+s*(-f+c+g-p-d-w+v)+x+E+A+I+O),e.set(1,1,b+x+S+E+a*y),e.set(1,2,A+I+O+C+n*m),e.set(2,0,E+R+k+u*(-f+m+g-p-d-w+y)+z+_+A),e.set(2,1,z+_+A+P+h*c),e.set(2,2,E+R+k+N+l*v),e}mmulStrassen(t){t=M.checkMatrix(t);let e=this.clone(),r=e.rows,o=e.columns,i=t.rows,n=t.columns;function s(t,e,r){let o=t.rows,i=t.columns;return o===e&&i===r?t:v.zeros(e,r).setSubMatrix(t,0,0)}o!==i&&console.warn(`Multiplying ${r} x ${o} and ${i} x ${n} matrix: dimensions do not match.`);let a=Math.max(r,i),h=Math.max(o,n);return function t(e,r,o,i){if(o<=512||i<=512)return e.mmul(r);o%2==1&&i%2==1?(e=s(e,o+1,i+1),r=s(r,o+1,i+1)):o%2==1?(e=s(e,o+1,i),r=s(r,o+1,i)):i%2==1&&(e=s(e,o,i+1),r=s(r,o,i+1));let n=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),h=e.subMatrix(0,n-1,0,a-1),u=r.subMatrix(0,n-1,0,a-1),l=e.subMatrix(0,n-1,a,e.columns-1),f=r.subMatrix(0,n-1,a,r.columns-1),c=e.subMatrix(n,e.rows-1,0,a-1),m=r.subMatrix(n,r.rows-1,0,a-1),g=e.subMatrix(n,e.rows-1,a,e.columns-1),p=r.subMatrix(n,r.rows-1,a,r.columns-1),d=t(v.add(h,g),v.add(u,p),n,a),w=t(v.add(c,g),u,n,a),y=t(h,v.sub(f,p),n,a),b=t(g,v.sub(m,u),n,a),M=t(v.add(h,l),p,n,a),x=t(v.sub(c,h),v.add(u,f),n,a),S=t(v.sub(l,g),v.add(m,p),n,a),E=v.add(d,b);E.sub(M),E.add(S);let R=v.add(y,M),k=v.add(w,b),N=v.sub(d,w);N.add(y),N.add(x);let z=v.zeros(2*E.rows,2*E.columns);return(z=(z=(z=(z=z.setSubMatrix(E,0,0)).setSubMatrix(R,E.rows,0)).setSubMatrix(k,0,E.columns)).setSubMatrix(N,E.rows,E.columns)).subMatrix(0,o-1,0,i-1)}(e=s(e,a,h),t=s(t,a,h),a,h)}scaleRows(t={}){if("object"!=typeof t)throw TypeError("options must be an object");let{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw TypeError("min must be a number");if(!Number.isFinite(r))throw TypeError("max must be a number");if(e>=r)throw RangeError("min must be smaller than max");let o=new M(this.rows,this.columns);for(let t=0;t<this.rows;t++){let n=this.getRow(t);n.length>0&&i(n,{min:e,max:r,output:n}),o.setRow(t,n)}return o}scaleColumns(t={}){if("object"!=typeof t)throw TypeError("options must be an object");let{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw TypeError("min must be a number");if(!Number.isFinite(r))throw TypeError("max must be a number");if(e>=r)throw RangeError("min must be smaller than max");let o=new M(this.rows,this.columns);for(let t=0;t<this.columns;t++){let n=this.getColumn(t);n.length&&i(n,{min:e,max:r,output:n}),o.setColumn(t,n)}return o}flipRows(){let t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),o=this.get(e,this.columns-1-r);this.set(e,r,o),this.set(e,this.columns-1-r,t)}return this}flipColumns(){let t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),o=this.get(this.rows-1-r,e);this.set(r,e,o),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=M.checkMatrix(t);let e=this.rows,r=this.columns,o=t.rows,i=t.columns,n=new M(e*o,r*i);for(let s=0;s<e;s++)for(let e=0;e<r;e++)for(let r=0;r<o;r++)for(let a=0;a<i;a++)n.set(o*s+r,i*e+a,this.get(s,e)*t.get(r,a));return n}kroneckerSum(t){if(t=M.checkMatrix(t),!this.isSquare()||!t.isSquare())throw Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,o=this.kroneckerProduct(M.eye(r,r)),i=M.eye(e,e).kroneckerProduct(t);return o.add(i)}transpose(){let t=new M(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=b){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=b){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,o){p(this,t,e,r,o);let i=new M(e-t+1,o-r+1);for(let n=t;n<=e;n++)for(let e=r;e<=o;e++)i.set(n-t,e-r,this.get(n,e));return i}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw RangeError("Argument out of range");let o=new M(t.length,r-e+1);for(let i=0;i<t.length;i++)for(let n=e;n<=r;n++){if(t[i]<0||t[i]>=this.rows)throw RangeError(`Row index out of range: ${t[i]}`);o.set(i,n-e,this.get(t[i],n))}return o}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw RangeError("Argument out of range");let o=new M(r-e+1,t.length);for(let i=0;i<t.length;i++)for(let n=e;n<=r;n++){if(t[i]<0||t[i]>=this.columns)throw RangeError(`Column index out of range: ${t[i]}`);o.set(n-e,i,this.get(n,t[i]))}return o}setSubMatrix(t,e,r){if((t=M.checkMatrix(t)).isEmpty())return this;let o=e+t.rows-1,i=r+t.columns-1;p(this,e,o,r,i);for(let o=0;o<t.rows;o++)for(let i=0;i<t.columns;i++)this.set(e+o,r+i,t.get(o,i));return this}selection(t,e){m(this,t),g(this,e);let r=new M(t.length,e.length);for(let o=0;o<t.length;o++){let i=t[o];for(let t=0;t<e.length;t++){let n=e[t];r.set(o,t,this.get(i,n))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new M(this.rows,this.columns))}static copy(t,e){for(let[r,o,i]of t.entries())e.set(r,o,i);return e}sum(t){switch(t){case"row":return function(t){let e=d(t.rows);for(let r=0;r<t.rows;++r)for(let o=0;o<t.columns;++o)e[r]+=t.get(r,o);return e}(this);case"column":return function(t){let e=d(t.columns);for(let r=0;r<t.rows;++r)for(let o=0;o<t.columns;++o)e[o]+=t.get(r,o);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)e+=t.get(r,o);return e}(this);default:throw Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=d(t.rows,1);for(let r=0;r<t.rows;++r)for(let o=0;o<t.columns;++o)e[r]*=t.get(r,o);return e}(this);case"column":return function(t){let e=d(t.columns,1);for(let r=0;r<t.rows;++r)for(let o=0;o<t.columns;++o)e[o]*=t.get(r,o);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)e*=t.get(r,o);return e}(this);default:throw Error(`invalid option: ${t}`)}}mean(t){let e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw TypeError("options must be an object");let{unbiased:r=!0,mean:i=this.mean(t)}=e;if("boolean"!=typeof r)throw TypeError("unbiased must be a boolean");switch(t){case"row":if(!o.isAnyArray(i))throw TypeError("mean must be an array");return function(t,e,r){let o=t.rows,i=t.columns,n=[];for(let s=0;s<o;s++){let o=0,a=0,h=0;for(let e=0;e<i;e++)o+=h=t.get(s,e)-r[s],a+=h*h;e?n.push((a-o*o/i)/(i-1)):n.push((a-o*o/i)/i)}return n}(this,r,i);case"column":if(!o.isAnyArray(i))throw TypeError("mean must be an array");return function(t,e,r){let o=t.rows,i=t.columns,n=[];for(let s=0;s<i;s++){let i=0,a=0,h=0;for(let e=0;e<o;e++)i+=h=t.get(e,s)-r[s],a+=h*h;e?n.push((a-i*i/o)/(o-1)):n.push((a-i*i/o)/o)}return n}(this,r,i);case void 0:if("number"!=typeof i)throw TypeError("mean must be a number");return function(t,e,r){let o=t.rows,i=t.columns,n=o*i,s=0,a=0,h=0;for(let e=0;e<o;e++)for(let o=0;o<i;o++)s+=h=t.get(e,o)-r,a+=h*h;return e?(a-s*s/n)/(n-1):(a-s*s/n)/n}(this,r,i);default:throw Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);let r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw TypeError("options must be an object");let{center:r=this.mean(t)}=e;switch(t){case"row":if(!o.isAnyArray(r))throw TypeError("center must be an array");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)-e[r])}(this,r),this;case"column":if(!o.isAnyArray(r))throw TypeError("center must be an array");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)-e[o])}(this,r),this;case void 0:if("number"!=typeof r)throw TypeError("center must be a number");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)-e)}(this,r),this;default:throw Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){let e=[];for(let r=0;r<t.rows;r++){let o=0;for(let e=0;e<t.columns;e++)o+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(o))}return e}(this);else if(!o.isAnyArray(r))throw TypeError("scale must be an array");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){let e=[];for(let r=0;r<t.columns;r++){let o=0;for(let e=0;e<t.rows;e++)o+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(o))}return e}(this);else if(!o.isAnyArray(r))throw TypeError("scale must be an array");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)/e[o])}(this,r),this;case void 0:if(void 0===r)r=function(t){let e=t.size-1,r=0;for(let o=0;o<t.columns;o++)for(let i=0;i<t.rows;i++)r+=Math.pow(t.get(i,o),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw TypeError("scale must be a number");return!function(t,e){for(let r=0;r<t.rows;r++)for(let o=0;o<t.columns;o++)t.set(r,o,t.get(r,o)/e)}(this,r),this;default:throw Error(`invalid option: ${t}`)}}toString(t){return a(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function b(t,e){return t-e}v.prototype.klass="Matrix","undefined"!=typeof Symbol&&(v.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return a(this)}),v.random=v.rand,v.randomInt=v.randInt,v.diagonal=v.diag,v.prototype.diagonal=v.prototype.diag,v.identity=v.eye,v.prototype.negate=v.prototype.neg,v.prototype.tensorProduct=v.prototype.kroneckerProduct;class M extends v{data;#t(t,e){if(this.data=[],Number.isInteger(e)&&e>=0)for(let r=0;r<t;r++)this.data.push(new Float64Array(e));else throw TypeError("nColumns must be a positive integer");this.rows=t,this.columns=e}constructor(t,e){if(super(),M.isMatrix(t))this.#t(t.rows,t.columns),M.copy(t,this);else if(Number.isInteger(t)&&t>=0)this.#t(t,e);else if(o.isAnyArray(t)){let r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw TypeError("Data must be a 2D array with at least one element");this.data=[];for(let o=0;o<t;o++){if(r[o].length!==e)throw RangeError("Inconsistent array dimensions");if(!r[o].every(t=>"number"==typeof t))throw TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[o]))}this.rows=t,this.columns=e}else throw TypeError("First argument must be a positive number or an array")}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return u(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),u(this,t,!0),e=Float64Array.from(f(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){l(this,t);for(let e=0;e<this.rows;e++){let r=new Float64Array(this.columns-1);for(let o=0;o<t;o++)r[o]=this.data[e][o];for(let o=t+1;o<this.columns;o++)r[o-1]=this.data[e][o];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),l(this,t,!0),e=c(this,e);for(let r=0;r<this.rows;r++){let o=new Float64Array(this.columns+1),i=0;for(;i<t;i++)o[i]=this.data[r][i];for(o[i++]=e[r];i<this.columns+1;i++)o[i]=this.data[r][i-1];this.data[r]=o}return this.columns+=1,this}}v.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},v.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},v.prototype.addM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},v.add=function(t,e){return new M(t).add(e)},v.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},v.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},v.prototype.subM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},v.sub=function(t,e){return new M(t).sub(e)},v.prototype.subtract=v.prototype.sub,v.prototype.subtractS=v.prototype.subS,v.prototype.subtractM=v.prototype.subM,v.subtract=v.sub,v.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},v.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},v.prototype.mulM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},v.mul=function(t,e){return new M(t).mul(e)},v.prototype.multiply=v.prototype.mul,v.prototype.multiplyS=v.prototype.mulS,v.prototype.multiplyM=v.prototype.mulM,v.multiply=v.mul,v.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},v.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},v.prototype.divM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},v.div=function(t,e){return new M(t).div(e)},v.prototype.divide=v.prototype.div,v.prototype.divideS=v.prototype.divS,v.prototype.divideM=v.prototype.divM,v.divide=v.div,v.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},v.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},v.prototype.modM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},v.mod=function(t,e){return new M(t).mod(e)},v.prototype.modulus=v.prototype.mod,v.prototype.modulusS=v.prototype.modS,v.prototype.modulusM=v.prototype.modM,v.modulus=v.mod,v.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},v.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},v.prototype.andM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},v.and=function(t,e){return new M(t).and(e)},v.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},v.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},v.prototype.orM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},v.or=function(t,e){return new M(t).or(e)},v.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},v.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},v.prototype.xorM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},v.xor=function(t,e){return new M(t).xor(e)},v.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},v.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},v.prototype.leftShiftM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},v.leftShift=function(t,e){return new M(t).leftShift(e)},v.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},v.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},v.prototype.signPropagatingRightShiftM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},v.signPropagatingRightShift=function(t,e){return new M(t).signPropagatingRightShift(e)},v.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},v.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},v.prototype.rightShiftM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},v.rightShift=function(t,e){return new M(t).rightShift(e)},v.prototype.zeroFillRightShift=v.prototype.rightShift,v.prototype.zeroFillRightShiftS=v.prototype.rightShiftS,v.prototype.zeroFillRightShiftM=v.prototype.rightShiftM,v.zeroFillRightShift=v.rightShift,v.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},v.not=function(t){return new M(t).not()},v.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},v.abs=function(t){return new M(t).abs()},v.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},v.acos=function(t){return new M(t).acos()},v.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},v.acosh=function(t){return new M(t).acosh()},v.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},v.asin=function(t){return new M(t).asin()},v.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},v.asinh=function(t){return new M(t).asinh()},v.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},v.atan=function(t){return new M(t).atan()},v.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},v.atanh=function(t){return new M(t).atanh()},v.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},v.cbrt=function(t){return new M(t).cbrt()},v.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},v.ceil=function(t){return new M(t).ceil()},v.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},v.clz32=function(t){return new M(t).clz32()},v.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},v.cos=function(t){return new M(t).cos()},v.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},v.cosh=function(t){return new M(t).cosh()},v.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},v.exp=function(t){return new M(t).exp()},v.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},v.expm1=function(t){return new M(t).expm1()},v.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},v.floor=function(t){return new M(t).floor()},v.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},v.fround=function(t){return new M(t).fround()},v.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},v.log=function(t){return new M(t).log()},v.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},v.log1p=function(t){return new M(t).log1p()},v.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},v.log10=function(t){return new M(t).log10()},v.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},v.log2=function(t){return new M(t).log2()},v.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},v.round=function(t){return new M(t).round()},v.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},v.sign=function(t){return new M(t).sign()},v.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},v.sin=function(t){return new M(t).sin()},v.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},v.sinh=function(t){return new M(t).sinh()},v.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},v.sqrt=function(t){return new M(t).sqrt()},v.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},v.tan=function(t){return new M(t).tan()},v.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},v.tanh=function(t){return new M(t).tanh()},v.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},v.trunc=function(t){return new M(t).trunc()},v.pow=function(t,e){return new M(t).pow(e)},v.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},v.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},v.prototype.powM=function(t){if(t=M.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this};class x extends v{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return M.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),M.isMatrix(t)){if(!t.isSymmetric())throw TypeError("not symmetric data");this.#e=M.copy(t,new M(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new M(t,t);else if(this.#e=new M(t),!this.isSymmetric())throw TypeError("not symmetric data")}clone(){let t=new x(this.diagonalSize);for(let[e,r,o]of this.upperRightEntries())t.set(e,r,o);return t}toMatrix(){return new M(this)}get(t,e){return this.#e.get(t,e)}set(t,e,r){return this.#e.set(t,e,r),this.#e.set(e,t,r),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);let r=e.slice();return r.splice(t,1),this.#e.addRow(t,r),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw RangeError("Mask size do not match with matrix size");let e=[];for(let[r,o]of t.entries())o||e.push(r);for(let t of(e.reverse(),e))this.removeCross(t);return this}toCompact(){let{diagonalSize:t}=this,e=Array(t*(t+1)/2);for(let r=0,o=0,i=0;i<e.length;i++)e[i]=this.get(o,r),++r>=t&&(r=++o);return e}static fromCompact(t){let e=t.length,r=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(r))throw TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);let o=new x(r);for(let i=0,n=0,s=0;s<e;s++)o.set(i,n,t[s]),++i>=r&&(i=++n);return o}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;){let r=this.get(t,e);yield[t,e,r],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;){let r=this.get(t,e);yield r,++e>=this.diagonalSize&&(e=++t)}}}x.prototype.klassType="SymmetricMatrix";class S extends x{static isDistanceMatrix(t){return x.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new x(this)}clone(){let t=new S(this.diagonalSize);for(let[e,r,o]of this.upperRightEntries())e!==r&&t.set(e,r,o);return t}toCompact(){let{diagonalSize:t}=this,e=Array((t-1)*t/2);for(let r=1,o=0,i=0;i<e.length;i++)e[i]=this.get(o,r),++r>=t&&(r=++o+1);return e}static fromCompact(t){let e=t.length,r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);let o=new this(r);for(let i=1,n=0,s=0;s<e;s++)o.set(i,n,t[s]),++i>=r&&(i=++n+1);return o}}S.prototype.klassSubType="DistanceMatrix";class E extends v{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class R extends E{constructor(t,e){l(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class k extends E{constructor(t,e){g(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class N extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class z extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class _ extends E{constructor(t,e){u(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class A extends E{constructor(t,e){m(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class P extends E{constructor(t,e,r){m(t,e),g(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class I extends E{constructor(t,e,r,o,i){p(t,e,r,o,i),super(t,r-e+1,i-o+1),this.startRow=e,this.startColumn=o}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class O extends E{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class C extends v{constructor(t,e={}){let{rows:r=1}=e;if(t.length%r!=0)throw Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let o=this._calculateIndex(t,e);return this.data[o]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class T extends v{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class j{constructor(t){let e,r,o,i,n,s,a,h,u;let l=(t=T.checkMatrix(t)).clone(),f=l.rows,c=l.columns,m=new Float64Array(f),g=1;for(e=0;e<f;e++)m[e]=e;for(r=0,h=new Float64Array(f);r<c;r++){for(e=0;e<f;e++)h[e]=l.get(e,r);for(e=0;e<f;e++){for(o=0,u=Math.min(e,r),n=0;o<u;o++)n+=l.get(e,o)*h[o];h[e]-=n,l.set(e,r,h[e])}for(i=r,e=r+1;e<f;e++)Math.abs(h[e])>Math.abs(h[i])&&(i=e);if(i!==r){for(o=0;o<c;o++)s=l.get(i,o),l.set(i,o,l.get(r,o)),l.set(r,o,s);a=m[i],m[i]=m[r],m[r]=a,g=-g}if(r<f&&0!==l.get(r,r))for(e=r+1;e<f;e++)l.set(e,r,l.get(e,r)/l.get(r,r))}this.LU=l,this.pivotVector=m,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){let e,r,o;t=M.checkMatrix(t);let i=this.LU;if(i.rows!==t.rows)throw Error("Invalid matrix dimensions");if(this.isSingular())throw Error("LU matrix is singular");let n=t.columns,s=t.subMatrixRow(this.pivotVector,0,n-1),a=i.columns;for(o=0;o<a;o++)for(e=o+1;e<a;e++)for(r=0;r<n;r++)s.set(e,r,s.get(e,r)-s.get(o,r)*i.get(e,o));for(o=a-1;o>=0;o--){for(r=0;r<n;r++)s.set(o,r,s.get(o,r)/i.get(o,o));for(e=0;e<o;e++)for(r=0;r<n;r++)s.set(e,r,s.get(e,r)-s.get(o,r)*i.get(e,o))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let o=0;o<r;o++)e*=t.get(o,o);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,o=new M(e,r);for(let i=0;i<e;i++)for(let e=0;e<r;e++)i>e?o.set(i,e,t.get(i,e)):i===e?o.set(i,e,1):o.set(i,e,0);return o}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,o=new M(e,r);for(let i=0;i<e;i++)for(let e=0;e<r;e++)i<=e?o.set(i,e,t.get(i,e)):o.set(i,e,0);return o}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function F(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class D{constructor(t){let e,r,o,i;let n=(t=T.checkMatrix(t)).clone(),s=t.rows,a=t.columns,h=new Float64Array(a);for(o=0;o<a;o++){let t=0;for(e=o;e<s;e++)t=F(t,n.get(e,o));if(0!==t){for(0>n.get(o,o)&&(t=-t),e=o;e<s;e++)n.set(e,o,n.get(e,o)/t);for(n.set(o,o,n.get(o,o)+1),r=o+1;r<a;r++){for(i=0,e=o;e<s;e++)i+=n.get(e,o)*n.get(e,r);for(i=-i/n.get(o,o),e=o;e<s;e++)n.set(e,r,n.get(e,r)+i*n.get(e,o))}}h[o]=-t}this.QR=n,this.Rdiag=h}solve(t){let e,r,o,i;t=M.checkMatrix(t);let n=this.QR,s=n.rows;if(t.rows!==s)throw Error("Matrix row dimensions must agree");if(!this.isFullRank())throw Error("Matrix is rank deficient");let a=t.columns,h=t.clone(),u=n.columns;for(o=0;o<u;o++)for(r=0;r<a;r++){for(i=0,e=o;e<s;e++)i+=n.get(e,o)*h.get(e,r);for(i=-i/n.get(o,o),e=o;e<s;e++)h.set(e,r,h.get(e,r)+i*n.get(e,o))}for(o=u-1;o>=0;o--){for(r=0;r<a;r++)h.set(o,r,h.get(o,r)/this.Rdiag[o]);for(e=0;e<o;e++)for(r=0;r<a;r++)h.set(e,r,h.get(e,r)-h.get(o,r)*n.get(e,o))}return h.subMatrix(0,u-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,o=r.columns,i=new M(o,o);for(t=0;t<o;t++)for(e=0;e<o;e++)t<e?i.set(t,e,r.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,r,o,i=this.QR,n=i.rows,s=i.columns,a=new M(n,s);for(r=s-1;r>=0;r--){for(t=0;t<n;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<s;e++)if(0!==i.get(r,r)){for(o=0,t=r;t<n;t++)o+=i.get(t,r)*a.get(t,e);for(o=-o/i.get(r,r),t=r;t<n;t++)a.set(t,e,a.get(t,e)+o*i.get(t,r))}}return a}}class V{constructor(t,e={}){let r;if((t=T.checkMatrix(t)).isEmpty())throw Error("Matrix must be non-empty");let o=t.rows,i=t.columns,{computeLeftSingularVectors:n=!0,computeRightSingularVectors:s=!0,autoTranspose:a=!1}=e,h=!!n,u=!!s,l=!1;if(o<i){if(a){o=(r=t.transpose()).rows,i=r.columns,l=!0;let e=h;h=u,u=e}else r=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose")}else r=t.clone();let f=Math.min(o,i),c=Math.min(o+1,i),m=new Float64Array(c),g=new M(o,f),p=new M(i,i),d=new Float64Array(i),w=new Float64Array(o),y=new Float64Array(c);for(let t=0;t<c;t++)y[t]=t;let v=Math.min(o-1,i),b=Math.max(0,Math.min(i-2,o)),x=Math.max(v,b);for(let t=0;t<x;t++){if(t<v){m[t]=0;for(let e=t;e<o;e++)m[t]=F(m[t],r.get(e,t));if(0!==m[t]){0>r.get(t,t)&&(m[t]=-m[t]);for(let e=t;e<o;e++)r.set(e,t,r.get(e,t)/m[t]);r.set(t,t,r.get(t,t)+1)}m[t]=-m[t]}for(let e=t+1;e<i;e++){if(t<v&&0!==m[t]){let i=0;for(let n=t;n<o;n++)i+=r.get(n,t)*r.get(n,e);i=-i/r.get(t,t);for(let n=t;n<o;n++)r.set(n,e,r.get(n,e)+i*r.get(n,t))}d[e]=r.get(t,e)}if(h&&t<v)for(let e=t;e<o;e++)g.set(e,t,r.get(e,t));if(t<b){d[t]=0;for(let e=t+1;e<i;e++)d[t]=F(d[t],d[e]);if(0!==d[t]){d[t+1]<0&&(d[t]=0-d[t]);for(let e=t+1;e<i;e++)d[e]/=d[t];d[t+1]+=1}if(d[t]=-d[t],t+1<o&&0!==d[t]){for(let e=t+1;e<o;e++)w[e]=0;for(let e=t+1;e<o;e++)for(let o=t+1;o<i;o++)w[e]+=d[o]*r.get(e,o);for(let e=t+1;e<i;e++){let i=-d[e]/d[t+1];for(let n=t+1;n<o;n++)r.set(n,e,r.get(n,e)+i*w[n])}}if(u)for(let e=t+1;e<i;e++)p.set(e,t,d[e])}}let S=Math.min(i,o+1);if(v<i&&(m[v]=r.get(v,v)),o<S&&(m[S-1]=0),b+1<S&&(d[b]=r.get(b,S-1)),d[S-1]=0,h){for(let t=v;t<f;t++){for(let e=0;e<o;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=v-1;t>=0;t--)if(0!==m[t]){for(let e=t+1;e<f;e++){let r=0;for(let i=t;i<o;i++)r+=g.get(i,t)*g.get(i,e);r=-r/g.get(t,t);for(let i=t;i<o;i++)g.set(i,e,g.get(i,e)+r*g.get(i,t))}for(let e=t;e<o;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<o;e++)g.set(e,t,0);g.set(t,t,1)}}if(u)for(let t=i-1;t>=0;t--){if(t<b&&0!==d[t])for(let e=t+1;e<i;e++){let r=0;for(let o=t+1;o<i;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<i;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<i;e++)p.set(e,t,0);p.set(t,t,1)}let E=S-1,R=Number.EPSILON;for(;S>0;){let t,e;for(t=S-2;t>=-1&&-1!==t;t--){let e=Number.MIN_VALUE+R*Math.abs(m[t]+Math.abs(m[t+1]));if(Math.abs(d[t])<=e||Number.isNaN(d[t])){d[t]=0;break}}if(t===S-2)e=4;else{let r;for(r=S-1;r>=t&&r!==t;r--){let e=(r!==S?Math.abs(d[r]):0)+(r!==t+1?Math.abs(d[r-1]):0);if(Math.abs(m[r])<=R*e){m[r]=0;break}}r===t?e=3:r===S-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=d[S-2];d[S-2]=0;for(let r=S-2;r>=t;r--){let o=F(m[r],e),n=m[r]/o,s=e/o;if(m[r]=o,r!==t&&(e=-s*d[r-1],d[r-1]=n*d[r-1]),u)for(let t=0;t<i;t++)o=n*p.get(t,r)+s*p.get(t,S-1),p.set(t,S-1,-s*p.get(t,r)+n*p.get(t,S-1)),p.set(t,r,o)}break}case 2:{let e=d[t-1];d[t-1]=0;for(let r=t;r<S;r++){let i=F(m[r],e),n=m[r]/i,s=e/i;if(m[r]=i,e=-s*d[r],d[r]=n*d[r],h)for(let e=0;e<o;e++)i=n*g.get(e,r)+s*g.get(e,t-1),g.set(e,t-1,-s*g.get(e,r)+n*g.get(e,t-1)),g.set(e,r,i)}break}case 3:{let e=Math.max(Math.abs(m[S-1]),Math.abs(m[S-2]),Math.abs(d[S-2]),Math.abs(m[t]),Math.abs(d[t])),r=m[S-1]/e,n=m[S-2]/e,s=d[S-2]/e,a=m[t]/e,l=d[t]/e,f=((n+r)*(n-r)+s*s)/2,c=r*s*(r*s),w=0;(0!==f||0!==c)&&(w=f<0?0-Math.sqrt(f*f+c):Math.sqrt(f*f+c),w=c/(f+w));let y=(a+r)*(a-r)+w,v=a*l;for(let e=t;e<S-1;e++){let r=F(y,v);0===r&&(r=Number.MIN_VALUE);let n=y/r,s=v/r;if(e!==t&&(d[e-1]=r),y=n*m[e]+s*d[e],d[e]=n*d[e]-s*m[e],v=s*m[e+1],m[e+1]=n*m[e+1],u)for(let t=0;t<i;t++)r=n*p.get(t,e)+s*p.get(t,e+1),p.set(t,e+1,-s*p.get(t,e)+n*p.get(t,e+1)),p.set(t,e,r);if(0===(r=F(y,v))&&(r=Number.MIN_VALUE),n=y/r,s=v/r,m[e]=r,y=n*d[e]+s*m[e+1],m[e+1]=-s*d[e]+n*m[e+1],v=s*d[e+1],d[e+1]=n*d[e+1],h&&e<o-1)for(let t=0;t<o;t++)r=n*g.get(t,e)+s*g.get(t,e+1),g.set(t,e+1,-s*g.get(t,e)+n*g.get(t,e+1)),g.set(t,e,r)}d[S-2]=y;break}case 4:if(m[t]<=0&&(m[t]=m[t]<0?-m[t]:0,u))for(let e=0;e<=E;e++)p.set(e,t,-p.get(e,t));for(;t<E&&!(m[t]>=m[t+1]);){let e=m[t];if(m[t]=m[t+1],m[t+1]=e,u&&t<i-1)for(let r=0;r<i;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(h&&t<o-1)for(let r=0;r<o;r++)e=g.get(r,t+1),g.set(r,t+1,g.get(r,t)),g.set(r,t,e);t++}S--}}if(l){let t=p;p=g,g=t}this.m=o,this.n=i,this.s=m,this.U=g,this.V=p}solve(t){let e=this.threshold,r=this.s.length,o=M.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=e?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,n=this.rightSingularVectors,s=n.mmul(o),a=n.rows,h=i.rows,u=M.zeros(a,h);for(let t=0;t<a;t++)for(let e=0;e<h;e++){let o=0;for(let n=0;n<r;n++)o+=s.get(t,n)*i.get(e,n);u.set(t,e,o)}return u.mmul(t)}solveForDiagonal(t){return this.solve(M.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,o=t.columns,i=new M(r,this.s.length);for(let n=0;n<r;n++)for(let r=0;r<o;r++)Math.abs(this.s[r])>e&&i.set(n,r,t.get(n,r)/this.s[r]);let n=this.U,s=n.rows,a=n.columns,h=new M(r,s);for(let t=0;t<r;t++)for(let e=0;e<s;e++){let r=0;for(let o=0;o<a;o++)r+=i.get(t,o)*n.get(e,o);h.set(t,e,r)}return h}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let o=0,i=r.length;o<i;o++)r[o]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return M.diag(this.s)}}function q(t,e,r=!1){return(t=T.checkMatrix(t),e=T.checkMatrix(e),r)?new V(t).solve(e):t.isSquare()?new j(t).solve(e):new D(t).solve(e)}class L{constructor(t,e={}){let r,o;let{assumeSymmetric:i=!1}=e;if(!(t=T.checkMatrix(t)).isSquare())throw Error("Matrix is not a square matrix");if(t.isEmpty())throw Error("Matrix must be non-empty");let n=t.columns,s=new M(n,n),a=new Float64Array(n),h=new Float64Array(n),u=t;if(i||t.isSymmetric()){for(r=0;r<n;r++)for(o=0;o<n;o++)s.set(r,o,u.get(r,o));(function(t,e,r,o){let i,n,s,a,h,u,l,f;for(h=0;h<t;h++)r[h]=o.get(t-1,h);for(a=t-1;a>0;a--){for(u=0,f=0,s=0;u<a;u++)f+=Math.abs(r[u]);if(0===f)for(h=0,e[a]=r[a-1];h<a;h++)r[h]=o.get(a-1,h),o.set(a,h,0),o.set(h,a,0);else{for(u=0;u<a;u++)r[u]/=f,s+=r[u]*r[u];for(i=r[a-1],n=Math.sqrt(s),i>0&&(n=-n),e[a]=f*n,s-=i*n,r[a-1]=i-n,h=0;h<a;h++)e[h]=0;for(h=0;h<a;h++){for(i=r[h],o.set(h,a,i),n=e[h]+o.get(h,h)*i,u=h+1;u<=a-1;u++)n+=o.get(u,h)*r[u],e[u]+=o.get(u,h)*i;e[h]=n}for(h=0,i=0;h<a;h++)e[h]/=s,i+=e[h]*r[h];for(h=0,l=i/(s+s);h<a;h++)e[h]-=l*r[h];for(h=0;h<a;h++){for(i=r[h],n=e[h],u=h;u<=a-1;u++)o.set(u,h,o.get(u,h)-(i*e[u]+n*r[u]));r[h]=o.get(a-1,h),o.set(a,h,0)}}r[a]=s}for(a=0;a<t-1;a++){if(o.set(t-1,a,o.get(a,a)),o.set(a,a,1),0!==(s=r[a+1])){for(u=0;u<=a;u++)r[u]=o.get(u,a+1)/s;for(h=0;h<=a;h++){for(u=0,n=0;u<=a;u++)n+=o.get(u,a+1)*o.get(u,h);for(u=0;u<=a;u++)o.set(u,h,o.get(u,h)-n*r[u])}}for(u=0;u<=a;u++)o.set(u,a+1,0)}for(h=0;h<t;h++)r[h]=o.get(t-1,h),o.set(t-1,h,0);o.set(t-1,t-1,1),e[0]=0})(n,h,a,s),function(t,e,r,o){let i,n,s,a,h,u,l,f,c,m,g,p,d,w,y,v;for(s=1;s<t;s++)e[s-1]=e[s];e[t-1]=0;let b=0,M=0,x=Number.EPSILON;for(u=0;u<t;u++){for(M=Math.max(M,Math.abs(r[u])+Math.abs(e[u])),l=u;l<t&&!(Math.abs(e[l])<=x*M);)l++;if(l>u)do{for(i=r[u],c=F(f=(r[u+1]-i)/(2*e[u]),1),f<0&&(c=-c),r[u]=e[u]/(f+c),r[u+1]=e[u]*(f+c),m=r[u+1],n=i-r[u],s=u+2;s<t;s++)r[s]-=n;for(b+=n,f=r[l],p=g=1,d=g,w=e[u+1],y=0,v=0,s=l-1;s>=u;s--)for(h=0,d=p,p=g,v=y,i=g*e[s],n=g*f,c=F(f,e[s]),e[s+1]=y*c,y=e[s]/c,f=(g=f/c)*r[s]-y*i,r[s+1]=n+y*(g*i+y*r[s]);h<t;h++)n=o.get(h,s+1),o.set(h,s+1,y*o.get(h,s)+g*n),o.set(h,s,g*o.get(h,s)-y*n);f=-y*v*d*w*e[u]/m,e[u]=y*f,r[u]=g*f}while(Math.abs(e[u])>x*M);r[u]=r[u]+b,e[u]=0}for(s=0;s<t-1;s++){for(h=s,f=r[s],a=s+1;a<t;a++)r[a]<f&&(h=a,f=r[a]);if(h!==s)for(a=0,r[h]=r[s],r[s]=f;a<t;a++)f=o.get(a,s),o.set(a,s,o.get(a,h)),o.set(a,h,f)}}(n,h,a,s)}else{let t=new M(n,n),e=new Float64Array(n);for(o=0;o<n;o++)for(r=0;r<n;r++)t.set(r,o,u.get(r,o));(function(t,e,r,o){let i,n,s,a,h,u,l;let f=t-1;for(u=1;u<=f-1;u++){for(l=0,a=u;a<=f;a++)l+=Math.abs(e.get(a,u-1));if(0!==l){for(s=0,a=f;a>=u;a--)r[a]=e.get(a,u-1)/l,s+=r[a]*r[a];for(n=Math.sqrt(s),r[u]>0&&(n=-n),s-=r[u]*n,r[u]=r[u]-n,h=u;h<t;h++){for(i=0,a=f;a>=u;a--)i+=r[a]*e.get(a,h);for(i/=s,a=u;a<=f;a++)e.set(a,h,e.get(a,h)-i*r[a])}for(a=0;a<=f;a++){for(i=0,h=f;h>=u;h--)i+=r[h]*e.get(a,h);for(i/=s,h=u;h<=f;h++)e.set(a,h,e.get(a,h)-i*r[h])}r[u]=l*r[u],e.set(u,u-1,l*n)}}for(a=0;a<t;a++)for(h=0;h<t;h++)o.set(a,h,a===h?1:0);for(u=f-1;u>=1;u--)if(0!==e.get(u,u-1)){for(a=u+1;a<=f;a++)r[a]=e.get(a,u-1);for(h=u;h<=f;h++){for(n=0,a=u;a<=f;a++)n+=r[a]*o.get(a,h);for(n=n/r[u]/e.get(u,u-1),a=u;a<=f;a++)o.set(a,h,o.get(a,h)+n*r[a])}}})(n,t,e,s),function(t,e,r,o,i){let n,s,a,h,u,l,f,c,m,g,p,d,w,y,v,b=t-1,M=t-1,x=Number.EPSILON,S=0,E=0,R=0,k=0,N=0,z=0,_=0,A=0;for(n=0;n<t;n++)for((n<0||n>M)&&(r[n]=i.get(n,n),e[n]=0),s=Math.max(n-1,0);s<t;s++)E+=Math.abs(i.get(n,s));for(;b>=0;){for(h=b;h>0&&(0===(z=Math.abs(i.get(h-1,h-1))+Math.abs(i.get(h,h)))&&(z=E),!(Math.abs(i.get(h,h-1))<x*z));)h--;if(h===b)i.set(b,b,i.get(b,b)+S),r[b]=i.get(b,b),e[b]=0,b--,A=0;else if(h===b-1){if(f=i.get(b,b-1)*i.get(b-1,b),_=Math.sqrt(Math.abs(k=(R=(i.get(b-1,b-1)-i.get(b,b))/2)*R+f)),i.set(b,b,i.get(b,b)+S),i.set(b-1,b-1,i.get(b-1,b-1)+S),c=i.get(b,b),k>=0){for(_=R>=0?R+_:R-_,r[b-1]=c+_,r[b]=r[b-1],0!==_&&(r[b]=c-f/_),e[b-1]=0,e[b]=0,z=Math.abs(c=i.get(b,b-1))+Math.abs(_),N=Math.sqrt((R=c/z)*R+(k=_/z)*k),R/=N,k/=N,s=b-1;s<t;s++)_=i.get(b-1,s),i.set(b-1,s,k*_+R*i.get(b,s)),i.set(b,s,k*i.get(b,s)-R*_);for(n=0;n<=b;n++)_=i.get(n,b-1),i.set(n,b-1,k*_+R*i.get(n,b)),i.set(n,b,k*i.get(n,b)-R*_);for(n=0;n<=M;n++)_=o.get(n,b-1),o.set(n,b-1,k*_+R*o.get(n,b)),o.set(n,b,k*o.get(n,b)-R*_)}else r[b-1]=c+R,r[b]=c+R,e[b-1]=_,e[b]=-_;b-=2,A=0}else{if(c=i.get(b,b),m=0,f=0,h<b&&(m=i.get(b-1,b-1),f=i.get(b,b-1)*i.get(b-1,b)),10===A){for(S+=c,n=0;n<=b;n++)i.set(n,n,i.get(n,n)-c);c=m=.75*(z=Math.abs(i.get(b,b-1))+Math.abs(i.get(b-1,b-2))),f=-.4375*z*z}if(30===A&&(z=(z=(m-c)/2)*z+f)>0){for(z=Math.sqrt(z),m<c&&(z=-z),z=c-f/((m-c)/2+z),n=0;n<=b;n++)i.set(n,n,i.get(n,n)-z);S+=z,c=m=f=.964}for(A+=1,u=b-2;u>=h&&(z=Math.abs(R=((N=c-(_=i.get(u,u)))*(z=m-_)-f)/i.get(u+1,u)+i.get(u,u+1))+Math.abs(k=i.get(u+1,u+1)-_-N-z)+Math.abs(N=i.get(u+2,u+1)),R/=z,k/=z,N/=z,!(u===h||Math.abs(i.get(u,u-1))*(Math.abs(k)+Math.abs(N))<Math.abs(R)*(Math.abs(i.get(u-1,u-1))+Math.abs(_)+Math.abs(i.get(u+1,u+1)))*x));)u--;for(n=u+2;n<=b;n++)i.set(n,n-2,0),n>u+2&&i.set(n,n-3,0);for(a=u;a<=b-1&&(y=a!==b-1,a!==u&&0!==(c=Math.abs(R=i.get(a,a-1))+Math.abs(k=i.get(a+1,a-1))+Math.abs(N=y?i.get(a+2,a-1):0))&&(R/=c,k/=c,N/=c),0!==c);a++)if(z=Math.sqrt(R*R+k*k+N*N),R<0&&(z=-z),0!==z){for(a!==u?i.set(a,a-1,-z*c):h!==u&&i.set(a,a-1,-i.get(a,a-1)),R+=z,c=R/z,m=k/z,_=N/z,k/=R,N/=R,s=a;s<t;s++)R=i.get(a,s)+k*i.get(a+1,s),y&&(R+=N*i.get(a+2,s),i.set(a+2,s,i.get(a+2,s)-R*_)),i.set(a,s,i.get(a,s)-R*c),i.set(a+1,s,i.get(a+1,s)-R*m);for(n=0;n<=Math.min(b,a+3);n++)R=c*i.get(n,a)+m*i.get(n,a+1),y&&(R+=_*i.get(n,a+2),i.set(n,a+2,i.get(n,a+2)-R*N)),i.set(n,a,i.get(n,a)-R),i.set(n,a+1,i.get(n,a+1)-R*k);for(n=0;n<=M;n++)R=c*o.get(n,a)+m*o.get(n,a+1),y&&(R+=_*o.get(n,a+2),o.set(n,a+2,o.get(n,a+2)-R*N)),o.set(n,a,o.get(n,a)-R),o.set(n,a+1,o.get(n,a+1)-R*k)}}}if(0!==E){for(b=t-1;b>=0;b--)if(R=r[b],0===(k=e[b]))for(h=b,i.set(b,b,1),n=b-1;n>=0;n--){for(f=i.get(n,n)-R,N=0,s=h;s<=b;s++)N+=i.get(n,s)*i.get(s,b);if(e[n]<0)_=f,z=N;else if(h=n,0===e[n]?i.set(n,b,0!==f?-N/f:-N/(x*E)):(c=i.get(n,n+1),m=i.get(n+1,n),l=(c*z-_*N)/(k=(r[n]-R)*(r[n]-R)+e[n]*e[n]),i.set(n,b,l),i.set(n+1,b,Math.abs(c)>Math.abs(_)?(-N-f*l)/c:(-z-m*l)/_)),x*(l=Math.abs(i.get(n,b)))*l>1)for(s=n;s<=b;s++)i.set(s,b,i.get(s,b)/l)}else if(k<0)for(h=b-1,Math.abs(i.get(b,b-1))>Math.abs(i.get(b-1,b))?(i.set(b-1,b-1,k/i.get(b,b-1)),i.set(b-1,b,-(i.get(b,b)-R)/i.get(b,b-1))):(v=U(0,-i.get(b-1,b),i.get(b-1,b-1)-R,k),i.set(b-1,b-1,v[0]),i.set(b-1,b,v[1])),i.set(b,b-1,0),i.set(b,b,1),n=b-2;n>=0;n--){for(g=0,p=0,s=h;s<=b;s++)g+=i.get(n,s)*i.get(s,b-1),p+=i.get(n,s)*i.get(s,b);if(f=i.get(n,n)-R,e[n]<0)_=f,N=g,z=p;else if(h=n,0===e[n]?(v=U(-g,-p,f,k),i.set(n,b-1,v[0]),i.set(n,b,v[1])):(c=i.get(n,n+1),m=i.get(n+1,n),d=(r[n]-R)*(r[n]-R)+e[n]*e[n]-k*k,w=(r[n]-R)*2*k,0===d&&0===w&&(d=x*E*(Math.abs(f)+Math.abs(k)+Math.abs(c)+Math.abs(m)+Math.abs(_))),v=U(c*N-_*g+k*p,c*z-_*p-k*g,d,w),i.set(n,b-1,v[0]),i.set(n,b,v[1]),Math.abs(c)>Math.abs(_)+Math.abs(k)?(i.set(n+1,b-1,(-g-f*i.get(n,b-1)+k*i.get(n,b))/c),i.set(n+1,b,(-p-f*i.get(n,b)-k*i.get(n,b-1))/c)):(v=U(-N-m*i.get(n,b-1),-z-m*i.get(n,b),_,k),i.set(n+1,b-1,v[0]),i.set(n+1,b,v[1]))),x*(l=Math.max(Math.abs(i.get(n,b-1)),Math.abs(i.get(n,b))))*l>1)for(s=n;s<=b;s++)i.set(s,b-1,i.get(s,b-1)/l),i.set(s,b,i.get(s,b)/l)}for(n=0;n<t;n++)if(n<0||n>M)for(s=n;s<t;s++)o.set(n,s,i.get(n,s));for(s=t-1;s>=0;s--)for(n=0;n<=M;n++){for(a=0,_=0;a<=Math.min(s,M);a++)_+=o.get(n,a)*i.get(a,s);o.set(n,s,_)}}}(n,h,a,s,t)}this.n=n,this.e=h,this.d=a,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,r=this.n,o=this.e,i=this.d,n=new M(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)n.set(t,e,0);n.set(t,t,i[t]),o[t]>0?n.set(t,t+1,o[t]):o[t]<0&&n.set(t,t-1,o[t])}return n}}function U(t,e,r,o){let i,n;return Math.abs(r)>Math.abs(o)?(i=o/r,n=r+i*o,[(t+i*e)/n,(e-i*t)/n]):(i=r/o,n=o+i*r,[(i*t+e)/n,(i*e-t)/n])}class H{constructor(t){let e,r,o;if(!(t=T.checkMatrix(t)).isSymmetric())throw Error("Matrix is not symmetric");let i=t,n=i.rows,s=new M(n,n),a=!0;for(r=0;r<n;r++){let t=0;for(o=0;o<r;o++){let n=0;for(e=0;e<o;e++)n+=s.get(o,e)*s.get(r,e);n=(i.get(r,o)-n)/s.get(o,o),s.set(r,o,n),t+=n*n}for(a&=(t=i.get(r,r)-t)>0,s.set(r,r,Math.sqrt(Math.max(t,0))),o=r+1;o<n;o++)s.set(r,o,0)}this.L=s,this.positiveDefinite=!!a}isPositiveDefinite(){return this.positiveDefinite}solve(t){let e,r,o;t=T.checkMatrix(t);let i=this.L,n=i.rows;if(t.rows!==n)throw Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw Error("Matrix is not positive definite");let s=t.columns,a=t.clone();for(o=0;o<n;o++)for(r=0;r<s;r++){for(e=0;e<o;e++)a.set(o,r,a.get(o,r)-a.get(e,r)*i.get(o,e));a.set(o,r,a.get(o,r)/i.get(o,o))}for(o=n-1;o>=0;o--)for(r=0;r<s;r++){for(e=o+1;e<n;e++)a.set(o,r,a.get(o,r)-a.get(e,r)*i.get(e,o));a.set(o,r,a.get(o,r)/i.get(o,o))}return a}get lowerTriangularMatrix(){return this.L}}class ${constructor(t,e={}){let r,i,n,s,a;t=T.checkMatrix(t);let{Y:h}=e,{scaleScores:u=!1,maxIterations:l=1e3,terminationCriteria:f=1e-10}=e;if(h){if((h=o.isAnyArray(h)&&"number"==typeof h[0]?M.columnVector(h):T.checkMatrix(h)).rows!==t.rows)throw Error("Y should have the same number of rows as X");r=h.getColumnVector(0)}else r=t.getColumnVector(0);let c=1;for(let e=0;e<l&&c>f;e++)s=(s=t.transpose().mmul(r).div(r.transpose().mmul(r).get(0,0))).div(s.norm()),i=t.mmul(s).div(s.transpose().mmul(s).get(0,0)),e>0&&(c=i.clone().sub(a).pow(2).sum()),a=i.clone(),h?(n=(n=h.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0))).div(n.norm()),r=h.mmul(n).div(n.transpose().mmul(n).get(0,0))):r=i;if(h){let e=t.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0));e=e.div(e.norm());let o=t.clone().sub(i.clone().mmul(e.transpose())),a=r.transpose().mmul(i).div(i.transpose().mmul(i).get(0,0)),u=h.clone().sub(i.clone().mulS(a.get(0,0)).mmul(n.transpose()));this.t=i,this.p=e.transpose(),this.w=s.transpose(),this.q=n,this.u=r,this.s=i.transpose().mmul(i),this.xResidual=o,this.yResidual=u,this.betas=a}else this.w=s.transpose(),this.s=i.transpose().mmul(i).sqrt(),u?this.t=i.clone().div(this.s.get(0,0)):this.t=i,this.xResidual=t.sub(i.mmul(s.transpose()))}}e.XA=v,e.a_=H,e.yQ=H,e.Hs=S,e.Ec=L,e.dx=L,e.LU=j,e.Rm=j,e.y3=M,e.qK=k,e.pb=R,e.j=N,e.sO=z,e.BZ=A,e.EK=_,e.Db=P,e.Fx=I,e.tU=O,e.Ym=$,e.rs=$,e.QR=D,e.TB=D,e.oH=V,e.Sc=V,e.BN=x,e.it=C,e.$r=T,e.QM=function(t,e=t,r={}){t=new M(t);let i=!1;if("object"!=typeof e||M.isMatrix(e)||o.isAnyArray(e)?e=new M(e):(r=e,e=t,i=!0),t.rows!==e.rows)throw TypeError("Both matrices must have the same number of rows");let{center:n=!0,scale:s=!0}=r;n&&(t.center("column"),i||e.center("column")),s&&(t.scale("column"),i||e.scale("column"));let a=t.standardDeviation("column",{unbiased:!0}),h=i?a:e.standardDeviation("column",{unbiased:!0}),u=t.transpose().mmul(e);for(let e=0;e<u.rows;e++)for(let r=0;r<u.columns;r++)u.set(e,r,u.get(e,r)*(1/(a[e]*h[r]))*(1/(t.rows-1)));return u},e.AV=function(t,e=t,r={}){t=new M(t);let i=!1;if("object"!=typeof e||M.isMatrix(e)||o.isAnyArray(e)?e=new M(e):(r=e,e=t,i=!0),t.rows!==e.rows)throw TypeError("Both matrices must have the same number of rows");let{center:n=!0}=r;n&&(t=t.center("column"),i||(e=e.center("column")));let s=t.transpose().mmul(e);for(let e=0;e<s.rows;e++)for(let r=0;r<s.columns;r++)s.set(e,r,s.get(e,r)*(1/(t.rows-1)));return s},e.GH=function t(e){if((e=M.checkMatrix(e)).isSquare()){let r,o,i;if(0===e.columns)return 1;if(2===e.columns)return r=e.get(0,0),o=e.get(0,1),i=e.get(1,0),r*e.get(1,1)-o*i;if(3!==e.columns)return new j(e).determinant;{let n,s,a;return n=new P(e,[1,2],[1,2]),s=new P(e,[1,2],[0,2]),a=new P(e,[1,2],[0,1]),r=e.get(0,0),o=e.get(0,1),i=e.get(0,2),r*t(n)-o*t(s)+i*t(a)}}throw Error("determinant can only be calculated for a square matrix")},e.SO=function(t,e=!1){return(t=T.checkMatrix(t),e)?new V(t).inverse():q(t,M.eye(t.rows))},e.uZ=function(t,e={}){let{thresholdValue:r=1e-9,thresholdError:o=1e-9}=e,i=(t=M.checkMatrix(t)).rows,n=new M(i,i);for(let e=0;e<i;e++){let s=M.columnVector(t.getRow(e)),a=t.subMatrixRow(function(t,e){let r=[];for(let o=0;o<t;o++)o!==e&&r.push(o);return r}(i,e)).transpose(),h=new V(a).solve(s),u=M.sub(s,a.mmul(h)).abs().max();n.setRow(e,function(t,e,r,o=1e-9,i=1e-9){if(t>i)return Array(e.rows+1).fill(0);{let t=e.addRow(r,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<o&&t.set(e,0,0);return t.to1DArray()}}(u,h,e,r,o))}return n},e.yU=function(t,e=Number.EPSILON){if((t=M.checkMatrix(t)).isEmpty())return t.transpose();let r=new V(t,{autoTranspose:!0}),o=r.leftSingularVectors,i=r.rightSingularVectors,n=r.diagonal;for(let t=0;t<n.length;t++)Math.abs(n[t])>e?n[t]=1/n[t]:n[t]=0;return i.mmul(M.diag(n).mmul(o.transpose()))},e.F1=q,e.re=function(t,e){if(o.isAnyArray(t))return t[0]&&o.isAnyArray(t[0])?new T(t):new C(t,e);throw Error("the argument is not an array")}},19068:function(t,e,r){"use strict";r.r(e),r.d(e,{isAnyArray:function(){return i}});let o=Object.prototype.toString;function i(t){let e=o.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},99949:function(t,e,r){"use strict";var o=r(88877);function i(){}function n(){}n.resetWarningCache=i,t.exports=function(){function t(t,e,r,i,n,s){if(s!==o){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:n,resetWarningCache:i};return r.PropTypes=r,r}},41448:function(t,e,r){t.exports=r(99949)()},88877:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},86108:function(t,e,r){"use strict";function o(t){return(o="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)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(a,e);var r,i,s=(r=function(){if("undefined"==typeof Reflect||!Reflect.construct||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}}(),function(){var t,e=l(a);return t=r?Reflect.construct(e,arguments,l(this).constructor):e.apply(this,arguments),function(t,e){if(e&&("object"===o(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return u(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,a),(e=s.call(this,t)).p=Promise.resolve(),e.resizeHandler=null,e.handlers={},e.syncWindowResize=e.syncWindowResize.bind(u(e)),e.syncEventHandlers=e.syncEventHandlers.bind(u(e)),e.attachUpdateEvents=e.attachUpdateEvents.bind(u(e)),e.getRef=e.getRef.bind(u(e)),e.handleUpdate=e.handleUpdate.bind(u(e)),e.figureCallback=e.figureCallback.bind(u(e)),e.updatePlotly=e.updatePlotly.bind(u(e)),e}return i=[{key:"updatePlotly",value:function(e,r,o){var i=this;this.p=this.p.then(function(){if(!i.unmounting){if(!i.el)throw Error("Missing element reference");return t.react(i.el,{data:i.props.data,layout:i.props.layout,config:i.props.config,frames:i.props.frames})}}).then(function(){!i.unmounting&&(i.syncWindowResize(e),i.syncEventHandlers(),i.figureCallback(r),o&&i.attachUpdateEvents())}).catch(function(t){i.props.onError&&i.props.onError(t)})}},{key:"componentDidMount",value:function(){this.unmounting=!1,this.updatePlotly(!0,this.props.onInitialized,!0)}},{key:"componentDidUpdate",value:function(t){this.unmounting=!1;var e=t.frames&&t.frames.length?t.frames.length:0,r=this.props.frames&&this.props.frames.length?this.props.frames.length:0,o=!(t.layout===this.props.layout&&t.data===this.props.data&&t.config===this.props.config&&r===e),i=void 0!==t.revision,n=t.revision!==this.props.revision;(o||i&&(!i||n))&&this.updatePlotly(!1,this.props.onUpdate,!1)}},{key:"componentWillUnmount",value:function(){this.unmounting=!0,this.figureCallback(this.props.onPurge),this.resizeHandler&&m&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null),this.removeUpdateEvents(),t.purge(this.el)}},{key:"attachUpdateEvents",value:function(){var t=this;this.el&&this.el.removeListener&&c.forEach(function(e){t.el.on(e,t.handleUpdate)})}},{key:"removeUpdateEvents",value:function(){var t=this;this.el&&this.el.removeListener&&c.forEach(function(e){t.el.removeListener(e,t.handleUpdate)})}},{key:"handleUpdate",value:function(){this.figureCallback(this.props.onUpdate)}},{key:"figureCallback",value:function(t){if("function"==typeof t){var e=this.el;t({data:e.data,layout:e.layout,frames:this.el._transitionData?this.el._transitionData._frames:null},this.el)}}},{key:"syncWindowResize",value:function(e){var r=this;m&&(this.props.useResizeHandler&&!this.resizeHandler?(this.resizeHandler=function(){return t.Plots.resize(r.el)},window.addEventListener("resize",this.resizeHandler),e&&this.resizeHandler()):!this.props.useResizeHandler&&this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null))}},{key:"getRef",value:function(t){this.el=t,this.props.debug&&m&&(window.gd=this.el)}},{key:"syncEventHandlers",value:function(){var t=this;f.forEach(function(e){var r=t.props["on"+e],o=t.handlers[e],i=!!o;r&&!i?t.addEventHandler(e,r):!r&&i?t.removeEventHandler(e):r&&i&&r!==o&&(t.removeEventHandler(e),t.addEventHandler(e,r))})}},{key:"addEventHandler",value:function(t,e){this.handlers[t]=e,this.el.on(this.getPlotlyEventName(t),this.handlers[t])}},{key:"removeEventHandler",value:function(t){this.el.removeListener(this.getPlotlyEventName(t),this.handlers[t]),delete this.handlers[t]}},{key:"getPlotlyEventName",value:function(t){return"plotly_"+t.toLowerCase()}},{key:"render",value:function(){return n.default.createElement("div",{id:this.props.divId,style:this.props.style,ref:this.getRef,className:this.props.className})}}],function(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(a.prototype,i),Object.defineProperty(a,"prototype",{writable:!1}),a}(n.Component);return e.propTypes={data:s.default.arrayOf(s.default.object),config:s.default.object,layout:s.default.object,frames:s.default.arrayOf(s.default.object),revision:s.default.number,onInitialized:s.default.func,onPurge:s.default.func,onError:s.default.func,onUpdate:s.default.func,debug:s.default.bool,style:s.default.object,className:s.default.string,useResizeHandler:s.default.bool,divId:s.default.string},f.forEach(function(t){e.propTypes["on"+t]=s.default.func}),e.defaultProps={debug:!1,useResizeHandler:!1,data:[],style:{position:"relative",display:"inline-block"}},e};var i,n=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!==o(t)&&"function"!=typeof t)return{default:t};var r=a(void 0);if(r&&r.has(t))return r.get(t);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var h=n?Object.getOwnPropertyDescriptor(t,s):null;h&&(h.get||h.set)?Object.defineProperty(i,s,h):i[s]=t[s]}return i.default=t,r&&r.set(t,i),i}(r(2265)),s=(i=r(41448))&&i.__esModule?i:{default:i};function a(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(a=function(t){return t?r:e})(t)}function h(t,e){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=["AfterExport","AfterPlot","Animated","AnimatingFrame","AnimationInterrupted","AutoSize","BeforeExport","BeforeHover","ButtonClicked","Click","ClickAnnotation","Deselect","DoubleClick","Framework","Hover","LegendClick","LegendDoubleClick","Relayout","Relayouting","Restyle","Redraw","Selected","Selecting","SliderChange","SliderEnd","SliderStart","SunburstClick","Transitioning","TransitionInterrupted","Unhover","WebGlContextLost"],c=["plotly_restyle","plotly_redraw","plotly_relayout","plotly_relayouting","plotly_doubleclick","plotly_animated","plotly_sunburstclick"],m="undefined"!=typeof window},42008:function(t,e,r){"use strict";e.Z=void 0;var o=n(r(86108)),i=n(r(33773));function n(t){return t&&t.__esModule?t:{default:t}}var s=(0,o.default)(i.default);e.Z=s},35230:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.smallestFlagged=e.deheapSort=e.buildCandidates=e.uncheckedHeapPush=e.heapPush=e.rejectionSample=e.makeHeap=void 0;var s=n(r(10006));function a(t,e){var r=function(r){return s.empty(t).map(function(){return s.filled(e,r)})},o=[];return o.push(r(-1)),o.push(r(1/0)),o.push(r(0)),o}function h(t,e,r,o,i){e=Math.floor(e);var n=t[0][e],s=t[1][e];if(t[2][e],r>=s[0])return 0;for(var a=0;a<n.length;a++)if(o===n[a])return 0;return u(t,e,r,o,i)}function u(t,e,r,o,i){var n=t[0][e],s=t[1][e],a=t[2][e];if(r>=s[0])return 0;s[0]=r,n[0]=o,a[0]=i;for(var h=0,u=0;;){var l=2*h+1,f=l+1,c=t[0][0].length;if(l>=c)break;if(f>=c){if(s[l]>r)u=l;else break}else if(s[l]>=s[f]){if(r<s[l])u=l;else break}else if(r<s[f])u=f;else break;s[h]=s[u],n[h]=n[u],a[h]=a[u],h=u}return s[h]=r,n[h]=o,a[h]=i,1}e.makeHeap=a,e.rejectionSample=function(t,e,r){for(var o=s.zeros(t),i=0;i<t;i++){for(var n=!0,a=0;n;){a=s.tauRandInt(e,r);for(var h=!1,u=0;u<i;u++)if(a===o[u]){h=!0;break}h||(n=!1)}o[i]=a}return o},e.heapPush=h,e.uncheckedHeapPush=u,e.buildCandidates=function(t,e,r,o,i){for(var n=a(e,o),u=0;u<e;u++)for(var l=0;l<r;l++)if(!(t[0][u][l]<0)){var f=t[0][u][l],c=t[2][u][l],m=s.tauRand(i);h(n,u,m,f,c),h(n,f,m,u,c),t[2][u][l]=0}return n},e.deheapSort=function(t){for(var e=t[0],r=t[1],o=0;o<e.length;o++)for(var i=e[o],n=r[o],s=0;s<i.length-1;s++){var a=i.length-s-1,h=n.length-s-1,u=i[0];i[0]=i[a],i[a]=u;var l=n[0];n[0]=n[h],n[h]=l,function(t,e,r,o){for(;2*o+1<r;){var i=2*o+1,n=i+1,s=o;if(t[s]<t[i]&&(s=i),n<r&&t[s]<t[n]&&(s=n),s===o)break;var a=t[o];t[o]=t[s],t[s]=a;var h=e[o];e[o]=e[s],e[s]=h,o=s}}(n,i,h,0)}return{indices:e,weights:r}},e.smallestFlagged=function(t,e){for(var r=t[0][e],o=t[1][e],i=t[2][e],n=1/0,s=-1,a=0;a>r.length;a++)1===i[a]&&o[a]<n&&(n=o[a],s=a);return s>=0?(i[s]=0,Math.floor(r[s])):-1}},5778:function(t,e,r){"use strict";var o=r(28158);Object.defineProperty(e,"u",{enumerable:!0,get:function(){return o.UMAP}})},78965:function(t,e,r){"use strict";var o,i=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),n=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&i(e,t,r);return n(e,t),e},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,i,n=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},h=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.getCSR=e.normalize=e.eliminateZeros=e.multiplyScalar=e.maximum=e.subtract=e.add=e.pairwiseMultiply=e.identity=e.transpose=e.SparseMatrix=void 0;var u=s(r(10006)),l=function(){function t(t,e,r,o){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==r.length)throw Error("rows, cols and values arrays must all have the same length");this.nRows=o[0],this.nCols=o[1];for(var i=0;i<r.length;i++){var n=t[i],s=e[i];this.checkDims(n,s);var a=this.makeKey(n,s);this.entries.set(a,{value:r[i],row:n,col:s})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,r){this.checkDims(t,e);var o=this.makeKey(t,e);this.entries.has(o)?this.entries.get(o).value=r:this.entries.set(o,{value:r,row:t,col:e})},t.prototype.get=function(t,e,r){void 0===r&&(r=0),this.checkDims(t,e);var o=this.makeKey(t,e);return this.entries.has(o)?this.entries.get(o).value:r},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach(function(t){e.push(t)}),t&&e.sort(function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,function(t){var e=a(t,2);return(e[0],e[1]).row})},t.prototype.getCols=function(){return Array.from(this.entries,function(t){var e=a(t,2);return(e[0],e[1]).col})},t.prototype.getValues=function(){return Array.from(this.entries,function(t){var e=a(t,2);return(e[0],e[1]).value})},t.prototype.forEach=function(t){this.entries.forEach(function(e){return t(e.value,e.row,e.col)})},t.prototype.map=function(e){var r=[];this.entries.forEach(function(t){r.push(e(t.value,t.row,t.col))});var o=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),r,o)},t.prototype.toArray=function(){var t=this,e=u.empty(this.nRows).map(function(){return u.zeros(t.nCols)});return this.entries.forEach(function(t){e[t.row][t.col]=t.value}),e},t}();e.SparseMatrix=l,e.transpose=function(t){var e=[],r=[],o=[];return t.forEach(function(t,i,n){e.push(i),r.push(n),o.push(t)}),new l(r,e,o,[t.nCols,t.nRows])},e.identity=function(t){for(var e=a(t,1)[0],r=new l([],[],[],t),o=0;o<e;o++)r.set(o,o,1);return r},e.pairwiseMultiply=function(t,e){return c(t,e,function(t,e){return t*e})},e.add=function(t,e){return c(t,e,function(t,e){return t+e})},e.subtract=function(t,e){return c(t,e,function(t,e){return t-e})},e.maximum=function(t,e){return c(t,e,function(t,e){return t>e?t:e})},e.multiplyScalar=function(t,e){return t.map(function(t){return t*e})},e.eliminateZeros=function(t){for(var e=new Set,r=t.getValues(),o=t.getRows(),i=t.getCols(),n=0;n<r.length;n++)0===r[n]&&e.add(n);var s=function(t,r){return!e.has(r)},a=r.filter(s);return new l(o.filter(s),i.filter(s),a,t.getDims())},e.normalize=function(t,e){void 0===e&&(e="l2");var r,o,i=f[e],n=new Map;t.forEach(function(t,e,r){var o=n.get(e)||[];o.push(r),n.set(e,o)});var s=new l([],[],[],t.getDims()),a=function(e){for(var r=n.get(e).sort(),o=i(r.map(function(r){return t.get(e,r)})),a=0;a<o.length;a++)s.set(e,r[a],o[a])};try{for(var u=h(n.keys()),c=u.next();!c.done;c=u.next()){var m=c.value;a(m)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return s};var f=((o={}).max=function(t){for(var e=-1/0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return t.map(function(t){return t/e})},o.l1=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r];return t.map(function(t){return t/e})},o.l2=function(t){for(var e=0,r=0;r<t.length;r++)e+=Math.pow(t[r],2);return t.map(function(t){return Math.sqrt(Math.pow(t,2)/e)})},o);function c(t,e,r){for(var o=new Set,i=[],n=[],s=[],a=function(o,a){i.push(o),n.push(a);var h=r(t.get(o,a),e.get(o,a));s.push(h)},h=t.getValues(),u=t.getRows(),f=t.getCols(),c=0;c<h.length;c++){var m=u[c],g=f[c],p=m+":"+g;o.add(p),a(m,g)}for(var d=e.getValues(),w=e.getRows(),y=e.getCols(),c=0;c<d.length;c++){var m=w[c],g=y[c],p=m+":"+g;o.has(p)||a(m,g)}return new l(i,n,s,[t.nRows,t.nCols])}e.getCSR=function(t){var e=[];t.forEach(function(t,r,o){e.push({value:t,row:r,col:o})}),e.sort(function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row});for(var r=[],o=[],i=[],n=-1,s=0;s<e.length;s++){var a=e[s],h=a.row,u=a.col,l=a.value;h!==n&&(n=h,i.push(s)),r.push(u),o.push(l)}return{indices:r,values:o,indptr:i}}},95502:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.initializeSearch=e.makeInitializedNNSearch=e.makeInitializations=e.makeNNDescent=void 0;var a=n(r(35230)),h=n(r(78965)),u=n(r(50993)),l=n(r(10006));e.makeNNDescent=function(t,e){return function(r,o,i,n,s,h,u,f){void 0===n&&(n=10),void 0===s&&(s=50),void 0===h&&(h=.001),void 0===u&&(u=.5),void 0===f&&(f=!0);for(var c=r.length,m=a.makeHeap(r.length,i),g=0;g<r.length;g++)for(var p=a.rejectionSample(i,r.length,e),d=0;d<p.length;d++){var w=t(r[g],r[p[d]]);a.heapPush(m,g,w,p[d],1),a.heapPush(m,p[d],w,g,1)}if(f)for(var y=0;y<o.length;y++)for(var g=0;g<o[y].length&&!(o[y][g]<0);g++)for(var d=g+1;d<o[y].length&&!(o[y][d]<0);d++){var w=t(r[o[y][g]],r[o[y][d]]);a.heapPush(m,o[y][g],w,o[y][d],1),a.heapPush(m,o[y][d],w,o[y][g],1)}for(var y=0;y<n;y++){for(var v=a.buildCandidates(m,c,i,s,e),b=0,g=0;g<c;g++)for(var d=0;d<s;d++){var M=Math.floor(v[0][g][d]);if(!(M<0||l.tauRand(e)<u))for(var x=0;x<s;x++){var S=Math.floor(v[0][g][x]),E=v[2][g][d],R=v[2][g][x];if(!(S<0)&&(E||R)){var w=t(r[M],r[S]);b+=a.heapPush(m,M,w,S,1)+a.heapPush(m,S,w,M,1)}}}if(b<=h*i*r.length)break}return a.deheapSort(m)}},e.makeInitializations=function(t){return{initFromRandom:function(e,r,o,i,n){for(var s=0;s<o.length;s++)for(var h=l.rejectionSample(e,r.length,n),u=0;u<h.length;u++)if(!(h[u]<0)){var f=t(r[h[u]],o[s]);a.heapPush(i,s,f,h[u],1)}},initFromTree:function(e,r,o,i,n){for(var s=0;s<o.length;s++)for(var h=u.searchFlatTree(o[s],e,n),l=0;l<h.length;l++){if(h[l]<0)return;var f=t(r[h[l]],o[s]);a.heapPush(i,s,f,h[l],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,r,o,i){for(var n,u,l=h.getCSR(r),f=l.indices,c=l.indptr,m=0;m<i.length;m++)for(var g=new Set(o[0][m]);;){var p=a.smallestFlagged(o,m);if(-1===p)break;var d=f.slice(c[p],c[p+1]);try{for(var w=(n=void 0,s(d)),y=w.next();!y.done;y=w.next()){var v=y.value;if(!(v===p||-1===v||g.has(v))){var b=t(e[v],i[m]);a.uncheckedHeapPush(o,m,b,v,1),g.add(v)}}}catch(t){n={error:t}}finally{try{y&&!y.done&&(u=w.return)&&u.call(w)}finally{if(n)throw n.error}}}return o}},e.initializeSearch=function(t,e,r,o,i,n,h){var u,l,f=a.makeHeap(r.length,o);if(i(o,e,r,f,h),t)try{for(var c=s(t),m=c.next();!m.done;m=c.next()){var g=m.value;n(g,e,r,f,h)}}catch(t){u={error:t}}finally{try{m&&!m.done&&(l=c.return)&&l.call(c)}finally{if(u)throw u.error}}return f}},50993:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,i,n=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},a=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t},h=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.searchFlatTree=e.makeLeafArray=e.makeForest=e.FlatTree=void 0;var u=n(r(10006)),l=function(t,e,r,o){this.hyperplanes=t,this.offsets=e,this.children=r,this.indices=o};e.FlatTree=l,e.makeForest=function(t,e,r,o){var i=Math.max(10,e);return u.range(r).map(function(e,r){var n,s;return void 0===(n=i)&&(n=30),s=u.range(t.length),function t(e,r,o,i,n){if(void 0===o&&(o=30),r.length>o){var s=function(t,e,r){var o=t[0].length,i=u.tauRandInt(e.length,r),n=u.tauRandInt(e.length,r);n+=i===n?1:0,n%=e.length;for(var s=e[i],a=e[n],h=0,l=u.zeros(o),f=0;f<l.length;f++)l[f]=t[s][f]-t[a][f],h-=l[f]*(t[s][f]+t[a][f])/2;for(var c=0,m=0,g=u.zeros(e.length),f=0;f<e.length;f++){for(var p=h,d=0;d<o;d++)p+=l[d]*t[e[f]][d];0===p?(g[f]=u.tauRandInt(2,r),0===g[f]?c+=1:m+=1):p>0?(g[f]=0,c+=1):(g[f]=1,m+=1)}var w=u.zeros(c),y=u.zeros(m);c=0,m=0;for(var f=0;f<g.length;f++)0===g[f]?(w[c]=e[f],c+=1):(y[m]=e[f],m+=1);return{indicesLeft:w,indicesRight:y,hyperplane:l,offset:h}}(e,r,n),a=s.indicesLeft,h=s.indicesRight,l=s.hyperplane,f=s.offset,c={leftChild:t(e,a,o,i+1,n),rightChild:t(e,h,o,i+1,n),isLeaf:!1,hyperplane:l,offset:f};return c}var c={indices:r,isLeaf:!0};return c}(t,s,n,r,o)}).map(function(t){var e,r,o,n,s,h;return e=function t(e){return e.isLeaf?1:1+t(e.leftChild)+t(e.rightChild)}(t),r=function t(e){return e.isLeaf?1:t(e.leftChild)+t(e.rightChild)}(t),o=u.range(e).map(function(){return u.zeros(t.hyperplane?t.hyperplane.length:0)}),n=u.zeros(e),function t(e,r,o,i,n,s,h){if(e.isLeaf)return i[s][0]=-h,(u=n[h]).splice.apply(u,a([0,e.indices.length],e.indices)),{nodeNum:s,leafNum:h+=1};r[s]=e.hyperplane,o[s]=e.offset,i[s][0]=s+1;var u,l=s,f=t(e.leftChild,r,o,i,n,s+1,h);return s=f.nodeNum,h=f.leafNum,i[l][1]=s+1,{nodeNum:(f=t(e.rightChild,r,o,i,n,s+1,h)).nodeNum,leafNum:f.leafNum}}(t,o,n,s=u.range(e).map(function(){return[-1,-1]}),h=u.range(r).map(function(){return u.range(i).map(function(){return -1})}),0,0),new l(o,n,s,h)})},e.makeLeafArray=function(t){if(!(t.length>0))return[[-1]];var e,r,o=[];try{for(var i=h(t),n=i.next();!n.done;n=i.next()){var s=n.value;o.push.apply(o,a(s.indices))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return o},e.searchFlatTree=function(t,e,r){for(var o=0;e.children[o][0]>0;)o=0===function(t,e,r,o){for(var i=e,n=0;n<r.length;n++)i+=t[n]*r[n];return 0===i?u.tauRandInt(2,o):i>0?0:1}(e.hyperplanes[o],e.offsets[o],t,r)?e.children[o][0]:e.children[o][1];var i=-1*e.children[o][0];return e.indices[i]}},28158:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))(function(i,n){function s(t){try{h(o.next(t))}catch(t){n(t)}}function a(t){try{h(o.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,a)}h((o=o.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var r,o,i,n,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(i=2&n[0]?o.return:n[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,n[1])).done)return i;switch(o=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,o=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){s.label=n[1];break}if(6===n[0]&&s.label<i[1]){s.label=i[1],i=n;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(n);break}i[2]&&s.ops.pop(),s.trys.pop();continue}n=e.call(t,s)}catch(t){n=[6,t],o=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},h=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,i,n=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s},u=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return t},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.initTransform=e.resetLocalConnectivity=e.fastIntersection=e.findABParams=e.cosine=e.euclidean=e.UMAP=void 0;var f=n(r(35230)),c=n(r(78965)),m=n(r(95502)),g=n(r(50993)),p=n(r(10006)),d=l(r(58958)),w=function(){function t(t){var e=this;void 0===t&&(t={}),this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=y,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new v;var r=function(r){void 0!==t[r]&&(e[r]=t[r])};r("distanceFn"),r("learningRate"),r("localConnectivity"),r("minDist"),r("nComponents"),r("nEpochs"),r("nNeighbors"),r("negativeSampleRate"),r("random"),r("repulsionStrength"),r("setOpMixRatio"),r("spread"),r("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),s(this,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return r.sent(),[2,this.embedding]}})})},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var r=this.initializeSimplicialSetEmbedding(),o=r.head,i=r.tail,n=r.epochsPerSample;return this.optimizationState.head=o,this.optimizationState.tail=i,this.optimizationState.epochsPerSample=n,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=m.makeInitializations(this.distanceFn),e=t.initFromTree,r=t.initFromRandom;this.initFromTree=e,this.initFromRandom=r,this.search=m.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,r=this.knnDistances,o=[t.length,t.length],i=new c.SparseMatrix([],[],[],o),n=0;n<e.length;n++)for(var s=e[n],a=r[n],h=0;h<s.length;h++){var u=s[h],l=a[h];l>0&&i.set(n,u,l)}var f=c.transpose(i);return c.maximum(i,f)},t.prototype.transform=function(t){var e=this,r=this.X;if(void 0===r||0===r.length)throw Error("No data has been fit.");var o=Math.floor(this.nNeighbors*this.transformQueueSize);o=Math.min(r.length,o);var i=m.initializeSearch(this.rpForest,r,t,o,this.initFromRandom,this.initFromTree,this.random),n=this.search(r,this.searchGraph,i,t),s=f.deheapSort(n),a=s.indices,h=s.weights;a=a.map(function(t){return t.slice(0,e.nNeighbors)}),h=h.map(function(t){return t.slice(0,e.nNeighbors)});var u=Math.max(0,this.localConnectivity-1),l=this.smoothKNNDistance(h,this.nNeighbors,u),g=l.sigmas,d=l.rhos,w=this.computeMembershipStrengths(a,h,g,d),y=w.rows,v=w.cols,b=w.vals,M=[t.length,r.length],x=new c.SparseMatrix(y,v,b,M),S=c.normalize(x,"l1"),E=c.getCSR(S),k=t.length,N=R(p.reshape2d(E.indices,k,this.nNeighbors),p.reshape2d(E.values,k,this.nNeighbors),this.embedding),z=this.nEpochs?this.nEpochs/3:x.nRows<=1e4?100:30,_=x.getValues().reduce(function(t,e){return e>t?e:t},0);x=x.map(function(t){return t<_/z?0:t}),x=c.eliminateZeros(x);var A=this.makeEpochsPerSample(x.getValues(),z),P=x.getRows(),I=x.getCols();return this.assignOptimizationStateParameters({headEmbedding:N,tailEmbedding:this.embedding,head:P,tail:I,currentEpoch:0,nEpochs:z,nVertices:x.getDims()[1],epochsPerSample:A}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var r=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,r)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,r=this.distanceFn,o=this.nNeighbors,i=m.makeNNDescent(r,this.random),n=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),s=Math.max(5,Math.floor(Math.round(Math.log(t.length)/Math.log(2))));this.rpForest=g.makeForest(t,o,n,this.random);var a=i(t,g.makeLeafArray(this.rpForest),o,s);return{knnIndices:a.indices,knnDistances:a.weights}},t.prototype.fuzzySimplicialSet=function(t,e,r){void 0===r&&(r=1);var o=this.knnIndices,i=this.knnDistances,n=void 0===i?[]:i,s=this.localConnectivity,a=this.smoothKNNDistance(n,e,s),h=a.sigmas,u=a.rhos,l=this.computeMembershipStrengths(void 0===o?[]:o,n,h,u),f=l.rows,m=l.cols,g=l.vals,p=[t.length,t.length],d=new c.SparseMatrix(f,m,g,p),w=c.transpose(d),y=c.pairwiseMultiply(d,w),v=c.subtract(c.add(d,w),y),b=c.multiplyScalar(v,r),M=c.multiplyScalar(y,1-r);return c.add(b,M)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,r,o){void 0===o&&(o=1);var i=S(t,e,o,r);return E(i=c.eliminateZeros(i))},t.prototype.smoothKNNDistance=function(t,e,r,o,i){void 0===r&&(r=1),void 0===o&&(o=64),void 0===i&&(i=1);for(var n=Math.log(e)/Math.log(2)*i,s=p.zeros(t.length),a=p.zeros(t.length),h=0;h<t.length;h++){var u=0,l=1/0,f=1,c=t[h],m=c.filter(function(t){return t>0});if(m.length>=r){var g=Math.floor(r),d=r-g;g>0?(s[h]=m[g-1],d>1e-5&&(s[h]+=d*(m[g]-m[g-1]))):s[h]=d*m[0]}else m.length>0&&(s[h]=p.max(m));for(var w=0;w<o;w++){for(var y=0,v=1;v<t[h].length;v++){var b=t[h][v]-s[h];b>0?y+=Math.exp(-(b/f)):y+=1}if(1e-5>Math.abs(y-n))break;y>n?f=(u+(l=f))/2:(u=f,l===1/0?f*=2:f=(u+l)/2)}if(a[h]=f,s[h]>0){var M=p.mean(c);a[h]<.001*M&&(a[h]=.001*M)}else{var x=p.mean(t.map(p.mean));a[h]<.001*x&&(a[h]=.001*x)}}return{sigmas:a,rhos:s}},t.prototype.computeMembershipStrengths=function(t,e,r,o){for(var i=t.length,n=t[0].length,s=p.zeros(i*n),a=p.zeros(i*n),h=p.zeros(i*n),u=0;u<i;u++)for(var l=0;l<n;l++){var f=0;-1!==t[u][l]&&(f=t[u][l]===u?0:e[u][l]-o[u]<=0?1:Math.exp(-((e[u][l]-o[u])/r[u])),s[u*n+l]=u,a[u*n+l]=t[u][l],h[u*n+l]=f)}return{rows:s,cols:a,vals:h}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),r=this.nComponents,o=this.graph.getValues(),i=0,n=0;n<o.length;n++){var s=o[n];i<o[n]&&(i=s)}var a=this.graph.map(function(t){return t<i/e?0:t});this.embedding=p.zeros(a.nRows).map(function(){return p.zeros(r).map(function(){return 20*p.tauRand(t.random)+-10})});for(var h=[],u=[],l=[],f=a.getAll(),n=0;n<f.length;n++){var c=f[n];c.value&&(h.push(c.value),l.push(c.row),u.push(c.col))}return{head:u,tail:l,epochsPerSample:this.makeEpochsPerSample(h,e)}},t.prototype.makeEpochsPerSample=function(t,e){var r=p.filled(t.length,-1),o=p.max(t),i=t.map(function(t){return t/o*e});return i.forEach(function(t,o){t>0&&(r[o]=e/i[o])}),r},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this.repulsionStrength,e=this.learningRate,r=this.negativeSampleRate,o=this.optimizationState,i=o.epochsPerSample,n=o.headEmbedding,s=o.tailEmbedding,a=n[0].length,h=n.length===s.length,l=i.map(function(t){return t/r}),f=u(l),c=u(i);this.assignOptimizationStateParameters({epochOfNextSample:c,epochOfNextNegativeSample:f,epochsPerNegativeSample:l,moveOther:h,initialAlpha:e,alpha:e,gamma:t,dim:a})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,r=this.optimizationState,o=r.head,i=r.tail,n=r.epochsPerSample,s=this.getNEpochs(),a=this.graph.nCols,h=x(this.spread,this.minDist),u=h.a,l=h.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:o,tail:i,epochsPerSample:n,a:u,b:l,nEpochs:s,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,r=e.head,o=e.tail,i=e.headEmbedding,n=e.tailEmbedding,s=e.epochsPerSample,a=e.epochOfNextSample,h=e.epochOfNextNegativeSample,u=e.epochsPerNegativeSample,l=e.moveOther,f=e.initialAlpha,c=e.alpha,m=e.gamma,g=e.a,d=e.b,w=e.dim,y=e.nEpochs,v=e.nVertices,x=0;x<s.length;x++)if(!(a[x]>t)){var S=r[x],E=o[x],R=i[S],k=n[E],N=M(R,k),z=0;N>0&&(z=-2*g*d*Math.pow(N,d-1)/(g*Math.pow(N,d)+1));for(var _=0;_<w;_++){var A=b(z*(R[_]-k[_]),4);R[_]+=A*c,l&&(k[_]+=-A*c)}a[x]+=s[x];for(var P=Math.floor((t-h[x])/u[x]),I=0;I<P;I++){var O=p.tauRandInt(v,this.random),C=n[O],T=M(R,C),j=0;if(T>0)j=2*m*d/((.001+T)*(g*Math.pow(T,d)+1));else if(S===O)continue;for(var _=0;_<w;_++){var A=4;j>0&&(A=b(j*(R[_]-C[_]),4)),R[_]+=A*c}}h[x]+=P*u[x]}return e.alpha=f*(1-t/y),e.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise(function(r,o){var i=function(){return s(e,void 0,void 0,function(){var e,n,s,h,u,l;return a(this,function(a){try{if(n=(e=this.optimizationState).nEpochs,s=e.currentEpoch,this.embedding=this.optimizeLayoutStep(s),h=this.optimizationState.currentEpoch,u=!1===t(h),l=h===n,u||l)return[2,r(l)];setTimeout(function(){return i()},0)}catch(t){o(t)}return[2]})})};setTimeout(function(){return i()},0)})},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,r=[];!e;){var o=this.optimizationState,i=o.nEpochs,n=o.currentEpoch;r=this.optimizeLayoutStep(n);var s=this.optimizationState.currentEpoch,a=!1===t(s);e=s===i||a}return r},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function y(t,e){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(t[o]-e[o],2);return Math.sqrt(r)}e.UMAP=w,e.euclidean=y,e.cosine=function(t,e){for(var r=0,o=0,i=0,n=0;n<t.length;n++)r+=t[n]*e[n],o+=Math.pow(t[n],2),i+=Math.pow(e[n],2);return 0===o&&0===i?0:0===o||0===i?1:1-r/Math.sqrt(o*i)};var v=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function b(t,e){return t>e?e:t<-e?-e:t}function M(t,e){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(t[o]-e[o],2);return r}function x(t,e){var r=p.linear(0,3*t,300).map(function(t){return t<e?1:t}),o=p.zeros(r.length).map(function(o,i){return r[i]>=e?Math.exp(-(r[i]-e)/t):o}),i=d.default({x:r,y:o},function(t){var e=h(t,2),r=e[0],o=e[1];return function(t){return 1/(1+r*Math.pow(t,2*o))}},{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,n=h(i,2);return{a:n[0],b:n[1]}}function S(t,e,r,o){return void 0===r&&(r=1),void 0===o&&(o=5),t.map(function(t,i,n){return -1===e[i]||-1===e[n]?t*Math.exp(-r):e[i]!==e[n]?t*Math.exp(-o):t})}function E(t){t=c.normalize(t,"max");var e=c.transpose(t),r=c.pairwiseMultiply(e,t);return t=c.add(t,c.subtract(e,r)),c.eliminateZeros(t)}function R(t,e,r){for(var o=p.zeros(t.length).map(function(t){return p.zeros(r[0].length)}),i=0;i<t.length;i++)for(var n=0;n<t[0].length;n++)for(var s=0;s<r[0].length;s++){var a=t[i][n];o[i][s]+=e[i][n]*r[a][s]}return o}e.findABParams=x,e.fastIntersection=S,e.resetLocalConnectivity=E,e.initTransform=R},10006:function(t,e){"use strict";var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function o(t,e){return Math.floor(e()*t)}function i(t){for(var e=[],r=0;r<t;r++)e.push(void 0);return e}function n(t,e){return i(t).map(function(){return e})}function s(t){return n(t,0)}function a(t){return t.reduce(function(t,e){return t+e})}Object.defineProperty(e,"__esModule",{value:!0}),e.reshape2d=e.rejectionSample=e.max2d=e.max=e.mean=e.sum=e.linear=e.ones=e.zeros=e.filled=e.range=e.empty=e.norm=e.tauRand=e.tauRandInt=void 0,e.tauRandInt=o,e.tauRand=function(t){return t()},e.norm=function(t){var e,o,i=0;try{for(var n=r(t),s=n.next();!s.done;s=n.next()){var a=s.value;i+=Math.pow(a,2)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}return Math.sqrt(i)},e.empty=i,e.range=function(t){return i(t).map(function(t,e){return e})},e.filled=n,e.zeros=s,e.ones=function(t){return n(t,1)},e.linear=function(t,e,r){return i(r).map(function(o,i){return t+(e-t)/(r-1)*i})},e.sum=a,e.mean=function(t){return a(t)/t.length},e.max=function(t){for(var e=0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e},e.max2d=function(t){for(var e=0,r=0;r<t.length;r++)for(var o=0;o<t[r].length;o++)e=t[r][o]>e?t[r][o]:e;return e},e.rejectionSample=function(t,e,r){for(var i=s(t),n=0;n<t;n++)for(var a=!0;a;){for(var h=o(e,r),u=!1,l=0;l<n;l++)if(h===i[l]){u=!0;break}u||(a=!1),i[n]=h}return i},e.reshape2d=function(t,e,r){var o=[],i=0;if(t.length!==e*r)throw Error("Array dimensions must match input length.");for(var n=0;n<e;n++){for(var s=[],a=0;a<r;a++)s.push(t[i]),i+=1;o.push(s)}return o}}}]);