diff --git a/benchmarks/NDArray/copy.png b/benchmarks/NDArray/copy.png index 0c59de39..1b6325fb 100644 Binary files a/benchmarks/NDArray/copy.png and b/benchmarks/NDArray/copy.png differ diff --git a/benchmarks/NDArray/slice.png b/benchmarks/NDArray/slice.png new file mode 100644 index 00000000..f373da7a Binary files /dev/null and b/benchmarks/NDArray/slice.png differ diff --git a/dist/core/index.d.ts b/dist/core/index.d.ts index b5fb2720..ad93d7f3 100644 --- a/dist/core/index.d.ts +++ b/dist/core/index.d.ts @@ -256,7 +256,7 @@ export declare class NDArray implements INDArray { /** * @name T * @memberof NDArray.prototype - * @description Short for this.copy().transpose() + * @description Short for `this.transpose()` * @type NDArray */ get T(): NDArray; diff --git a/dist/core/slice.d.ts b/dist/core/slice.d.ts index 5d45425e..9781ad39 100644 --- a/dist/core/slice.d.ts +++ b/dist/core/slice.d.ts @@ -18,7 +18,7 @@ export declare const slice: (x: NDArray | ArrayLike, begin?: number | undef /** * @function slice * @memberof NDArray.prototype - * @description Slices the current array in the corresponding dimension + * @description Slices the current array along the leading dimension * @param {Number} begin * @param {Number} end * @param {Number} step diff --git a/dist/index.browser.js b/dist/index.browser.js index db8c2faa..08575cb6 100644 --- a/dist/index.browser.js +++ b/dist/index.browser.js @@ -1,11 +1,11 @@ -var v=(()=>{var go=Object.create,S=Object.defineProperty,xo=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty,ko=Object.getOwnPropertyNames,Lo=Object.getOwnPropertyDescriptor;var Io=r=>S(r,"__esModule",{value:!0});var J=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),To=(r,t)=>{for(var e in t)S(r,e,{get:t[e],enumerable:!0})},Eo=(r,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ko(t))!wo.call(r,o)&&o!=="default"&&S(r,o,{get:()=>t[o],enumerable:!(e=Lo(t,o))||e.enumerable});return r},vo=r=>Eo(Io(S(r!=null?go(xo(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var eo=J((Um,to)=>{to.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}});var oo=J(($m,Z)=>{typeof Object.create=="function"?Z.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:Z.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}});var so=J(h=>{var na=/%[sdj%]/g;h.format=function(r){if(!$(r)){for(var t=[],e=0;e=n)return m;switch(m){case"%s":return String(o[e++]);case"%d":return Number(o[e++]);case"%j":try{return JSON.stringify(o[e++])}catch(p){return"[Circular]"}default:return m}}),s=o[e];e=3&&(e.depth=arguments[2]),arguments.length>=4&&(e.colors=arguments[3]),K(t)?e.showHidden=t:t&&h._extend(e,t),x(e.showHidden)&&(e.showHidden=!1),x(e.depth)&&(e.depth=2),x(e.colors)&&(e.colors=!1),x(e.customInspect)&&(e.customInspect=!0),e.colors&&(e.stylize=ia),R(e,r,e.depth)}h.inspect=w;w.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};w.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ia(r,t){var e=w.styles[t];return e?"["+w.colors[e][0]+"m"+r+"["+w.colors[e][1]+"m":r}function sa(r,t){return r}function ma(r){var t={};return r.forEach(function(e,o){t[e]=!0}),t}function R(r,t,e){if(r.customInspect&&t&&H(t.inspect)&&t.inspect!==h.inspect&&!(t.constructor&&t.constructor.prototype===t)){var o=t.inspect(e,r);return $(o)||(o=R(r,o,e)),o}var n=pa(r,t);if(n)return n;var a=Object.keys(t),s=ma(a);if(r.showHidden&&(a=Object.getOwnPropertyNames(t)),B(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return Q(t);if(a.length===0){if(H(t)){var m=t.name?": "+t.name:"";return r.stylize("[Function"+m+"]","special")}if(P(t))return r.stylize(RegExp.prototype.toString.call(t),"regexp");if(tr(t))return r.stylize(Date.prototype.toString.call(t),"date");if(B(t))return Q(t)}var p="",f=!1,c=["{","}"];if(ao(t)&&(f=!0,c=["[","]"]),H(t)){var y=t.name?": "+t.name:"";p=" [Function"+y+"]"}if(P(t)&&(p=" "+RegExp.prototype.toString.call(t)),tr(t)&&(p=" "+Date.prototype.toUTCString.call(t)),B(t)&&(p=" "+Q(t)),a.length===0&&(!f||t.length==0))return c[0]+p+c[1];if(e<0)return P(t)?r.stylize(RegExp.prototype.toString.call(t),"regexp"):r.stylize("[Object]","special");r.seen.push(t);var l;return f?l=fa(r,t,e,s,a):l=a.map(function(d){return rr(r,t,e,s,d,f)}),r.seen.pop(),ua(l,p,c)}function pa(r,t){if(x(t))return r.stylize("undefined","undefined");if($(t)){var e="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return r.stylize(e,"string")}if(no(t))return r.stylize(""+t,"number");if(K(t))return r.stylize(""+t,"boolean");if(U(t))return r.stylize("null","null")}function Q(r){return"["+Error.prototype.toString.call(r)+"]"}function fa(r,t,e,o,n){for(var a=[],s=0,m=t.length;s{var ge=Object.create,S=Object.defineProperty,xe=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty,ke=Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptor;var Ie=r=>S(r,"__esModule",{value:!0});var V=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Te=(r,t)=>{for(var o in t)S(r,o,{get:t[o],enumerable:!0})},Ee=(r,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of ke(t))!we.call(r,e)&&e!=="default"&&S(r,e,{get:()=>t[e],enumerable:!(o=Le(t,e))||o.enumerable});return r},ve=r=>Ee(Ie(S(r!=null?ge(xe(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var ee=V(($m,oe)=>{oe.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}});var ae=V((Cm,X)=>{typeof Object.create=="function"?X.exports=function(t,o){t.super_=o,t.prototype=Object.create(o.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:X.exports=function(t,o){t.super_=o;var e=function(){};e.prototype=o.prototype,t.prototype=new e,t.prototype.constructor=t}});var me=V(h=>{var na=/%[sdj%]/g;h.format=function(r){if(!C(r)){for(var t=[],o=0;o=n)return m;switch(m){case"%s":return String(e[o++]);case"%d":return Number(e[o++]);case"%j":try{return JSON.stringify(e[o++])}catch(p){return"[Circular]"}default:return m}}),s=e[o];o=3&&(o.depth=arguments[2]),arguments.length>=4&&(o.colors=arguments[3]),Q(t)?o.showHidden=t:t&&h._extend(o,t),x(o.showHidden)&&(o.showHidden=!1),x(o.depth)&&(o.depth=2),x(o.colors)&&(o.colors=!1),x(o.customInspect)&&(o.customInspect=!0),o.colors&&(o.stylize=ia),P(o,r,o.depth)}h.inspect=w;w.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};w.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ia(r,t){var o=w.styles[t];return o?"["+w.colors[o][0]+"m"+r+"["+w.colors[o][1]+"m":r}function sa(r,t){return r}function ma(r){var t={};return r.forEach(function(o,e){t[o]=!0}),t}function P(r,t,o){if(r.customInspect&&t&&J(t.inspect)&&t.inspect!==h.inspect&&!(t.constructor&&t.constructor.prototype===t)){var e=t.inspect(o,r);return C(e)||(e=P(r,e,o)),e}var n=pa(r,t);if(n)return n;var a=Object.keys(t),s=ma(a);if(r.showHidden&&(a=Object.getOwnPropertyNames(t)),H(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return rr(t);if(a.length===0){if(J(t)){var m=t.name?": "+t.name:"";return r.stylize("[Function"+m+"]","special")}if(B(t))return r.stylize(RegExp.prototype.toString.call(t),"regexp");if(or(t))return r.stylize(Date.prototype.toString.call(t),"date");if(H(t))return rr(t)}var p="",f=!1,c=["{","}"];if(ne(t)&&(f=!0,c=["[","]"]),J(t)){var y=t.name?": "+t.name:"";p=" [Function"+y+"]"}if(B(t)&&(p=" "+RegExp.prototype.toString.call(t)),or(t)&&(p=" "+Date.prototype.toUTCString.call(t)),H(t)&&(p=" "+rr(t)),a.length===0&&(!f||t.length==0))return c[0]+p+c[1];if(o<0)return B(t)?r.stylize(RegExp.prototype.toString.call(t),"regexp"):r.stylize("[Object]","special");r.seen.push(t);var l;return f?l=fa(r,t,o,s,a):l=a.map(function(d){return tr(r,t,o,s,d,f)}),r.seen.pop(),ua(l,p,c)}function pa(r,t){if(x(t))return r.stylize("undefined","undefined");if(C(t)){var o="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return r.stylize(o,"string")}if(ie(t))return r.stylize(""+t,"number");if(Q(t))return r.stylize(""+t,"boolean");if($(t))return r.stylize("null","null")}function rr(r){return"["+Error.prototype.toString.call(r)+"]"}function fa(r,t,o,e,n){for(var a=[],s=0,m=t.length;s-1&&(a?m=m.split(` `).map(function(f){return" "+f}).join(` `).substr(2):m=` `+m.split(` `).map(function(f){return" "+f}).join(` -`))):m=r.stylize("[Circular]","special")),x(s)){if(a&&n.match(/^\d+$/))return m;s=JSON.stringify(""+n),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=r.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=r.stylize(s,"string"))}return s+": "+m}function ua(r,t,e){var o=0,n=r.reduce(function(a,s){return o++,s.indexOf(` -`)>=0&&o++,a+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?e[0]+(t===""?"":t+` +`))):m=r.stylize("[Circular]","special")),x(s)){if(a&&n.match(/^\d+$/))return m;s=JSON.stringify(""+n),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=r.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=r.stylize(s,"string"))}return s+": "+m}function ua(r,t,o){var e=0,n=r.reduce(function(a,s){return e++,s.indexOf(` +`)>=0&&e++,a+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?o[0]+(t===""?"":t+` `)+" "+r.join(`, - `)+" "+e[1]:e[0]+t+" "+r.join(", ")+" "+e[1]}function ao(r){return Array.isArray(r)}h.isArray=ao;function K(r){return typeof r=="boolean"}h.isBoolean=K;function U(r){return r===null}h.isNull=U;function ca(r){return r==null}h.isNullOrUndefined=ca;function no(r){return typeof r=="number"}h.isNumber=no;function $(r){return typeof r=="string"}h.isString=$;function ya(r){return typeof r=="symbol"}h.isSymbol=ya;function x(r){return r===void 0}h.isUndefined=x;function P(r){return v(r)&&er(r)==="[object RegExp]"}h.isRegExp=P;function v(r){return typeof r=="object"&&r!==null}h.isObject=v;function tr(r){return v(r)&&er(r)==="[object Date]"}h.isDate=tr;function B(r){return v(r)&&(er(r)==="[object Error]"||r instanceof Error)}h.isError=B;function H(r){return typeof r=="function"}h.isFunction=H;function la(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r=="undefined"}h.isPrimitive=la;h.isBuffer=eo();function er(r){return Object.prototype.toString.call(r)}function or(r){return r<10?"0"+r.toString(10):r.toString(10)}var ha=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function da(){var r=new Date,t=[or(r.getHours()),or(r.getMinutes()),or(r.getSeconds())].join(":");return[r.getDate(),ha[r.getMonth()],t].join(" ")}h.log=function(){console.log("%s - %s",da(),h.format.apply(h,arguments))};h.inherits=oo();h._extend=function(r,t){if(!t||!v(t))return r;for(var e=Object.keys(t),o=e.length;o--;)r[e[o]]=t[e[o]];return r};function io(r,t){return Object.prototype.hasOwnProperty.call(r,t)}});var Da={};To(Da,{NDArray:()=>b,NDIter:()=>u,NDMultiIter:()=>D,V_MAXDIMS:()=>k,abs:()=>mr,acos:()=>fr,acosh:()=>cr,add:()=>Nr,angle:()=>xr,array:()=>i,asin:()=>kr,asinh:()=>Ir,atan:()=>Er,atanh:()=>Mr,augment:()=>O,binOp:()=>zr,cbrt:()=>Or,ceil:()=>Fr,check:()=>$r,combine:()=>Rr,copy:()=>Br,cos:()=>Jr,cosh:()=>Gr,cross:()=>Yr,det:()=>Xr,diagonal:()=>Qr,dot:()=>tt,eig:()=>ot,equals:()=>nt,equidimensional:()=>st,equilateral:()=>pt,exp:()=>ut,expm1:()=>yt,eye:()=>T,fill:()=>ht,floor:()=>At,forEach:()=>Dt,fround:()=>gt,gauss:()=>Lt,get:()=>Tt,inv:()=>vt,log:()=>jt,log10:()=>zt,log1p:()=>Ot,log2:()=>Ft,lu:()=>$t,lu_factor:()=>Rt,magic:()=>Ao,map:()=>Bt,matrix:()=>F,max:()=>Jt,mean:()=>Gt,min:()=>Yt,multiply:()=>Xt,norm:()=>Qt,normalize:()=>te,ones:()=>bo,pow:()=>oe,prod:()=>ne,product:()=>se,project:()=>pe,push:()=>ue,random:()=>Do,range:()=>No,rank:()=>ye,reciprocal:()=>he,reduce:()=>Ae,reshape:()=>De,round:()=>ge,row_add:()=>we,scale:()=>Le,set:()=>Te,sign:()=>ve,sin:()=>je,sinh:()=>ze,slice:()=>Oe,solve:()=>Fe,sqrt:()=>$e,square:()=>Re,subtract:()=>Be,sum:()=>Je,swap:()=>Ge,tan:()=>Ye,tanh:()=>Xe,toArray:()=>Qe,toString:()=>po,trace:()=>fo,transpose:()=>co,trunc:()=>lo,zeros:()=>N});var V=r=>r.reduce((t,e)=>t.concat(Array.isArray(e)?V(e):e),[]),G=r=>ArrayBuffer.isView(r)&&!(r instanceof DataView),ir=r=>r.reduce((t,e)=>t*e,1),W=r=>Array.isArray(r)||G(r)?[r.length].concat(W(r[0])):[],I=r=>[...r.slice(1).map((t,e)=>r.slice(e+1).reduce((o,n)=>o*n,1)),1],sr=r=>{let{constructor:{name:t="Float32Array"}={}}=r||{};switch(t){case"Int8Array":return"int8";case"Uint8Array":return"uint8";case"Int16Array":return"int16";case"Uint16Array":return"uint16";case"Int32Array":return"int32";case"Uint32Array":return"uint32";case"Uint8ClampedArray":return"uint8c";case"Float32Array":return"float32";case"Float64Array":return"float64";default:return"float64"}},g=r=>{switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"uint8c":return Uint8ClampedArray;case"float32":return Float32Array;case"float64":return Float64Array;default:return Float64Array}};var i=(...r)=>new b(...r);var k=32,u=class{constructor(t){this.x=i(t);let{shape:e,strides:o,length:n}=this.x;this.length=n,this.lengthm1=n-1,this.nd=e.length,this.ndm1=this.nd-1,this.shape=Array(k).fill(0),this.strides=Array(k).fill(0),this.shapem1=Array(k).fill(0),this.coords=Array(k).fill(0),this.backstrides=Array(k).fill(0),this.factors=Array(k).fill(0),this.nd!==0&&(this.factors[this.nd-1]=1),this.contiguous=!0;let a=1,s;for(s=0;s0&&(this.factors[this.ndm1-s]=this.factors[this.nd-s]*e[this.nd-s]);this.index=0,this.pos=0}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next1d(){let{strides:t}=this;this.pos+=t[0],this.coords[0]+=1}nextcontiguous(){this.pos+=1}next2d(){let{strides:t,shapem1:e,backstrides:o}=this;this.coords[1]=0;a-=1){if(this.coords[a]new u(p)),this.numiter=t.length;let e,o;for(e=0,o=0;e=0){if(m=n.x.shape[s],m==1)continue;if(this.shape[e]==1)this.shape[e]=m;else if(this.shape[e]!==m)throw new Error("shape mismatch")}for(m=this.shape.reduce((p,f)=>p*f,1),this.length=m,this.lengthm1=m-1,e=0;e0&&(n.factors[this.nd-a-1]=n.factors[this.nd-a]*this.shape[this.nd-a]);this.index=0,this.pos=Array(this.numiter).fill(0)}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next(){let t=this.current();this.index+=1;let{numiter:e}=this,o,n;for(n=0;ni(r).abs();function pr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Mo(r[e]);return this}var{acos:jo}=Math,fr=r=>i(r).acos();function ur(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=jo(r[e]);return this}var{acosh:qo}=Math,cr=r=>i(r).acosh();function yr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=qo(r[e]);return this}var A;try{A=require("nblas")}catch(r){}var Y=A&&A.NoTrans,_a=A&&A.Trans;function lr(r,t,e,o,n,a,s){if(o.length/n!==t||a.length/s!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.daxpy(t,e,o,n,a,s);case"float32":return A.saxpy(t,e,o,n,a,s);default:throw new Error("wrong dtype")}}function hr(r,t,e,o,n,a){if(e.length/o!==t||n.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.ddot(t,e,o,n,a);case"float32":return A.sdot(t,e,o,n,a);default:throw new Error("wrong dtype")}}function dr(r,t,e,o){if(e.length/o!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.idamax(t,e,o);case"float32":return A.isamax(t,e,o);default:throw new Error("wrong dtype")}}function Ar(r,t,e,o,n,a,s,m,p,f,c,y,l,d){let{length:M}=m,{length:q}=f,{length:z}=l;if(t===A.NoTrans&&M!==p*o||t===A.Trans&&M!==p*a)throw new Error("lengths do not match");if(e===A.NoTrans&&q!==c*a||e===A.Trans&&q!==c*n)throw new Error("lengths do not match");if(z!==d*o)throw new Error("lengths do not match");switch(r){case"float64":return A.dgemm(t,e,o,n,a,s,m,p,f,c,y,l,d);case"float32":return A.sgemm(t,e,o,n,a,s,m,p,f,c,y,l,d);default:throw new Error("wrong dtype")}}function br(r,t,e,o){if(e.length/o!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.dnrm2(t,e,o);case"float32":return A.snrm2(t,e,o);default:throw new Error("wrong dtype")}}function Dr(r,t,e,o,n){if(o.length/n!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.dscal(t,e,o,n);case"float32":return A.sscal(t,e,o,n);default:throw new Error("wrong dtype")}}var Nr=(r,t,e=1)=>i(r).add(i(t),e);function gr(r,t=1){let{data:e,length:o,dtype:n}=this,{data:a}=i(r);try{lr(n,o,t,a,1,e,1)}catch(s){let m=new D(this,r);for(let[p,f]of m)e[p]+=t*a[f]}return this}var{acos:zo}=Math,xr=(r,t)=>i(r).angle(i(t));function wr(r){return zo(this.dot(i(r))/this.norm()/i(r).norm())}var{asin:So}=Math,kr=r=>i(r).asin();function Lr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=So(r[e]);return this}var{asinh:Oo}=Math,Ir=r=>i(r).asinh();function Tr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Oo(r[e]);return this}var{atan:_o}=Math,Er=r=>i(r).atan();function vr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=_o(r[e]);return this}var{atanh:Fo}=Math,Mr=r=>i(r).atanh();function jr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Fo(r[e]);return this}var N=(...r)=>new b(new Float64Array(r.reduce((t,e)=>t*e,1)),{shape:r}).fill(0);var O=(r,t)=>i(r).augment(i(t));function qr(r){let[t,e]=this.shape,[o,n]=i(r).shape,{data:a}=this,{data:s}=i(r);if(o===0||n===0)return this;if(t!==o)throw new Error("rows do not match");let m=N(t,e+n),{data:p}=m,f,c;for(f=0;fi(r).binOp(i(t),e);function Sr(r,t){let{data:e}=this,{data:o}=i(r),n=new D(this,r);for(let[a,s]of n)e[a]=t(e[a],o[s],a);return this}var{cbrt:Uo}=Math,Or=r=>i(r).cbrt();function _r(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Uo(r[e]);return this}var{ceil:$o}=Math,Fr=r=>i(r).ceil();function Ur(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=$o(r[e]);return this}var $r=(r,...t)=>{i(r).check(...t)};function Cr(...r){let{shape:t,length:e}=this;if(r.length===1){let[o]=r;if(o<0||o>e-1||!Number.isFinite(o))throw new Error("index out of bounds")}else if(!t.every((o,n)=>o>r[n]&&Number.isFinite(r[n])&&r[n]>=0))throw new Error("index out of bounds")}var Rr=(r,t)=>i(r).combine(i(t));function Pr(r){if(this.shape.length!==1&&r.shape.length!==1)throw new Error("combine operation not permitted for multidimensional arrays");let{length:t,data:e}=this,{length:o,data:n}=r;if(o===0)return this;if(t===0)return this.data=new(g(r.dtype))(n),this.length=o,this.dtype=r.dtype,this;let a=t+o,s=new(g(this.dtype))(a);return s.set(e),s.set(n,t),this.data=s,this.length=a,this.shape=[a],this}var Br=r=>i(r).copy();function Hr(){let r=N(...this.shape),{data:t}=this,{data:e}=r,o=new D(this,r);for(let[n,a]of o)e[a]=t[n];return r}var{cos:Co}=Math,Jr=r=>i(r).cos();function Vr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Co(r[e]);return this}var{cosh:Ro}=Math,Gr=r=>i(r).cosh();function Wr(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Ro(r[e]);return this}var Yr=(r,t)=>i(r).cross(i(t));function Zr(r){let{length:t}=this,{length:e}=r;if(t!==3||e!==3)throw new Error("vectors must have three components");let o=this.y*r.z-this.z*r.y,n=this.z*r.x-this.x*r.z,a=this.x*r.y-this.y*r.x;return this.x=o,this.y=n,this.z=a,this}var Xr=r=>i(r).det();function Kr(){this.square();let[r]=this.shape,[t,e]=this.copy().lu_factor(),{data:o}=t,n=1,a=1,s;for(s=0;si(r).diagonal();function rt(){this.square();let{length:r}=this,[t,e]=this.shape,o=Math.min(t,e);return this.reshape(r).slice(0,r,o+1)}var tt=(r,t)=>i(r).dot(i(t));function et(r){let{data:t,length:e,dtype:o}=this,{data:n}=r,a=0;try{a=hr(o,e,n,1,t,1)}catch(s){let m=new D(this,r);for(let[p,f]of m)a+=t[p]*n[f]}return a}var T=r=>{let t=new b(new Float64Array(r*r),{shape:[r,r]}),{data:e}=t,o;for(o=0;o{let[m]=r.shape,{data:p}=r,f=p[o*m+n],c=1/(t+e);p[o*m+n]=f-e*(p[a*m+s]+c*f),p[a*m+s]+=e*(f-c*p[a*m+s])},ot=r=>i(r).eig();function at(){this.square();let[r]=this.shape;try{["float32","float64"].includes(this.dtype)||(this.dtype="float32",this.data=g(this.dtype).from(this.data));let t=j.NoEigenvector,e=j.Eigenvector,o=N(r),n=N(r),a=N(r,r),s=N(r,r),{data:m}=this,{data:p}=o,{data:f}=n,{data:c}=a,{data:y}=s;return this.dtype==="float64"&&j.dgeev(t,e,r,m,r,p,f,c,r,y,r),this.dtype==="float32"&&j.sgeev(t,e,r,m,r,p,f,c,r,y,r),[o,s]}catch(t){let{data:e}=this,o=T(r),n=0,a=0,s=0,m=0,p=0;do{for(a=0;a=n&&(n=Math.abs(e[a*r+s]),m=a,p=s);let f;if(Math.abs(e[m*r+p])=1e-9);return[this.diagonal(),o]}}var nt=(r,t,e=1e-6)=>i(r).equals(i(t),e);function it(r,t=1e-6){let{data:e}=this,{data:o}=r,n=new D(this,r);for(let[a,s]of n)if(Math.abs(e[a]-o[s])>t)return!1;return!0}var st=(r,t)=>{i(r).equidimensional(i(t))};function mt(r){let{shape:t}=this,{shape:e}=r;if(!t.every((o,n)=>o===e[n]))throw new Error(`shapes ${t} and ${e} do not match`)}var pt=(r,t)=>{i(r).equilateral(i(t))};function ft(r){let{length:t}=this,{length:e}=r;if(t!==e)throw new Error(`lengths ${t} and ${e} do not match`)}var{exp:Po}=Math,ut=r=>i(r).exp();function ct(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Po(r[e]);return this}var{expm1:Bo}=Math,yt=r=>i(r).expm1();function lt(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Bo(r[e]);return this}var ht=(r,t=0)=>i(r).fill(t);function dt(r=0){let{data:t}=this,e=new u(this);for(let o of e)t[o]=r instanceof Function?r(e.pos):r;return this}var{floor:Ho}=Math,At=r=>i(r).floor();function bt(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Ho(r[e]);return this}var Dt=(r,t)=>{r.forEach(t)};function Nt(r){let{data:t}=this,e=new u(this);for(let o of e)r.call(this,t[o],o,t)}var{fround:Jo}=Math,gt=r=>i(r).fround();function xt(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Jo(r[e]);return this}var L;try{L=require("nlapack")}catch(r){}function E(r,t,e,o,n,a){if(o.length!==t*e)throw new Error("lengths do not match");switch(r){case"float64":return L.dgetrf(t,e,o,n,a);case"float32":return L.sgetrf(t,e,o,n,a);default:throw new Error("wrong dtype")}}function wt(r,t,e,o,n){if(e.length!==t*t)throw new Error("lengths do not match");switch(r){case"float64":return L.dgetri(t,e,o,n);case"float32":return L.sgetri(t,e,o,n);default:throw new Error("wrong dtype")}}function kt(r,t,e,o,n,a,s,m){if(o.length!==n*t||s.length!==m*e)throw new Error("lengths do not match");switch(r){case"float64":return L.dgesv(t,e,o,n,a,s,m);case"float32":return L.sgesv(t,e,o,n,a,s,m);default:throw new Error("wrong dtype")}}var Lt=r=>i(r).gauss();function It(){let{shape:[r,t],data:e,dtype:o}=this;try{let{data:n}=this,a=new Int32Array(Math.min(r,t));E(o,r,t,n,t,a);let s=new u(this),[m,p]=s.coords;for(let f of s)pi(r).get(...t);function Et(...r){this.check(...r);let{data:t,shape:e}=this,{length:o}=e,n=r[o-1],a,s;for(a=0;ai(r).inv();function Mt(){this.square();let{shape:[r],dtype:t}=this;try{let{data:e}=this,o=new Int32Array(r);return E(t,r,r,e,r,o),wt(t,r,e,r,o),this}catch(e){let o=T(r),n=O(this,o).gauss(),a=N(r,r),s=N(r,r),{data:m}=n,{data:p}=a,{data:f}=s,c=new u(n),[y,l]=c.coords;for(let d of c)li(r).log();function qt(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Vo(r[e]);return this}var{log10:Go}=Math,zt=r=>i(r).log10();function St(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Go(r[e]);return this}var{log1p:Wo}=Math,Ot=r=>i(r).log1p();function _t(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Wo(r[e]);return this}var{log2:Yo}=Math,Ft=r=>i(r).log2();function Ut(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Yo(r[e]);return this}var $t=r=>i(r).lu();function Ct(){let[r,t]=this.copy().lu_factor(),e=r.copy(),o=r.copy(),{data:n}=e,{data:a}=o,s=new u(r),[m,p]=s.coords;for(let f of s)pi(r).lu_factor();function Pt(){let{data:r,shape:[t],dtype:e}=this,o=new Int32Array(t);try{E(e,t,t,r,t,o)}catch(n){let a,s,m,p,f,c,y;for(y=0;yi(r).map(t);function Ht(r){let{data:t}=this,e=new u(this),o=r.bind(this),n=this.copy(),{data:a}=n;for(let s of e)a[s]=o(t[s],s,t);return n}var Jt=r=>i(r).max();function Vt(){let{data:r,length:t,dtype:e}=this,o=Number.NEGATIVE_INFINITY;try{o=r[dr(e,t,r,1)]}catch(n){let a=new u(this);for(let s of a){let m=r[s];oi(r).mean();function Wt(){let{data:r,length:t}=this,e=new u(this),o=0;for(let n of e)o+=r[n];return o/t}var Yt=r=>i(r).min();function Zt(){let{data:r}=this,t=new u(this),e=Number.POSITIVE_INFINITY;for(let o of t){let n=r[o];e>n&&(e=n)}return e}var F=(r,t)=>new b(new Float64Array(r*t),{shape:[r,t]});var Xt=(r,t)=>i(r).multiply(i(t));function Kt(r){let{shape:[t,e],data:o,dtype:n}=this,{shape:[a,s],data:m}=r;if(e!==a)throw new Error("sizes do not match");let p=F(t,s),{data:f}=p;try{Ar(n,Y,Y,t,s,e,1,o,e,m,s,0,f,s)}catch(c){let y=new u(p),l,[d,M]=y.coords;for(let q of y){let z=0;for(l=0;li(r).norm();function re(){let{data:r,length:t,dtype:e}=this,o=0;try{o=br(e,t,r,1)}catch(n){o=Zo(this.dot(this))}return o}var te=r=>i(r).normalize();function ee(){return this.scale(1/this.norm())}var{pow:Xo}=Math,oe=(r,t)=>i(r).pow(t);function ae(r){let{data:t}=this,e=new u(this);for(let o of e)t[o]=Xo(t[o],r);return this}var ne=r=>i(r).prod();function ie(){let{data:r}=this,t=new u(this),e=1;for(let o of t)e*=r[o];return e}var se=(r,t)=>i(r).product(i(t));function me(r){let{data:t}=this,{data:e}=r,o=new D(this,r);for(let[n,a]of o)t[n]*=e[a];return this}var pe=(r,t)=>i(r).project(i(t));function fe(r){return r.scale(this.dot(r)/r.dot(r))}var ue=(r,t)=>i(r).push(t);function ce(r){if(this.shape.length!==1)throw new Error("push operation not permitted for multidimensional arrays");let{data:t,length:e}=this,o=e+1,n=new(g(this.dtype))(o);return n.set(t),n[e]=r,this.data=n,this.length=o,this.shape=[o],this}var ye=(r,t=1e-6)=>i(r).rank(t);function le(r=1e-6){let{data:t}=this.copy().gauss(),e=new u(this),o=0,[n,a]=e.coords;for(let s of e)o<=n&&a>=n&&t[s]>r&&(o+=1),[n,a]=e.coords;return o}var he=r=>i(r).reciprocal();function de(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=1/r[e];return this}var Ae=(r,t,e)=>i(r).reduce(t,e);function be(r,t){let{data:e,length:o}=this;if(o===0&&typeof t=="undefined")throw new Error("Reduce of empty array with no initial value.");let n=new u(this),a=r.bind(this),s;typeof t=="undefined"?(s=e[0],n.next()):s=t;for(let m of n)s=a(s,e[m],m,e);return s}var De=(r,...t)=>i(r).reshape(...t);function Ne(...r){let{length:t}=this;if(r.reduce((e,o)=>e*o,1)!==t)throw new Error(`shape ${r} does not match length ${t}`);return this.shape=r,this.strides=I(r),this}var{round:Ko}=Math,ge=r=>i(r).round();function xe(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Ko(r[e]);return this}var we=(r,t,e,o=1)=>i(r).row_add(t,e,o);function ke(r,t,e=1){this.check(r,0),this.check(t,0);let[,o]=this.shape,{data:n}=this,a;for(a=0;ai(r).scale(t);function Ie(r){let{data:t,length:e,dtype:o}=this;try{Dr(o,e,r,t,1)}catch(n){let a=new u(this);for(let s of a)t[s]*=r}return this}var Te=(r,...t)=>{r.set(...t)};function Ee(...r){let t=r.slice(0,-1),e=r[r.length-1];this.check(...t);let{shape:o}=this,n=t[t.length-1],a;for(a=0;ai(r).sign();function Me(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Qo(r[e]);return this}var{sin:ra}=Math,je=r=>i(r).sin();function qe(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=ra(r[e]);return this}var{sinh:ta}=Math,ze=r=>i(r).sinh();function Se(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=ta(r[e]);return this}var Oe=(r,t,e,o)=>i(r).slice(t,e,o);function _e(r=0,t=this.shape[0],e=1){let{shape:o}=this,n=o.length;if(r<0||t<0)return this.slice(r<0?n+r:r,t<0?n+t:t);if(e===0)throw new Error("step argument cannot be 0");let a=[Math.ceil((t-r)/e),...o.slice(1)],s=a.reduce((p,f)=>p*f,1),m=I(a);return this.shape=a,this.length=s,this.strides=m,this}var Fe=(r,t)=>i(r).solve(i(t));function Ue(r){let{data:t,dtype:e}=this,{data:o,shape:[n,a]}=r;try{let s=new Int32Array(n);kt(e,n,a,t,n,s,o,a)}catch(s){let[m,p]=this.lu_factor(),{data:f}=m,{data:c}=r,y,l,d;for(y=0;y=0;y-=1){for(l=y+1;li(r).sqrt();function Ce(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=ea(r[e]);return this}var Re=r=>{i(r).square()};function Pe(){let{length:r}=this.shape,[t,e]=this.shape;if(r!==2||t!==e)throw new Error("matrix is not square")}var Be=(r,t)=>i(r).subtract(i(t));function He(r){return this.add(r,-1)}var Je=r=>i(r).sum();function Ve(){let{data:r}=this,t=new u(this),e=0;for(let o of t)e+=r[o];return e}var Ge=(r,t,e)=>i(r).swap(t,e);function We(r,t){this.check(r,0),this.check(t,0);let{data:e}=this,[,o]=this.shape,n=e.slice(r*o,(r+1)*o);return e.copyWithin(r*o,t*o,(t+1)*o),e.set(n,t*o),this}var{tan:oa}=Math,Ye=r=>i(r).tan();function Ze(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=oa(r[e]);return this}var{tanh:aa}=Math,Xe=r=>i(r).tanh();function Ke(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=aa(r[e]);return this}var Qe=r=>i(r).toArray();function ro(r=0,t=0){let{data:e,shape:o,strides:n}=this,{length:a}=o;if(t>=a)return e[r];let s=o[t],m=n[t],p=[];for(let f=0;fi(r).toString();function ar(){return`array(${(0,mo.inspect)(this.toArray(),{depth:10,breakLength:40})}, dtype=${this.dtype})`}var fo=r=>i(r).trace();function uo(){let[r,t]=this.shape,{data:e}=this,o=Math.min(r,t),n=0,a;for(a=0;ai(r).transpose();function yo(){if(this.shape.length<2)return this;let r=this.shape[0];return this.shape[0]=this.shape[1],this.shape[1]=r,r=this.strides[0],this.strides[0]=this.strides[1],this.strides[1]=r,this}var{trunc:Aa}=Math,lo=r=>i(r).trunc();function ho(){let{data:r}=this,t=new u(this);for(let e of t)r[e]=Aa(r[e]);return this}var Ao=r=>{if(r<0)throw new Error("invalid n");let t=new Float64Array(r*r),e=new b(t,{shape:[r,r]}),o=new u(e),[n,a]=o.coords;for(let s of o){let m=r-n-1,p=r-a-1;t[s]=(a+m*2+1)%r*r+(p+m*2+1)%r+1,[n,a]=o.coords}return e};var bo=(...r)=>new b(new Float64Array(r.reduce((t,e)=>t*e,1)),{shape:r}).fill(1);var Do=(...r)=>new b(new Float64Array(r.reduce((t,e)=>t*e,1)),{shape:r}).map(()=>Math.random());var No=(...r)=>{let t=Float32Array,e=!1,o,n,a;switch(r.length){case 2:a=r.pop(),n=1,o=r.pop();break;case 3:a=r.pop(),n=r.pop(),o=r.pop();break;default:throw new Error("invalid range")}if(a-o<0){let f=a;a=o,o=f,e=!0}if(n>a-o)throw new Error("invalid range");let s=new t(Math.ceil((a-o)/n)),m=o,p=0;if(e)for(;mA,NDIter:()=>u,NDMultiIter:()=>D,V_MAXDIMS:()=>k,abs:()=>mr,acos:()=>fr,acosh:()=>cr,add:()=>Nr,angle:()=>xr,array:()=>i,asin:()=>kr,asinh:()=>Ir,atan:()=>Er,atanh:()=>Mr,augment:()=>_,binOp:()=>zr,cbrt:()=>Or,ceil:()=>Fr,check:()=>$r,combine:()=>Rr,copy:()=>Br,cos:()=>Jr,cosh:()=>Gr,cross:()=>Yr,det:()=>Xr,diagonal:()=>Qr,dot:()=>tt,eig:()=>et,equals:()=>nt,equidimensional:()=>st,equilateral:()=>pt,exp:()=>ut,expm1:()=>yt,eye:()=>T,fill:()=>ht,floor:()=>At,forEach:()=>Dt,fround:()=>gt,gauss:()=>Lt,get:()=>Tt,inv:()=>vt,log:()=>jt,log10:()=>zt,log1p:()=>Ot,log2:()=>Ft,lu:()=>$t,lu_factor:()=>Rt,magic:()=>Ae,map:()=>Bt,matrix:()=>U,max:()=>Jt,mean:()=>Gt,min:()=>Yt,multiply:()=>Xt,norm:()=>Qt,normalize:()=>to,ones:()=>be,pow:()=>eo,prod:()=>no,product:()=>so,project:()=>po,push:()=>uo,random:()=>De,range:()=>Ne,rank:()=>yo,reciprocal:()=>ho,reduce:()=>bo,reshape:()=>No,round:()=>xo,row_add:()=>ko,scale:()=>Io,set:()=>Eo,sign:()=>Mo,sin:()=>qo,sinh:()=>So,slice:()=>_o,solve:()=>Uo,sqrt:()=>Co,square:()=>Po,subtract:()=>Ho,sum:()=>Vo,swap:()=>Wo,tan:()=>Zo,tanh:()=>Ko,toArray:()=>re,toString:()=>fe,trace:()=>ue,transpose:()=>ye,trunc:()=>he,zeros:()=>N});var G=r=>r.reduce((t,o)=>t.concat(Array.isArray(o)?G(o):o),[]),W=r=>ArrayBuffer.isView(r)&&!(r instanceof DataView),O=r=>r.reduce((t,o)=>t*o,1),Y=r=>Array.isArray(r)||W(r)?[r.length].concat(Y(r[0])):[],I=r=>[...r.slice(1).map((t,o)=>r.slice(o+1).reduce((e,n)=>e*n,1)),1],sr=r=>{let{constructor:{name:t="Float32Array"}={}}=r||{};switch(t){case"Int8Array":return"int8";case"Uint8Array":return"uint8";case"Int16Array":return"int16";case"Uint16Array":return"uint16";case"Int32Array":return"int32";case"Uint32Array":return"uint32";case"Uint8ClampedArray":return"uint8c";case"Float32Array":return"float32";case"Float64Array":return"float64";default:return"float64"}},g=r=>{switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"uint8c":return Uint8ClampedArray;case"float32":return Float32Array;case"float64":return Float64Array;default:return Float64Array}};var i=(...r)=>new A(...r);var k=32,u=class{constructor(t){this.x=i(t);let{shape:o,strides:e,length:n}=this.x;this.length=n,this.lengthm1=n-1,this.nd=o.length,this.ndm1=this.nd-1,this.shape=Array(k).fill(0),this.strides=Array(k).fill(0),this.shapem1=Array(k).fill(0),this.coords=Array(k).fill(0),this.backstrides=Array(k).fill(0),this.factors=Array(k).fill(0),this.nd!==0&&(this.factors[this.nd-1]=1),this.contiguous=!0;let a=1,s;for(s=0;s0&&(this.factors[this.ndm1-s]=this.factors[this.nd-s]*o[this.nd-s]);this.index=0,this.pos=0}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next1d(){let{strides:t}=this;this.pos+=t[0],this.coords[0]+=1}nextcontiguous(){this.pos+=1}next2d(){let{strides:t,shapem1:o,backstrides:e}=this;this.coords[1]=0;a-=1){if(this.coords[a]new u(p)),this.numiter=t.length;let o,e;for(o=0,e=0;o=0){if(m=n.x.shape[s],m==1)continue;if(this.shape[o]==1)this.shape[o]=m;else if(this.shape[o]!==m)throw new Error("shape mismatch")}for(m=this.shape.reduce((p,f)=>p*f,1),this.length=m,this.lengthm1=m-1,o=0;o0&&(n.factors[this.nd-a-1]=n.factors[this.nd-a]*this.shape[this.nd-a]);this.index=0,this.pos=Array(this.numiter).fill(0)}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next(){let t=this.current();this.index+=1;let{numiter:o}=this,e,n;for(n=0;ni(r).abs();function pr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Me(r[o]);return this}var{acos:je}=Math,fr=r=>i(r).acos();function ur(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=je(r[o]);return this}var{acosh:qe}=Math,cr=r=>i(r).acosh();function yr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=qe(r[o]);return this}var b;try{b=require("nblas")}catch(r){}var Z=b&&b.NoTrans,_a=b&&b.Trans;function lr(r,t,o,e,n,a,s){if(e.length/n!==t||a.length/s!==t)throw new Error("lengths do not match");switch(r){case"float64":return b.daxpy(t,o,e,n,a,s);case"float32":return b.saxpy(t,o,e,n,a,s);default:throw new Error("wrong dtype")}}function hr(r,t,o,e,n,a){if(o.length/e!==t||n.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return b.ddot(t,o,e,n,a);case"float32":return b.sdot(t,o,e,n,a);default:throw new Error("wrong dtype")}}function dr(r,t,o,e){if(o.length/e!==t)throw new Error("lengths do not match");switch(r){case"float64":return b.idamax(t,o,e);case"float32":return b.isamax(t,o,e);default:throw new Error("wrong dtype")}}function Ar(r,t,o,e,n,a,s,m,p,f,c,y,l,d){let{length:M}=m,{length:q}=f,{length:z}=l;if(t===b.NoTrans&&M!==p*e||t===b.Trans&&M!==p*a)throw new Error("lengths do not match");if(o===b.NoTrans&&q!==c*a||o===b.Trans&&q!==c*n)throw new Error("lengths do not match");if(z!==d*e)throw new Error("lengths do not match");switch(r){case"float64":return b.dgemm(t,o,e,n,a,s,m,p,f,c,y,l,d);case"float32":return b.sgemm(t,o,e,n,a,s,m,p,f,c,y,l,d);default:throw new Error("wrong dtype")}}function br(r,t,o,e){if(o.length/e!==t)throw new Error("lengths do not match");switch(r){case"float64":return b.dnrm2(t,o,e);case"float32":return b.snrm2(t,o,e);default:throw new Error("wrong dtype")}}function Dr(r,t,o,e,n){if(e.length/n!==t)throw new Error("lengths do not match");switch(r){case"float64":return b.dscal(t,o,e,n);case"float32":return b.sscal(t,o,e,n);default:throw new Error("wrong dtype")}}var Nr=(r,t,o=1)=>i(r).add(i(t),o);function gr(r,t=1){let{data:o,length:e,dtype:n}=this,{data:a}=i(r);try{lr(n,e,t,a,1,o,1)}catch(s){let m=new D(this,r);for(let[p,f]of m)o[p]+=t*a[f]}return this}var{acos:ze}=Math,xr=(r,t)=>i(r).angle(i(t));function wr(r){return ze(this.dot(i(r))/this.norm()/i(r).norm())}var{asin:Se}=Math,kr=r=>i(r).asin();function Lr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Se(r[o]);return this}var{asinh:Oe}=Math,Ir=r=>i(r).asinh();function Tr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Oe(r[o]);return this}var{atan:_e}=Math,Er=r=>i(r).atan();function vr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=_e(r[o]);return this}var{atanh:Fe}=Math,Mr=r=>i(r).atanh();function jr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Fe(r[o]);return this}var N=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(0);var _=(r,t)=>i(r).augment(i(t));function qr(r){let[t,o]=this.shape,[e,n]=i(r).shape,{data:a}=this,{data:s}=i(r);if(e===0||n===0)return this;if(t!==e)throw new Error("rows do not match");let m=N(t,o+n),{data:p}=m,f,c;for(f=0;fi(r).binOp(i(t),o);function Sr(r,t){let{data:o}=this,{data:e}=i(r),n=new D(this,r);for(let[a,s]of n)o[a]=t(o[a],e[s],a);return this}var{cbrt:Ue}=Math,Or=r=>i(r).cbrt();function _r(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ue(r[o]);return this}var{ceil:$e}=Math,Fr=r=>i(r).ceil();function Ur(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=$e(r[o]);return this}var $r=(r,...t)=>{i(r).check(...t)};function Cr(...r){let{shape:t,length:o}=this;if(r.length===1){let[e]=r;if(e<0||e>o-1||!Number.isFinite(e))throw new Error("index out of bounds")}else if(!t.every((e,n)=>e>r[n]&&Number.isFinite(r[n])&&r[n]>=0))throw new Error("index out of bounds")}var Rr=(r,t)=>i(r).combine(i(t));function Pr(r){if(this.shape.length!==1&&r.shape.length!==1)throw new Error("combine operation not permitted for multidimensional arrays");let{length:t,data:o}=this,{length:e,data:n}=r;if(e===0)return this;if(t===0)return this.data=new(g(r.dtype))(n),this.length=e,this.dtype=r.dtype,this;let a=t+e,s=new(g(this.dtype))(a);return s.set(o),s.set(n,t),this.data=s,this.length=a,this.shape=[a],this}var Br=r=>i(r).copy();function Hr(){let r=N(...this.shape),{data:t}=this,{data:o}=r,e=new D(this,r);for(let[n,a]of e)o[a]=t[n];return r}var{cos:Ce}=Math,Jr=r=>i(r).cos();function Vr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ce(r[o]);return this}var{cosh:Re}=Math,Gr=r=>i(r).cosh();function Wr(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Re(r[o]);return this}var Yr=(r,t)=>i(r).cross(i(t));function Zr(r){let{length:t}=this,{length:o}=r;if(t!==3||o!==3)throw new Error("vectors must have three components");let e=this.y*r.z-this.z*r.y,n=this.z*r.x-this.x*r.z,a=this.x*r.y-this.y*r.x;return this.x=e,this.y=n,this.z=a,this}var Xr=r=>i(r).det();function Kr(){this.square();let[r]=this.shape,[t,o]=this.copy().lu_factor(),{data:e}=t,n=1,a=1,s;for(s=0;si(r).diagonal();function rt(){this.square();let{length:r}=this,[t,o]=this.shape,e=Math.min(t,o);return this.reshape(r).slice(0,r,e+1)}var tt=(r,t)=>i(r).dot(i(t));function ot(r){let{data:t,length:o,dtype:e}=this,{data:n}=r,a=0;try{a=hr(e,o,n,1,t,1)}catch(s){let m=new D(this,r);for(let[p,f]of m)a+=t[p]*n[f]}return a}var T=r=>{let t=new A(new Float64Array(r*r),{shape:[r,r]}),{data:o}=t,e;for(e=0;e{let[m]=r.shape,{data:p}=r,f=p[e*m+n],c=1/(t+o);p[e*m+n]=f-o*(p[a*m+s]+c*f),p[a*m+s]+=o*(f-c*p[a*m+s])},et=r=>i(r).eig();function at(){this.square();let[r]=this.shape;try{["float32","float64"].includes(this.dtype)||(this.dtype="float32",this.data=g(this.dtype).from(this.data));let t=j.NoEigenvector,o=j.Eigenvector,e=N(r),n=N(r),a=N(r,r),s=N(r,r),{data:m}=this,{data:p}=e,{data:f}=n,{data:c}=a,{data:y}=s;return this.dtype==="float64"&&j.dgeev(t,o,r,m,r,p,f,c,r,y,r),this.dtype==="float32"&&j.sgeev(t,o,r,m,r,p,f,c,r,y,r),[e,s]}catch(t){let{data:o}=this,e=T(r),n=0,a=0,s=0,m=0,p=0;do{for(a=0;a=n&&(n=Math.abs(o[a*r+s]),m=a,p=s);let f;if(Math.abs(o[m*r+p])=1e-9);return[this.diagonal(),e]}}var nt=(r,t,o=1e-6)=>i(r).equals(i(t),o);function it(r,t=1e-6){let{data:o}=this,{data:e}=r,n=new D(this,r);for(let[a,s]of n)if(Math.abs(o[a]-e[s])>t)return!1;return!0}var st=(r,t)=>{i(r).equidimensional(i(t))};function mt(r){let{shape:t}=this,{shape:o}=r;if(!t.every((e,n)=>e===o[n]))throw new Error(`shapes ${t} and ${o} do not match`)}var pt=(r,t)=>{i(r).equilateral(i(t))};function ft(r){let{length:t}=this,{length:o}=r;if(t!==o)throw new Error(`lengths ${t} and ${o} do not match`)}var{exp:Pe}=Math,ut=r=>i(r).exp();function ct(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Pe(r[o]);return this}var{expm1:Be}=Math,yt=r=>i(r).expm1();function lt(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Be(r[o]);return this}var ht=(r,t=0)=>i(r).fill(t);function dt(r=0){let{data:t}=this,o=new u(this);for(let e of o)t[e]=r instanceof Function?r(o.pos):r;return this}var{floor:He}=Math,At=r=>i(r).floor();function bt(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=He(r[o]);return this}var Dt=(r,t)=>{r.forEach(t)};function Nt(r){let{data:t}=this,o=new u(this);for(let e of o)r.call(this,t[e],e,t)}var{fround:Je}=Math,gt=r=>i(r).fround();function xt(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Je(r[o]);return this}var L;try{L=require("nlapack")}catch(r){}function E(r,t,o,e,n,a){if(e.length!==t*o)throw new Error("lengths do not match");switch(r){case"float64":return L.dgetrf(t,o,e,n,a);case"float32":return L.sgetrf(t,o,e,n,a);default:throw new Error("wrong dtype")}}function wt(r,t,o,e,n){if(o.length!==t*t)throw new Error("lengths do not match");switch(r){case"float64":return L.dgetri(t,o,e,n);case"float32":return L.sgetri(t,o,e,n);default:throw new Error("wrong dtype")}}function kt(r,t,o,e,n,a,s,m){if(e.length!==n*t||s.length!==m*o)throw new Error("lengths do not match");switch(r){case"float64":return L.dgesv(t,o,e,n,a,s,m);case"float32":return L.sgesv(t,o,e,n,a,s,m);default:throw new Error("wrong dtype")}}var Lt=r=>i(r).gauss();function It(){let{shape:[r,t],data:o,dtype:e}=this;try{let{data:n}=this,a=new Int32Array(Math.min(r,t));E(e,r,t,n,t,a);let s=new u(this),[m,p]=s.coords;for(let f of s)pi(r).get(...t);function Et(...r){this.check(...r);let{data:t,shape:o}=this,{length:e}=o,n=r[e-1],a,s;for(a=0;ai(r).inv();function Mt(){this.square();let{shape:[r],dtype:t}=this;try{let{data:o}=this,e=new Int32Array(r);return E(t,r,r,o,r,e),wt(t,r,o,r,e),this}catch(o){let e=T(r),n=_(this,e).gauss(),a=N(r,r),s=N(r,r),{data:m}=n,{data:p}=a,{data:f}=s,c=new u(n),[y,l]=c.coords;for(let d of c)li(r).log();function qt(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ve(r[o]);return this}var{log10:Ge}=Math,zt=r=>i(r).log10();function St(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ge(r[o]);return this}var{log1p:We}=Math,Ot=r=>i(r).log1p();function _t(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=We(r[o]);return this}var{log2:Ye}=Math,Ft=r=>i(r).log2();function Ut(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ye(r[o]);return this}var $t=r=>i(r).lu();function Ct(){let[r,t]=this.copy().lu_factor(),o=r.copy(),e=r.copy(),{data:n}=o,{data:a}=e,s=new u(r),[m,p]=s.coords;for(let f of s)pi(r).lu_factor();function Pt(){let{data:r,shape:[t],dtype:o}=this,e=new Int32Array(t);try{E(o,t,t,r,t,e)}catch(n){let a,s,m,p,f,c,y;for(y=0;yi(r).map(t);function Ht(r){let{data:t}=this,o=new u(this),e=r.bind(this),n=this.copy(),{data:a}=n;for(let s of o)a[s]=e(t[s],s,t);return n}var Jt=r=>i(r).max();function Vt(){let{data:r,length:t,dtype:o}=this,e=Number.NEGATIVE_INFINITY;try{e=r[dr(o,t,r,1)]}catch(n){let a=new u(this);for(let s of a){let m=r[s];ei(r).mean();function Wt(){let{data:r,length:t}=this,o=new u(this),e=0;for(let n of o)e+=r[n];return e/t}var Yt=r=>i(r).min();function Zt(){let{data:r}=this,t=new u(this),o=Number.POSITIVE_INFINITY;for(let e of t){let n=r[e];o>n&&(o=n)}return o}var U=(r,t)=>new A(new Float64Array(r*t),{shape:[r,t]});var Xt=(r,t)=>i(r).multiply(i(t));function Kt(r){let{shape:[t,o],data:e,dtype:n}=this,{shape:[a,s],data:m}=r;if(o!==a)throw new Error("sizes do not match");let p=U(t,s),{data:f}=p;try{Ar(n,Z,Z,t,s,o,1,e,o,m,s,0,f,s)}catch(c){let y=new u(p),l,[d,M]=y.coords;for(let q of y){let z=0;for(l=0;li(r).norm();function ro(){let{data:r,length:t,dtype:o}=this,e=0;try{e=br(o,t,r,1)}catch(n){e=Ze(this.dot(this))}return e}var to=r=>i(r).normalize();function oo(){return this.scale(1/this.norm())}var{pow:Xe}=Math,eo=(r,t)=>i(r).pow(t);function ao(r){let{data:t}=this,o=new u(this);for(let e of o)t[e]=Xe(t[e],r);return this}var no=r=>i(r).prod();function io(){let{data:r}=this,t=new u(this),o=1;for(let e of t)o*=r[e];return o}var so=(r,t)=>i(r).product(i(t));function mo(r){let{data:t}=this,{data:o}=r,e=new D(this,r);for(let[n,a]of e)t[n]*=o[a];return this}var po=(r,t)=>i(r).project(i(t));function fo(r){return r.scale(this.dot(r)/r.dot(r))}var uo=(r,t)=>i(r).push(t);function co(r){if(this.shape.length!==1)throw new Error("push operation not permitted for multidimensional arrays");let{data:t,length:o}=this,e=o+1,n=new(g(this.dtype))(e);return n.set(t),n[o]=r,this.data=n,this.length=e,this.shape=[e],this}var yo=(r,t=1e-6)=>i(r).rank(t);function lo(r=1e-6){let{data:t}=this.copy().gauss(),o=new u(this),e=0,[n,a]=o.coords;for(let s of o)e<=n&&a>=n&&t[s]>r&&(e+=1),[n,a]=o.coords;return e}var ho=r=>i(r).reciprocal();function Ao(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=1/r[o];return this}var bo=(r,t,o)=>i(r).reduce(t,o);function Do(r,t){let{data:o,length:e}=this;if(e===0&&typeof t=="undefined")throw new Error("Reduce of empty array with no initial value.");let n=new u(this),a=r.bind(this),s;typeof t=="undefined"?(s=o[0],n.next()):s=t;for(let m of n)s=a(s,o[m],m,o);return s}var No=(r,...t)=>i(r).reshape(...t);function go(...r){let{length:t}=this;if(r.reduce((o,e)=>o*e,1)!==t)throw new Error(`shape ${r} does not match length ${t}`);return this.shape=r,this.strides=I(r),this}var{round:Ke}=Math,xo=r=>i(r).round();function wo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Ke(r[o]);return this}var ko=(r,t,o,e=1)=>i(r).row_add(t,o,e);function Lo(r,t,o=1){this.check(r,0),this.check(t,0);let[,e]=this.shape,{data:n}=this,a;for(a=0;ai(r).scale(t);function To(r){let{data:t,length:o,dtype:e}=this;try{Dr(e,o,r,t,1)}catch(n){let a=new u(this);for(let s of a)t[s]*=r}return this}var Eo=(r,...t)=>{r.set(...t)};function vo(...r){let t=r.slice(0,-1),o=r[r.length-1];this.check(...t);let{shape:e}=this,n=t[t.length-1],a;for(a=0;ai(r).sign();function jo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Qe(r[o]);return this}var{sin:ra}=Math,qo=r=>i(r).sin();function zo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=ra(r[o]);return this}var{sinh:ta}=Math,So=r=>i(r).sinh();function Oo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=ta(r[o]);return this}var _o=(r,t,o,e)=>i(r).slice(t,o,e);function Fo(r=0,t=this.shape[0],o=1){let{data:e,shape:n}=this,a=n.length;if(r<0||t<0)return this.slice(r<0?n[n.length-1]+r:r,t<0?n[n.length-1]+t:t);if(r>t)return this.slice(t,r,o);if(o<=0)throw new Error("step argument has to be a positive integer");let s=[Math.ceil((t-r)/Math.abs(o)),...n.slice(1)],m=O(s),p=I(s),f=a>1?e.subarray(r*s[s.length-1],t*s[s.length-1]):e.subarray(r,t);return p[0]*=o,new A(f,{shape:s,length:m,strides:p})}var Uo=(r,t)=>i(r).solve(i(t));function $o(r){let{data:t,dtype:o}=this,{data:e,shape:[n,a]}=r;try{let s=new Int32Array(n);kt(o,n,a,t,n,s,e,a)}catch(s){let[m,p]=this.lu_factor(),{data:f}=m,{data:c}=r,y,l,d;for(y=0;y=0;y-=1){for(l=y+1;li(r).sqrt();function Ro(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=oa(r[o]);return this}var Po=r=>{i(r).square()};function Bo(){let{length:r}=this.shape,[t,o]=this.shape;if(r!==2||t!==o)throw new Error("matrix is not square")}var Ho=(r,t)=>i(r).subtract(i(t));function Jo(r){return this.add(r,-1)}var Vo=r=>i(r).sum();function Go(){let{data:r}=this,t=new u(this),o=0;for(let e of t)o+=r[e];return o}var Wo=(r,t,o)=>i(r).swap(t,o);function Yo(r,t){this.check(r,0),this.check(t,0);let{data:o}=this,[,e]=this.shape,n=o.slice(r*e,(r+1)*e);return o.copyWithin(r*e,t*e,(t+1)*e),o.set(n,t*e),this}var{tan:ea}=Math,Zo=r=>i(r).tan();function Xo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=ea(r[o]);return this}var{tanh:aa}=Math,Ko=r=>i(r).tanh();function Qo(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=aa(r[o]);return this}var re=r=>i(r).toArray();function te(r=0,t=0){let{data:o,shape:e,strides:n}=this,{length:a}=e;if(t>=a)return o[r];let s=e[t],m=n[t],p=[];for(let f=0;fi(r).toString();function nr(){return`array(${(0,pe.inspect)(this.toArray(),{depth:10,breakLength:40})}, dtype=${this.dtype})`}var ue=r=>i(r).trace();function ce(){let[r,t]=this.shape,{data:o}=this,e=Math.min(r,t),n=0,a;for(a=0;ai(r).transpose();function le(){if(this.shape.length<2)return this;let r=this.shape[0];return this.shape[0]=this.shape[1],this.shape[1]=r,r=this.strides[0],this.strides[0]=this.strides[1],this.strides[1]=r,this}var{trunc:Aa}=Math,he=r=>i(r).trunc();function de(){let{data:r}=this,t=new u(this);for(let o of t)r[o]=Aa(r[o]);return this}var Ae=r=>{if(r<0)throw new Error("invalid n");let t=new Float64Array(r*r),o=new A(t,{shape:[r,r]}),e=new u(o),[n,a]=e.coords;for(let s of e){let m=r-n-1,p=r-a-1;t[s]=(a+m*2+1)%r*r+(p+m*2+1)%r+1,[n,a]=e.coords}return o};var be=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(1);var De=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).map(()=>Math.random());var Ne=(...r)=>{let t=Float32Array,o=!1,e,n,a;switch(r.length){case 2:a=r.pop(),n=1,e=r.pop();break;case 3:a=r.pop(),n=r.pop(),e=r.pop();break;default:throw new Error("invalid range")}if(a-e<0){let f=a;a=e,e=f,o=!0}if(n>a-e)throw new Error("invalid range");let s=new t(Math.ceil((a-e)/n)),m=e,p=0;if(o)for(;m= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n", "/**\n * @module Globals\n */\nexport * from './core';\nexport * from './iterator';\n", "import {\n DType,\n TypedArray,\n TypedArrayConstructor,\n} from './types';\n\nexport const flatten: (array: any[]) => number[] = (array: any[]): number[] =>\n array.reduce(\n (acc: any[], next: any): any[] => acc.concat(Array.isArray(next) ? flatten(next) : next),\n []\n );\n\nexport const is_typed_array: (array: any) => boolean = (array: any): boolean =>\n ArrayBuffer.isView(array) && !(array instanceof DataView);\n\nexport const get_length: (shape: number[]) => number = (shape: number[]): number =>\n shape.reduce((a: number, b: number): number => a * b, 1);\n\nexport const get_shape: (array: any) => number[] = (array: any): number[] => Array.isArray(array) || is_typed_array(array)\n ? [array.length].concat(get_shape(array[0]))\n : [];\n\nexport const get_strides: (shape: number[]) => number[] = (shape: number[]): number[] =>\n [\n ...shape\n .slice(1)\n .map((_: number, i: number): number => shape\n .slice(i + 1)\n .reduce((a: number, b: number): number => a * b, 1)\n ),\n 1,\n];\n\nexport const get_dtype: (array: TypedArray) => DType = (array: TypedArray): DType => {\n const {\n constructor: {\n name = 'Float32Array',\n } = {},\n } = array || {};\n\n switch (name) {\n case 'Int8Array': return 'int8';\n case 'Uint8Array': return 'uint8';\n case 'Int16Array': return 'int16';\n case 'Uint16Array': return 'uint16';\n case 'Int32Array': return 'int32';\n case 'Uint32Array': return 'uint32';\n case 'Uint8ClampedArray': return 'uint8c';\n case 'Float32Array': return 'float32';\n case 'Float64Array': return 'float64';\n default: return 'float64';\n }\n};\n\nexport const get_type: (dtype: DType) => TypedArrayConstructor = (dtype: DType): TypedArrayConstructor => {\n switch (dtype) {\n case 'int8': return Int8Array;\n case 'uint8': return Uint8Array;\n case 'int16': return Int16Array;\n case 'uint16': return Uint16Array;\n case 'int32': return Int32Array;\n case 'uint32': return Uint32Array;\n case 'uint8c': return Uint8ClampedArray;\n case 'float32': return Float32Array;\n case 'float64': return Float64Array;\n default: return Float64Array;\n }\n};", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function array\n * @description `array(...args)` is an alias for `new v(...args)`\n * @param {} ...args\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const array = (...args: any[]): NDArray => new NDArray(...args);\n", "import { NDArray } from '../';\nimport { array } from '../core/array';\n\nexport const V_MAXDIMS = 32;\n\n/**\n * @class NDIter\n * @description Constructs an NDIter instance.\n * @param {NDArray} x\n */\nexport class NDIter implements Iterator {\n /**\n * @name x\n * @memberof NDIter.prototype\n * @type NDArray\n */\n public x: NDArray;\n\n /**\n * @name shape\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name shapem1\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shapem1: number[];\n\n /**\n * @name strides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public strides: number[];\n\n /**\n * @name backstrides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public backstrides: number[];\n\n /**\n * @name length\n * @memberof NDIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name nd\n * @memberof NDIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name ndm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public ndm1: number;\n\n /**\n * @name index\n * @memberof NDIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name coords\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public coords: number[];\n\n /**\n * @name pos\n * @memberof NDIter.prototype\n * @type Number\n */\n public pos: number;\n\n /**\n * @name factors\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public factors: number[];\n\n /**\n * @name contiguous\n * @memberof NDIter.prototype\n * @type Boolean\n */\n public contiguous: boolean;\n\n constructor(x: NDArray | ArrayLike) {\n this.x = array(x);\n const {\n shape,\n strides,\n length,\n } = this.x;\n\n this.length = length;\n this.lengthm1 = length - 1;\n this.nd = shape.length;\n this.ndm1 = this.nd - 1;\n\n this.shape = Array(V_MAXDIMS).fill(0);\n this.strides = Array(V_MAXDIMS).fill(0);\n this.shapem1 = Array(V_MAXDIMS).fill(0);\n this.coords = Array(V_MAXDIMS).fill(0);\n this.backstrides = Array(V_MAXDIMS).fill(0);\n this.factors = Array(V_MAXDIMS).fill(0);\n\n if (this.nd !== 0) {\n this.factors[this.nd - 1] = 1;\n }\n\n this.contiguous = true;\n\n let stride = 1;\n let i;\n for (i = 0; i < this.nd; i += 1) {\n this.shape[i] = shape[i];\n this.shapem1[i] = shape[i] - 1;\n this.strides[i] = strides[i];\n this.backstrides[i] = strides[i] * this.shapem1[i];\n this.coords[i] = 0;\n\n // Check if C-contiguous\n if (shape[this.ndm1 - i] !== 1) {\n if (strides[i] !== stride) {\n this.contiguous = false;\n }\n\n stride *= shape[this.ndm1 - i];\n }\n\n if (i > 0) {\n this.factors[this.ndm1 - i] = this.factors[this.nd - i] * shape[this.nd - i];\n }\n }\n\n this.index = 0;\n this.pos = 0;\n }\n\n /**\n * @function done\n * @memberof NDIter.prototype\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDIter.prototype\n * @description Returns the current element of the iterator\n * @returns {Object} current\n * @returns {Number} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.current(); // { value: 1, done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next1d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 1 dimensional.\n */\n next1d() {\n const {\n strides,\n } = this;\n\n this.pos += strides[0];\n this.coords[0] += 1;\n }\n\n /**\n * @function nextcontiguous\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming its data is contiguous.\n */\n nextcontiguous() {\n this.pos += 1;\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 2 dimensional.\n */\n next2d() {\n const {\n strides,\n shapem1,\n backstrides,\n } = this;\n\n if (this.coords[1] < shapem1[1]) {\n this.coords[1] += 1;\n this.pos += strides[1];\n } else {\n this.coords[1] = 0;\n this.coords[0] += 1;\n this.pos += strides[0] - backstrides[1];\n }\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator\n */\n nextnd() {\n const {\n ndm1,\n shapem1,\n strides,\n backstrides,\n } = this;\n\n let i;\n for (i = ndm1; i >= 0; i -= 1) {\n if (this.coords[i] < shapem1[i]) {\n this.coords[i] += 1;\n this.pos += strides[i];\n break;\n }\n\n this.coords[i] = 0;\n this.pos -= backstrides[i];\n }\n }\n\n /**\n * @function next\n * @memberof NDIter.prototype\n * @description\n * Steps to the next position in the iterator.\n * Returns the current index of the iterator, or undefined if done.\n * @returns {Object}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.next(); // { value: 2, done: false }\n * iter.next(); // { value: 3, done: false }\n * iter.next(); // { done: true }\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n ndm1,\n contiguous,\n } = this;\n\n if (ndm1 === 0) {\n this.next1d();\n } else if (contiguous) {\n this.nextcontiguous();\n } else if (ndm1 === 1) {\n this.next2d();\n } else {\n this.nextnd();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n\n/**\n * @class NDMultiIter\n * @description Constructs an NDMultiIter instance.\n * @param {NDArray[]} ...args\n */\nexport class NDMultiIter implements Iterator {\n /**\n * @name iters\n * @memberof NDMultiIter.prototype\n * @type NDIter[]\n */\n public iters: NDIter[];\n\n /**\n * @name shape\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name nd\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name length\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name numiter\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public numiter: number;\n\n /**\n * @name index\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name pos\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public pos: number[];\n\n constructor(...args: (NDArray | ArrayLike)[]) {\n this.iters = args.map(arg => new NDIter(arg));\n this.numiter = args.length;\n\n let i;\n let nd;\n for (i = 0, nd = 0; i < this.numiter; i += 1) {\n nd = Math.max(nd, this.iters[i].x.shape.length);\n }\n\n this.nd = nd;\n this.shape = Array(nd).fill(0);\n\n let it;\n let j;\n let k;\n let tmp;\n for (i = 0; i < nd; i += 1) {\n this.shape[i] = 1;\n for (j = 0; j < this.numiter; j += 1) {\n it = this.iters[j];\n k = i + it.x.shape.length - nd;\n if (k >= 0) {\n tmp = it.x.shape[k];\n if (tmp == 1) {\n continue;\n }\n if (this.shape[i] == 1) {\n this.shape[i] = tmp;\n\n } else if (this.shape[i] !== tmp) {\n throw new Error('shape mismatch');\n }\n }\n }\n }\n\n tmp = this.shape.reduce((acc, dim) => acc * dim, 1);\n\n this.length = tmp;\n this.lengthm1 = tmp - 1;\n\n for (i = 0; i < this.numiter; i += 1) {\n it = this.iters[i];\n it.nd = this.nd;\n it.ndm1 = this.nd - 1;\n it.length = tmp;\n it.lengthm1 = tmp - 1;\n\n nd = it.x.shape.length;\n if (nd !== 0) {\n it.factors[this.nd - 1] = 1;\n }\n\n for (j = 0; j < this.nd; j += 1) {\n it.shape[j] = this.shape[j];\n it.shapem1[j] = this.shape[j] - 1;\n k = j + nd - this.nd;\n\n if ((k < 0) || it.x.shape[k] !== this.shape[j]) {\n it.contiguous = false;\n it.strides[j] = 0;\n } else {\n it.strides[j] = it.x.strides[k];\n }\n\n it.backstrides[j] = it.strides[j] * it.shapem1[j];\n\n if (j > 0) {\n it.factors[this.nd - j - 1] = it.factors[this.nd - j] * this.shape[this.nd - j]\n }\n }\n }\n\n this.index = 0;\n this.pos = Array(this.numiter).fill(0);\n }\n\n /**\n * @function done\n * @memberof NDMultiIter\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDMultiIter\n * @description Returns the current indices of the iterators\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.current(); // { value: [0, 0], done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next\n * @memberof NDMultiIter\n * @description\n * Steps to the next position in the iterator.\n * Returns the current indices of the iterators, or undefined if done.\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.next(); // { value: [0, 0], done: false }\n * iter.next(); // { value: [1, 1], done: false }\n * iter.next(); // { value: [2, 2], done: false },\n * iter.next(); // { value: undefined, done: true },\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n numiter,\n } = this;\n\n let it;\n let i;\n for (i = 0; i < numiter; i += 1) {\n it = this.iters[i];\n this.pos[i] = it.pos;\n it.next();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { abs: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function abs\n * @description Returns the absolute value of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { abs } from 'vectorious/core/abs';\n * \n * abs([-1, -2, -3]) // => array([1, 2, 3])\n */\nexport const abs = (x: NDArray | ArrayLike): NDArray => array(x).abs();\n\n/**\n * @function abs\n * @memberof NDArray.prototype\n * @description Returns the absolute value of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, -2, -3]).abs() // <=> array([1, 2, 3])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acos\n * @description Returns the arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acos } from 'vectorious/core/acos';\n * \n * acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport const acos = (x: NDArray | ArrayLike): NDArray => array(x).acos();\n\n/**\n * @function acos\n * @memberof NDArray.prototype\n * @description Returns the arccosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acosh\n * @description Returns the hyperbolic arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acosh } from 'vectorious/core/acosh';\n * \n * acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport const acosh = (x: NDArray | ArrayLike): NDArray => array(x).acosh();\n\n/**\n * @function acosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arccosine of each element of current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nblas: any;\ntry {\n nblas = require('nblas');\n} catch (err) {}\n\nexport const NoTrans = nblas && nblas.NoTrans;\nexport const Trans = nblas && nblas.Trans;\n\nexport function axpy(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.daxpy(n, alpha, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.saxpy(n, alpha, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function dot(dtype: DType, n: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.ddot(n, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.sdot(n, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function iamax(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.idamax(n, x, inc_x);\n case 'float32':\n return nblas.isamax(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gemm(dtype: DType, transx: number, transy: number, m: number, n: number, k: number, alpha: number, x: TypedArray, ldx: number, y: TypedArray, ldy: number, beta: number, z: TypedArray, ldz: number) {\n const { length: l1 } = x;\n const { length: l2 } = y;\n const { length: l3 } = z;\n\n if ((transx === nblas.NoTrans && l1 !== ldx * m) || (transx === nblas.Trans && l1 !== ldx * k)) {\n throw new Error('lengths do not match');\n }\n\n if ((transy === nblas.NoTrans && l2 !== ldy * k) || (transy === nblas.Trans && l2 !== ldy * n)) {\n throw new Error('lengths do not match');\n }\n\n if (l3 !== ldz * m) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n case 'float32':\n return nblas.sgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function nrm2(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dnrm2(n, x, inc_x);\n case 'float32':\n return nblas.snrm2(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function scal(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dscal(n, alpha, x, inc_x);\n case 'float32':\n return nblas.sscal(n, alpha, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function add\n * @description\n * Adds `y` multiplied by `alpha` to `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { add } from 'vectorious/core/add';\n * \n * add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])\n */\nexport const add = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, alpha: number = 1): NDArray =>\n array(x).add(array(y), alpha);\n\n/**\n * @function add\n * @memberof NDArray.prototype\n * @description\n * Adds `x` multiplied by `alpha` to the current array.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])\n */\nexport default function (this: NDArray, x: NDArray | ArrayLike, alpha: number = 1): NDArray {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = array(x);\n\n try {\n blas.axpy(dtype, l1, alpha, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n d1[i] += alpha * d2[j];\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function angle\n * @description Determines the angle between the `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {number}\n * @example\n * import { angle } from 'vectorious/core/angle';\n * \n * angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287\n */\nexport const angle = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).angle(array(y));\n\n/**\n * @function angle\n * @memberof NDArray.prototype\n * @description Determines the angle between the current vector and `x`.\n * @param {NDArray} x\n * @returns {number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): number {\n return f(this.dot(array(x)) / this.norm() / array(x).norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asin\n * @description Returns the arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asin } from 'vectorious/core/asin';\n * \n * asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport const asin = (x: NDArray | ArrayLike): NDArray => array(x).asin();\n\n/**\n * @function asin\n * @memberof NDArray.prototype\n * @description Returns the arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asinh\n * @description Returns the hyperbolic arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asinh } from 'vectorious/core/asinh';\n * \n * asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport const asinh = (x: NDArray | ArrayLike): NDArray => array(x).asinh();\n\n/**\n * @function asinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atan\n * @description Returns the arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atan } from 'vectorious/core/atan';\n * \n * atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport const atan = (x: NDArray | ArrayLike): NDArray => array(x).atan();\n\n/**\n * @function atan\n * @memberof NDArray.prototype\n * @description Returns the arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atanh\n * @description Returns the hyperbolic arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atanh } from 'vectorious/core/atanh';\n * \n * atanh([0, -0.5]); // => array([0, -0.5493061542510986])\n */\nexport const atanh = (x: NDArray | ArrayLike): NDArray => array(x).atanh();\n\n/**\n * @function atanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function zeros\n * @description Creates an array containing zeros (`0`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { zeros } from 'vectorious/core/zeros';\n * \n * zeros(3); // => array([0, 0, 0])\n */\nexport const zeros = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(0);\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\n\n/**\n * @static\n * @memberof module:Globals\n * @function augment\n * @description Augments `x` and `y`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { augment } from 'vectorious/core/augment';\n * \n * augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])\n */\nexport const augment = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).augment(array(y));\n\n/**\n * @function augment\n * @memberof NDArray.prototype\n * @description Augments `x` with current matrix.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): NDArray {\n const [r1, c1] = this.shape;\n const [r2, c2] = array(x).shape;\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n if (r2 === 0 || c2 === 0) {\n return this;\n }\n\n if (r1 !== r2) {\n throw new Error('rows do not match');\n }\n\n const y = zeros(r1, c1 + c2);\n const { data: d3 } = y;\n\n let i: number;\n let j: number;\n for (i = 0; i < r1; i += 1) {\n for (j = 0; j < c1; j += 1) {\n d3[i * (c1 + c2) + j] = d1[i * c1 + j];\n }\n }\n\n for (i = 0; i < r2; i += 1) {\n for (j = 0; j < c2; j += 1) {\n d3[i * (c1 + c2) + (j + c1)] = d2[i * c2 + j];\n }\n }\n\n return y;\n};\n", "\nimport { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function binOp\n * @description Perform binary operation `f` on `y` in `x`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { binOp } from 'vectorious/core/binOp';\n * \n * binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport const binOp = (\n x: NDArray | ArrayLike,\n y: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray => array(x).binOp(array(y), f);\n\n/**\n * @function binOp\n * @memberof NDArray.prototype\n * @description Perform binary operation `f` on `x` in the current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport default function(\n this: NDArray,\n x: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i] = f(d1[i], d2[j], i);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cbrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cbrt\n * @description Returns the cube root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport const cbrt = (x: NDArray | ArrayLike): NDArray => array(x).cbrt();\n\n/**\n * @function cbrt\n * @memberof NDArray.prototype\n * @description Returns the cube root of each element of current array.\n * @returns {this}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { ceil: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function ceil\n * @description Returns smallest integer greater than or equal to of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { ceil } from 'vectorious/core/ceil';\n * \n * ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])\n */\nexport const ceil = (x: NDArray | ArrayLike): NDArray => array(x).ceil();\n\n/**\n * @function ceil\n * @memberof NDArray.prototype\n * @description Returns smallest integer greater than or equal to of each element of current array.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function check\n * @description Asserts if indices `i, j, ..., n` are within the bounds of `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { check } from 'vectorious/core/check';\n * \n * check([0.5, 1.5, 2.5], 3); // Error: index out of bounds\n */\nexport const check = (x: NDArray | ArrayLike, ...indices: number[]): void => {\n array(x).check(...indices);\n};\n\n/**\n * @function check\n * @memberof NDArray.prototype\n * @description Asserts if indices `i, j, ..., n` are within the bounds of current array\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds\n */\nexport default function(this: NDArray, ...indices: number[]): void {\n const { shape: s1, length: l1 } = this;\n\n if (indices.length === 1) {\n const [i] = indices;\n if (i < 0 || i > l1 - 1 || !Number.isFinite(i)) {\n throw new Error('index out of bounds');\n }\n } else if (!s1.every((dim: number, i: number) =>\n dim > indices[i]\n && Number.isFinite(indices[i])\n && indices[i] >= 0\n )) {\n throw new Error('index out of bounds');\n }\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function combine\n * @description Combines the vector `x` with `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { combine } from 'vectorious/core/combine';\n * \n * combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport const combine = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).combine(array(y));\n\n/**\n * @function combine\n * @memberof NDArray.prototype\n * @description Combines the current vector with `x`\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n if (this.shape.length !== 1 && x.shape.length !== 1) {\n throw new Error('combine operation not permitted for multidimensional arrays');\n }\n\n const { length: l1, data: d1 } = this;\n const { length: l2, data: d2 } = x;\n\n if (l2 === 0) {\n return this;\n }\n\n if (l1 === 0) {\n this.data = new (get_type(x.dtype))(d2);\n this.length = l2;\n this.dtype = x.dtype;\n\n return this;\n }\n\n const l3: number = l1 + l2;\n const d3: TypedArray = new (get_type(this.dtype))(l3);\n\n d3.set(d1);\n d3.set(d2, l1);\n\n this.data = d3;\n this.length = l3;\n this.shape = [l3];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { NDMultiIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function copy\n * @description Makes a copy of `x`\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { copy } from 'vectorious/core/copy';\n * \n * copy([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const copy = (x: NDArray | ArrayLike): NDArray => array(x).copy();\n\n/**\n * @function copy\n * @memberof NDArray.prototype\n * @description Makes a copy of the class and underlying data\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).copy(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const x = zeros(...this.shape);\n\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d2[j] = d1[i];\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cos\n * @description Returns the cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cos } from 'vectorious/core/cos';\n * \n * cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])\n */\nexport const cos = (x: NDArray | ArrayLike): NDArray => array(x).cos();\n\n/**\n * @function cos\n * @memberof NDArray.prototype\n * @description Returns the cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cosh\n * @description Returns the hyperbolic cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cosh } from 'vectorious/core/cosh';\n * \n * cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport const cosh = (x: NDArray | ArrayLike): NDArray => array(x).cosh();\n\n/**\n * @function cosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function cross\n * @description\n * Computes the cross product of the `x` and the vector `y`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { cross } from 'vectorious/core/cross';\n * \n * cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])\n */\nexport const cross = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).cross(array(y));\n\n/**\n * @function cross\n * @memberof NDArray.prototype\n * @description\n * Computes the cross product of the current vector and the vector `x`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== 3 || l2 !== 3) {\n throw new Error('vectors must have three components');\n }\n\n const c1: number = this.y * x.z - this.z * x.y;\n const c2: number = this.z * x.x - this.x * x.z;\n const c3: number = this.x * x.y - this.y * x.x;\n\n this.x = c1;\n this.y = c2;\n this.z = c3;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function det\n * @description Gets the determinant of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { det } from 'vectorious/core/det';\n * \n * det([[0, 1], [2, 3]]); // => -2\n */\nexport const det = (x: NDArray | ArrayLike): number => array(x).det();\n\n/**\n * @function det\n * @memberof NDArray.prototype\n * @description Gets the determinant of current matrix using LU factorization.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[0, 1], [2, 3]]).det(); // => -2\n */\nexport default function(this: NDArray): number {\n this.square();\n\n const [n] = this.shape;\n const [LU, ipiv] = this.copy().lu_factor();\n const { data: d1 } = LU;\n\n let product: number = 1;\n let sign: number = 1;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n product *= d1[i * n + i];\n if (i !== ipiv[i] - 1) {\n sign *= -1;\n }\n }\n\n return sign * product;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function diagonal\n * @description Gets the diagonal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { diagonal } from 'vectorious/core/diagonal';\n * \n * diagonal([[1, 2], [3, 4]]); // => array([1, 4])\n */\nexport const diagonal = (x: NDArray | ArrayLike): NDArray =>\n array(x).diagonal();\n\n/**\n * @function diagonal\n * @memberof NDArray.prototype\n * @description Gets the diagonal of current matrix.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).diagonal(); // => array([1, 4])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { length: l1 } = this;\n const [r, c] = this.shape;\n const l2: number = Math.min(r, c);\n\n return this.reshape(l1).slice(0, l1, l2 + 1);\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function dot\n * @description\n * Performs dot multiplication with `x` and `y`.\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {Number}\n * @example\n * import { dot } from 'vectorious/core/dot';\n * \n * dot([1, 2, 3], [4, 5, 6]); // => 32\n */\nexport const dot = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).dot(array(y));\n\n/**\n * @function dot\n * @memberof NDArray.prototype\n * @description\n * Performs dot multiplication with `x` and current array\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).dot([4, 5, 6]); // => 32\n */\nexport default function(this: NDArray, x: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = x;\n\n let result: number = 0;\n try {\n result = blas.dot(dtype, l1, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n result += d1[i] * d2[j];\n }\n }\n\n return result;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function eye\n * @description Creates an identity matrix of size `n` and type `type`.\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { eye } from 'vectorious/core/eye';\n * \n * eye(2); // => array([[1, 0], [0, 1]])\n */\nexport const eye = (n: number): NDArray => {\n const x = new NDArray(new Float64Array(n * n), { shape: [n, n] });\n const { data: d1 } = x;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n d1[i * n + i] = 1;\n }\n\n return x;\n};\n", "import { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { eye } from './eye';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\n/**\n * @ignore\n * \u250C \u2510 \u250C \u2510\u250C \u2510\n * \u2502Skl\u2502 \u2502c \u2212s\u2502\u2502Skl\u2502\n * \u2502 \u2502 := \u2502 \u2502\u2502 \u2502\n * \u2502Sij\u2502 \u2502s c\u2502\u2502Sij\u2502\n * \u2514 \u2518 \u2514 \u2518\u2514 \u2518\n */\nconst rotate:\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number) => void =\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number): void => {\n const [n] = x.shape;\n const { data: d1 } = x;\n const temp: number = d1[k * n + l];\n const tau: number = 1 / (c + s);\n\n d1[k * n + l] = temp - s * (d1[i * n + j] + tau * temp);\n d1[i * n + j] += s * (temp - tau * d1[i * n + j]);\n };\n\n/**\n * @static\n * @memberof module:Globals\n * @function eig\n * @description\n * Gets eigenvalues and eigenvectors of `x` using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { eig } from 'vectorious/core/eig';\n * \n * eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport const eig = (x: NDArray | ArrayLike): [NDArray, NDArray] => array(x).eig();\n\n/**\n * @function eig\n * @memberof NDArray.prototype\n * @description\n * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport default function(this: NDArray): [NDArray, NDArray] {\n this.square();\n\n const [n] = this.shape;\n\n try {\n if (!['float32', 'float64'].includes(this.dtype)) {\n this.dtype = 'float32';\n this.data = get_type(this.dtype).from(this.data);\n }\n\n const jobvl: typeof nlapack.NDArrayEigenvector = nlapack.NoEigenvector;\n const jobvr: typeof nlapack.NDArrayEigenvector = nlapack.Eigenvector;\n\n const wr = zeros(n);\n const wi = zeros(n);\n\n const vl = zeros(n, n);\n const vr = zeros(n, n);\n\n const { data: d1 } = this;\n const { data: d2 } = wr;\n const { data: d3 } = wi;\n const { data: d4 } = vl;\n const { data: d5 } = vr;\n if (this.dtype === 'float64') {\n nlapack.dgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n if (this.dtype === 'float32') {\n nlapack.sgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n return [wr, vr];\n } catch (err) {\n const { data: d1 } = this;\n const p = eye(n);\n\n let max = 0;\n let i = 0;\n let j = 0;\n let k = 0;\n let l = 0;\n\n do {\n // Find maximum off-diagonal element\n for (i = 0; i < n; i += 1) {\n for (j = i + 1; j < n; j += 1) {\n if (Math.abs(d1[i * n + j]) >= max) {\n max = Math.abs(d1[i * n + j]);\n k = i;\n l = j;\n }\n }\n }\n\n // Find c and s\n let t;\n if (Math.abs(d1[k * n + l]) < Math.abs(d1[l * n + l]) * 1e-36) {\n t = d1[k * n + l] / d1[l * n + l];\n } else {\n const phi = d1[l * n + l] / 2 * d1[k * n + l];\n t = 1 / (Math.abs(phi) + Math.sqrt(phi * phi + 1));\n }\n\n const c = 1 / Math.sqrt(t * t + 1);\n const s = t * c;\n\n const e = d1[k * n + l];\n d1[k * n + l] = 0;\n d1[k * n + k] -= t * e;\n d1[l * n + l] += t * e;\n\n // Rotate rows and columns k and l\n for (i = 0; i < k; i += 1) {\n rotate(this, c, s, i, k, i, l);\n }\n\n for (i = k + 1; i < l; i += 1) {\n rotate(this, c, s, k, i, i, l);\n }\n\n for (i = l + 1; i < n; i += 1) {\n rotate(this, c, s, k, i, l, i);\n }\n\n // Rotate eigenvectors\n for (i = 0; i < n; i += 1) {\n rotate(p, c, s, i, k, i, l);\n }\n } while (max >= 1e-9);\n\n return [this.diagonal(), p];\n }\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function equals\n * @description Checks if `x` and `y` are equal.\n * @param {NDArray} x\n * @param {NDArray} y\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * equals([1, 2, 3], [1, 2, 3]); // => true\n */\nexport const equals = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, tolerance: number = 1e-6): boolean =>\n array(x).equals(array(y), tolerance);\n\n/**\n * @function equals\n * @memberof NDArray.prototype\n * @description Checks if current array and `x` are equal.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * array([1, 2, 3]).equals([1, 2, 3]); // => true\n */\nexport default function(this: NDArray, x: NDArray, tolerance: number = 1e-6): boolean {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n if (Math.abs(d1[i] - d2[j]) > tolerance) {\n return false;\n }\n }\n\n return true;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equidimensional\n * @description Asserts if `x` and `y` have the same shape\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} shapes x and y do not match\n * @example\n * import { equidimensional } from 'vectorious/core/equidimensional';\n * \n * equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport const equidimensional = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equidimensional(array(y));\n};\n\n/**\n * @deprecated\n * @function equidimensional\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same shape\n * @param {NDArray} x\n * @throws {Error} shapes x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { shape: s1 } = this;\n const { shape: s2 } = x;\n\n if (!s1.every((dim: number, i: number) => dim === s2[i])) {\n throw new Error(`shapes ${s1} and ${s2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equilateral\n * @description Asserts if `x` and `y` have the same length\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} lengths x and y do not match\n * @example\n * import { equilateral } from 'vectorious/core/equilateral';\n * \n * equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport const equilateral = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equilateral(array(y));\n};\n\n/**\n * @deprecated\n * @function equilateral\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same length\n * @param {NDArray} x\n * @throws {Error} lengths x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== l2) {\n throw new Error(`lengths ${l1} and ${l2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { exp: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function exp\n * @description\n * Returns e^x of each element of `x`, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { exp } from 'vectorious/core/exp';\n * \n * exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport const exp = (x: NDArray | ArrayLike): NDArray => array(x).exp();\n\n/**\n * @function exp\n * @memberof NDArray.prototype\n * @description\n * Returns e^x of each element of current array, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { expm1: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function expm1\n * @description Returns subtracting 1 from exp(x) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { expm1 } from 'vectorious/core/expm1';\n * \n * expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport const expm1 = (x: NDArray | ArrayLike): NDArray => array(x).expm1();\n\n/**\n * @function expm1\n * @memberof NDArray.prototype\n * @description Returns subtracting 1 from exp(x) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function fill\n * @description Fills `x` with a scalar value\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { fill } from 'vectorious/core/fill';\n * \n * fill([1, 2, 3], 0); // => array([0, 0, 0])\n */\nexport const fill = (\n x: NDArray | ArrayLike,\n value: number | ((index: number) => number) = 0\n): NDArray =>\n array(x).fill(value);\n\n/**\n * @function fill\n * @memberof NDArray.prototype\n * @description Fills the current array with a scalar value\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])\n */\nexport default function(this: NDArray, value: number | ((index: number) => number) = 0): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = value instanceof Function ? value(iter.pos) : value;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { floor: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function floor\n * @description Returns the largest integer less than or equal to a number of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { floor } from 'vectorious/core/floor';\n * \n * floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])\n */\nexport const floor = (x: NDArray | ArrayLike): NDArray => array(x).floor();\n\n/**\n * @function floor\n * @memberof NDArray.prototype\n * @description Returns the largest integer less than or equal to a number of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function forEach\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {NDArray} x\n * @param {Function} f\n * @example\n * import { forEach } from 'vectorious/core/forEach';\n * \n * forEach([1, 2, 3], console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport const forEach = (\n x: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void => {\n x.forEach(f);\n};\n\n/**\n * @function forEach\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {Function} f\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).forEach(console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n f.call(this, d1[i!], i!, d1);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { fround: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function fround\n * @description Returns the nearest single precision float representation of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { fround } from 'vectorious/core/fround';\n * \n * fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])\n */\nexport const fround = (x: NDArray | ArrayLike): NDArray => array(x).fround();\n\n/**\n * @function fround\n * @memberof NDArray.prototype\n * @description Returns the nearest single precision float representation of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\nexport function getrf(dtype: DType, m: number, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== m * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetrf(m, n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetrf(m, n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function getri(dtype: DType, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== n * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetri(n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetri(n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gesv(dtype: DType, n: number, nrhs: number, x: TypedArray, ldx: number, ipiv: Int32Array, y: TypedArray, ldy: number) {\n if (x.length !== ldx * n || y.length !== ldy * nrhs) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n case 'float32':\n return nlapack.sgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n// import { diagonal } from './diagonal';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function gauss\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { gauss } from 'vectorious/core/gauss';\n * \n * gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])\n */\nexport const gauss = (x: NDArray | ArrayLike): NDArray => array(x).gauss();\n\n/**\n * @function gauss\n * @memberof NDArray.prototype\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])\n */\nexport default function(this: NDArray): NDArray {\n const { shape: [r, c], data: d1, dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(Math.min(r, c));\n\n lapack.getrf(dtype, r, c, d1, c, ipiv);\n\n const iter = new NDIter(this);\n\n // Zero out lower triangular part of matrix\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d1[i!] = 0;\n }\n\n [ci, cj] = iter.coords;\n }\n } catch (err) {\n let lead: number = 0;\n let leadValue: number;\n let pivot: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (i = 0; i < r; i += 1) {\n if (c <= lead) {\n return this;\n }\n\n j = i;\n while (d1[j * c + lead] === 0) {\n j += 1;\n if (r === j) {\n j = i;\n lead += 1;\n\n if (c === lead) {\n return this;\n }\n }\n }\n\n if (i !== j) {\n this.swap(i, j);\n }\n\n pivot = d1[i * c + lead];\n if (pivot !== 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n\n for (j = 0; j < r; j += 1) {\n leadValue = d1[j * c + lead];\n if (j !== i) {\n for (k = 0; k < c; k += 1) {\n d1[j * c + k] -= d1[i * c + k] * leadValue;\n }\n }\n }\n\n lead += 1;\n }\n\n for (i = 0; i < r; i += 1) {\n pivot = 0;\n for (j = 0; j < c; j += 1) {\n if (pivot === 0) {\n pivot = d1[i * c + j];\n }\n }\n\n if (pivot === 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function get\n * @description Gets the element at `i, j, ..., n` from `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { get } from 'vectorious/core/get';\n * \n * get([1, 2, 3], 2); // 3\n */\nexport const get = (x: NDArray | ArrayLike, ...indices: number[]): number =>\n array(x).get(...indices);\n\n/**\n * @function get\n * @memberof NDArray.prototype\n * @description Gets the element at `i, j, ..., n` from current vector.\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).get(2); // 3\n */\nexport default function(this: NDArray, ...indices: number[]): number {\n this.check(...indices);\n\n const { data: d1, shape: s1 } = this;\n const { length: ndim } = s1;\n let index: number = indices[ndim - 1];\n\n let i: number;\n let j: number;\n for (i = 0; i < ndim - 1; i += 1) {\n let p: number = 1;\n for (j = i + 1; j < ndim; j += 1) {\n p *= s1[j];\n }\n\n index += indices[i] * p;\n }\n\n return d1[index];\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { eye } from './eye';\nimport { augment } from './augment';\nimport { zeros } from './zeros';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function inv\n * @description\n * Determines the inverse of `x`.\n * Accelerated with LAPACK `?getrf` and `?getri`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { inv } from 'vectorious/core/inv';\n * \n * inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport const inv = (x: NDArray | ArrayLike): NDArray => array(x).inv();\n\n/**\n * @function inv\n * @memberof NDArray.prototype\n * @description\n * Determines the inverse of current matrix using Gaussian elimination.\n * Accelerated with LAPACK `?getri`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { shape: [n], dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(n);\n\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n lapack.getri(dtype, n, d1, n, ipiv);\n\n return this;\n } catch (err) {\n const identity = eye(n);\n const rref = augment(this, identity).gauss();\n const left = zeros(n, n);\n const right = zeros(n, n);\n\n const { data: d1 } = rref;\n const { data: d2 } = left;\n const { data: d3 } = right;\n\n const iter = new NDIter(rref);\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < n) {\n d2[ci * n + cj] = d1[i!];\n } else {\n d3[ci * n + (cj - n)] = d1[i!];\n }\n\n [ci, cj] = iter.coords;\n }\n\n if (!left.equals(identity)) {\n throw new Error('matrix is not invertible');\n }\n\n return right;\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log\n * @description Returns the natural logarithm (log_e, also ln) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log } from 'vectorious/core/log';\n * \n * log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport const log = (x: NDArray | ArrayLike): NDArray => array(x).log();\n\n/**\n * @function log\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log10: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log10\n * @description Returns the base 10 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log10 } from 'vectorious/core/log10';\n * \n * log10([10, 100, 1000]); // => array([1, 2, 3])\n */\nexport const log10 = (x: NDArray | ArrayLike): NDArray => array(x).log10();\n\n/**\n * @function log10\n * @memberof NDArray.prototype\n * @description Returns the base 10 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log1p: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log1p\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log1p } from 'vectorious/core/log1p';\n * \n * log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport const log1p = (x: NDArray | ArrayLike): NDArray => array(x).log1p();\n\n/**\n * @function log1p\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log2: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log2\n * @description Returns the base 2 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log2 } from 'vectorious/core/log2';\n * \n * log2([1, 2, 4]); // => array([0, 1, 2])\n */\nexport const log2 = (x: NDArray | ArrayLike): NDArray => array(x).log2();\n\n/**\n * @function log2\n * @memberof NDArray.prototype\n * @description Returns the base 2 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 4]).log2(); // => array([0, 1, 2])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu\n * @description\n * Performs full LU decomposition on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu } from 'vectorious/core/lu';\n * \n * lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu = (x: NDArray | ArrayLike): [NDArray, NDArray, Int32Array] =>\n array(x).lu();\n\n/**\n * @function lu\n * @memberof NDArray.prototype\n * @description\n * Performs full LU decomposition on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function (this: NDArray): [NDArray, NDArray, Int32Array] {\n const [LU, ipiv] = this.copy().lu_factor();\n const L = LU.copy();\n const U = LU.copy();\n const { data: d1 } = L;\n const { data: d2 } = U;\n\n const iter = new NDIter(LU);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d2[i!] = 0;\n } else {\n d1[i!] = ci === cj ? 1 : 0;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return [L, U, ipiv];\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu_factor\n * @description\n * Performs LU factorization on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu_factor } from 'vectorious/core/lu_factor';\n * \n * lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu_factor = (x: NDArray | ArrayLike): [NDArray, Int32Array] =>\n array(x).lu_factor();\n\n/**\n * @function lu_factor\n * @memberof NDArray.prototype\n * @description\n * Performs LU factorization on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function(this: NDArray): [NDArray, Int32Array] {\n const { data: d1, shape: [n], dtype } = this;\n const ipiv: Int32Array = new Int32Array(n);\n\n try {\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n } catch (err) {\n let max: number;\n let abs: number;\n let diag: number;\n let p: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (k = 0; k < n; k += 1) {\n p = k;\n max = Math.abs(d1[k * n + k]);\n for (j = k + 1; j < n; j += 1) {\n abs = Math.abs(d1[j * n + k]);\n if (max < abs) {\n max = abs;\n p = j;\n }\n }\n\n ipiv[k] = p + 1;\n\n if (p !== k) {\n this.swap(k, p);\n }\n\n diag = d1[k * n + k];\n for (i = k + 1; i < n; i += 1) {\n d1[i * n + k] /= diag;\n }\n\n for (i = k + 1; i < n; i += 1) {\n for (j = k + 1; j < n - 1; j += 2) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n d1[i * n + j + 1] -= d1[i * n + k] * d1[k * n + j + 1];\n }\n\n if (j === n - 1) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n }\n }\n }\n }\n\n return [this, ipiv];\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function map\n * @description Equivalent to `TypedArray.prototype.map`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { map } from 'vectorious/core/map';\n * \n * map([1, 2, 3], value => -value); // => array([-1, -2, -3])\n */\nexport const map = (\n x: NDArray | ArrayLike,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray => array(x).map(f);\n\n/**\n * @function map\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.map`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n const map = f.bind(this);\n\n const copy = this.copy();\n const { data: d2 } = copy;\n\n for (const i of iter) {\n d2[i!] = map(d1[i!], i!, d1);\n }\n\n return copy;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function max\n * @description\n * Gets the maximum value (largest) element of `x`.\n * Accelerated with BLAS `i?amax`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { max } from 'vectorious/core/max';\n * \n * max([1, 2, 3]); // => 3\n */\nexport const max = (x: NDArray | ArrayLike): number => array(x).max();\n\n/**\n * @function max\n * @memberof NDArray.prototype\n * @description\n * Gets the maximum value (smallest) element of current array.\n * Accelerated with BLAS `i?amax`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).max(); // => 3\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let max: number = Number.NEGATIVE_INFINITY;\n\n try {\n max = d1[blas.iamax(dtype, l1, d1, 1)];\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n const value = d1[i!];\n if (max < value) {\n max = value;\n }\n }\n }\n\n return max;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function mean\n * @description Gets the arithmetic mean of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { mean } from 'vectorious/core/mean';\n * \n * mean([1, 2, 3]); // => 2\n */\nexport const mean = (x: NDArray | ArrayLike): number => array(x).mean();\n\n/**\n * @function mean\n * @memberof NDArray.prototype\n * @description Gets the arithmetic mean of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).mean(); // => 2\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1 } = this;\n const iter = new NDIter(this);\n\n let mean: number = 0;\n for (const i of iter) {\n mean += d1[i!];\n }\n\n return mean / l1;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function min\n * @description Gets the minimum value (smallest) element of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { min } from 'vectorious/core/min';\n * \n * min([1, 2, 3]); // => 1\n */\nexport const min = (x: NDArray | ArrayLike): number => array(x).min();\n\n/**\n * @function min\n * @memberof NDArray.prototype\n * @description Gets the minimum value (smallest) element of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).min(); // 1\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n\n const iter = new NDIter(this);\n\n let min: number = Number.POSITIVE_INFINITY;\n for (const i of iter) {\n const value = d1[i!];\n if (min > value) {\n min = value;\n }\n }\n\n return min;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function matrix\n * @description Creates a matrix of `r` rows and `c` columns.\n * @param {Number} r\n * @param {Number} c\n * @returns {NDArray}\n * @example\n * import { matrix } from 'vectorious/core/matrix';\n * \n * matrix(2, 2); // => array([[0, 0], [0, 0]])\n */\nexport const matrix = (r: number, c: number): NDArray =>\n new NDArray(\n new Float64Array(r * c),\n { shape: [r, c] }\n );\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { matrix } from './matrix';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function multiply\n * @description\n * Multiplies two matrices `x` and `y` of matching dimensions.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { multiply } from 'vectorious/core/multiply';\n * \n * multiply([[1, 2]], [[1], [2]]); // => array([[5]])\n */\nexport const multiply = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).multiply(array(y));\n\n/**\n * @function multiply\n * @memberof NDArray.prototype\n * @description\n * Multiplies current matrix with `x`.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { shape: [r1, c1], data: d1, dtype } = this;\n const { shape: [r2, c2], data: d2 } = x;\n\n if (c1 !== r2) {\n throw new Error('sizes do not match');\n }\n\n const y = matrix(r1, c2);\n const { data: d3 } = y;\n\n try {\n blas.gemm(dtype, blas.NoTrans, blas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);\n } catch (err) {\n const iter = new NDIter(y);\n\n let k;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n let sum = 0;\n for (k = 0; k < c1; k += 1) {\n sum += d1[ci * c1 + k] * d2[k * c2 + cj];\n }\n\n d3[i!] = sum;\n [ci, cj] = iter.coords;\n }\n }\n\n return y;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as blas from '../blas';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function norm\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { norm } from 'vectorious/core/norm';\n * \n * norm([1, 2, 3]); // => 3.7416574954986572\n */\nexport const norm = (x: NDArray | ArrayLike): number => array(x).norm();\n\n/**\n * @function norm\n * @memberof NDArray.prototype\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).norm(); // => 3.7416574954986572\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let result: number = 0;\n\n try {\n result = blas.nrm2(dtype, l1, d1, 1);\n } catch (err) {\n result = f(this.dot(this));\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function normalize\n * @description Normalizes `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { normalize } from 'vectorious/core/normalize';\n * \n * normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport const normalize = (x: NDArray | ArrayLike): NDArray =>\n array(x).normalize();\n\n/**\n * @function normalize\n * @memberof NDArray.prototype\n * @description Normalizes current vector.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport default function(this: NDArray): NDArray {\n return this.scale(1 / this.norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { pow: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function pow\n * @description Returns each element of `x` to the exponent power, that is, element^exponent.\n * @param {NDArray} x\n * @param {Number} exponent\n * @returns {NDArray}\n * @example\n * import { pow } from 'vectorious/core/pow';\n * \n * pow([1, 2, 3], 2); // => array([1, 4, 9])\n */\nexport const pow = (x: NDArray | ArrayLike, exponent: number): NDArray =>\n array(x).pow(exponent);\n\n/**\n * @function pow\n * @memberof NDArray.prototype\n * @description Returns each element of current array to the exponent power, that is, element^exponent.\n * @param {Number} exponent\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])\n */\nexport default function(this: NDArray, exponent: number): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!], exponent);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function prod\n * @description Product of all elements of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { prod } from 'vectorious/core/prod';\n * \n * prod([1, 2, 3]); // => 6\n */\nexport const prod = (x: NDArray | ArrayLike): number => array(x).prod();\n\n/**\n * @function prod\n * @memberof NDArray.prototype\n * @description Product of all elements of current array\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).prod(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let prod: number = 1;\n for (const i of iter) {\n prod *= d1[i!];\n }\n\n return prod;\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function product\n * @description Hadamard product of `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { product } from 'vectorious/core/product';\n * \n * product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])\n */\nexport const product = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).product(array(y));\n\n/**\n * @function product\n * @memberof NDArray.prototype\n * @description Hadamard product of current matrix and `x`\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i!] *= d2[j!];\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function project\n * @description Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { project } from 'vectorious/core/project';\n * \n * project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport const project = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).project(array(y));\n\n/**\n * @function project\n * @memberof NDArray.prototype\n * @description Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n return x.scale(this.dot(x) / x.dot(x));\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function push\n * @description Pushes a new `value` into `x`.\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { push } from 'vectorious/core/push';\n * \n * push([1, 2, 3], 4); // => array([1, 2, 3, 4])\n */\nexport const push = (x: NDArray | ArrayLike, value: number): NDArray =>\n array(x).push(value);\n\n/**\n * @function push\n * @memberof NDArray.prototype\n * @description Pushes a new `value` into current vector.\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])\n */\nexport default function(this: NDArray, value: number): NDArray {\n if (this.shape.length !== 1) {\n throw new Error('push operation not permitted for multidimensional arrays');\n }\n\n const { data: d1, length: l1 } = this;\n const l2: number = l1 + 1;\n const d2: TypedArray = new (get_type(this.dtype))(l2);\n\n d2.set(d1);\n d2[l1] = value;\n\n this.data = d2;\n this.length = l2;\n this.shape = [l2];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function rank\n * @description Finds the rank of `x` using gaussian elimination.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { rank } from 'vectorious/core/rank';\n * \n * rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1\n */\nexport const rank = (x: NDArray | ArrayLike, tolerance: number = 1e-6): number => array(x).rank(tolerance);\n\n/**\n * @function rank\n * @memberof NDArray.prototype\n * @description Finds the rank of current matrix using gaussian elimination.\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1\n * @todo Switch to SVD algorithm\n */\nexport default function(this: NDArray, tolerance: number = 1e-6): number {\n const { data: d1 } = this.copy().gauss();\n\n const iter = new NDIter(this);\n\n let rk: number = 0;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (rk <= ci && cj >= ci && d1[i!] > tolerance) {\n rk += 1;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return rk;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reciprocal\n * @description Gets the element-wise reciprocal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { reciprocal } from 'vectorious/core/reciprocal';\n * \n * reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport const reciprocal = (x: NDArray | ArrayLike): NDArray =>\n array(x).reciprocal();\n\n/**\n * @function reciprocal\n * @memberof NDArray.prototype\n * @description Gets the element-wise reciprocal of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = 1 / d1[i!];\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reduce\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {NDArray} x\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { reduce } from 'vectorious/core/reduce';\n * \n * reduce([1, 2, 3], (a, b) => a + b, 0); // => 6\n */\nexport const reduce = (\n x: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number => array(x).reduce(f, initialValue);\n\n/**\n * @function reduce\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6\n */\nexport default function(\n this: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number {\n const { data: d1, length: l1 } = this;\n if (l1 === 0 && typeof initialValue === 'undefined') {\n throw new Error('Reduce of empty array with no initial value.');\n }\n\n const iter = new NDIter(this);\n const reduce = f.bind(this);\n\n let value: number;\n\n if (typeof initialValue === 'undefined') {\n value = d1[0];\n iter.next();\n } else {\n value = initialValue;\n }\n\n for (const i of iter) {\n value = reduce(value, d1[i!], i!, d1);\n }\n\n return value;\n};\n", "import { get_strides } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reshape\n * @description Reshapes `x`\n * @param {NDArray} x\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { reshape } from 'vectorious/core/reshape';\n * \n * reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])\n */\nexport const reshape = (x: NDArray | ArrayLike, ...shape: number[]): NDArray =>\n array(x).reshape(...shape);\n\n/**\n * @function reshape\n * @memberof NDArray.prototype\n * @description Reshapes current array\n * @param {Number[]} ...shape\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])\n */\nexport default function(this: NDArray, ...shape: number[]): NDArray {\n const { length } = this;\n if (shape.reduce((sum: number, dim: number) => sum * dim, 1) !== length) {\n throw new Error(`shape ${shape} does not match length ${length}`);\n }\n\n this.shape = shape;\n this.strides = get_strides(shape);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { round: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function round\n * @description Returns the value of each element of `x` rounded to the nearest integer.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { round } from 'vectorious/core/round';\n * \n * round([1.2, 2.8, 3.5]); // => array([1, 3, 4])\n */\nexport const round = (x: NDArray | ArrayLike): NDArray => array(x).round();\n\n/**\n * @function round\n * @memberof NDArray.prototype\n * @description Returns the value of each element of current array rounded to the nearest integer.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function row_add\n * @description Adds a multiple of one row multiplied by `scalar` to another inside `x`.\n * @param {NDArray} x\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { row_add } from 'vectorious/core/row_add';\n * \n * row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])\n */\nexport const row_add = (\n x: NDArray | ArrayLike,\n dest: number,\n source: number,\n scalar: number = 1\n): NDArray =>\n array(x).row_add(dest, source, scalar);\n\n/**\n * @function row_add\n * @memberof NDArray.prototype\n * @description Adds a multiple of one row multiplied by `scalar` to another inside current matrix.\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])\n */\nexport default function(this: NDArray, dest: number, source: number, scalar: number = 1): NDArray {\n this.check(dest, 0);\n this.check(source, 0);\n\n const [, c] = this.shape;\n const { data: d1 } = this;\n\n let j: number;\n for (j = 0; j < c; j += 1) {\n d1[dest * c + j] += d1[source * c + j] * scalar;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function scale\n * @description\n * Multiplies all elements of `x` with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {NDArray} x\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { scale } from 'vectorious/core/scale';\n * \n * scale([1, 2, 3], 2); // => array([2, 4, 6])\n */\nexport const scale = (x: NDArray | ArrayLike, scalar: number): NDArray =>\n array(x).scale(scalar);\n\n/**\n * @function scale\n * @memberof NDArray.prototype\n * @description\n * Multiplies all elements of current array with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])\n */\nexport default function(this: NDArray, scalar: number): NDArray {\n const { data: d1, length: l1, dtype } = this;\n\n try {\n blas.scal(dtype, l1, scalar, d1, 1);\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] *= scalar;\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function set\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { set } from 'vectorious/core/set';\n * \n * set([1, 2, 3], 1, 0); // => array([1, 0, 3])\n */\nexport const set = (x: NDArray, ...args: number[]): void => {\n x.set(...args);\n};\n\n/**\n * @function set\n * @memberof NDArray.prototype\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])\n */\nexport default function(this: NDArray, ...args: number[]): void {\n const indices: number[] = args.slice(0, -1);\n const value: number = args[args.length - 1];\n\n this.check(...indices);\n\n const { shape: s1 } = this;\n let index: number = indices[indices.length - 1];\n\n let i: number;\n for (i = 0; i < indices.length - 1; i += 1) {\n index += indices[i] * s1[i + 1];\n }\n\n this.data[index] = value;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sign: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sign\n * @description\n * Returns the sign of each element of `x`, indicating\n * whether it is positive, negative or zero.\n * @param {Number} x\n * @returns {NDArray}\n * @example\n * import { sign } from 'vectorious/core/sign';\n * \n * sign([1, 2, 3]); // => array([1, 1, 1])\n */\nexport const sign = (x: NDArray | ArrayLike): NDArray => array(x).sign();\n\n/**\n * @function sign\n * @memberof NDArray.prototype\n * @description\n * Returns the sign of each element of current array, indicating\n * whether it is positive, negative or zero.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sign(); // <=> array([1, 1, 1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sin\n * @description Returns the sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sin } from 'vectorious/core/sin';\n * \n * sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])\n */\nexport const sin = (x: NDArray | ArrayLike): NDArray => array(x).sin();\n\n/**\n * @function sin\n * @memberof NDArray.prototype\n * @description Returns the sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sinh\n * @description Returns the hyperbolic sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sinh } from 'vectorious/core/sinh';\n * \n * sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport const sinh = (x: NDArray | ArrayLike): NDArray => array(x).sinh();\n\n/**\n * @function sinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { get_strides } from '../util';\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function slice\n * @description Slices `x` in the corresponding dimension\n * @param {NDArray} x\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {NDArray}\n * @example\n * import { slice } from 'vectorious/core/slice';\n * \n * slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])\n */\nexport const slice = (\n x: NDArray | ArrayLike,\n begin?: number,\n end?: number,\n step?: number\n): NDArray =>\n array(x).slice(begin, end, step);\n\n/**\n * @function slice\n * @memberof NDArray.prototype\n * @description Slices the current array in the corresponding dimension\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])\n */\nexport default function(\n this: NDArray,\n begin: number = 0,\n end: number = this.shape[0],\n step: number = 1\n): NDArray {\n const { shape: s1 } = this;\n const nd = s1.length;\n\n if (begin < 0 || end < 0) {\n return this.slice(begin < 0 ? nd + begin : begin, end < 0 ? nd + end : end);\n }\n\n if (step === 0) {\n throw new Error('step argument cannot be 0');\n }\n\n const s2: number[] = [Math.ceil((end - begin) / step), ...s1.slice(1)];\n const l2: number = s2.reduce((sum: number, dim: number) => sum * dim, 1);\n const st2: number[] = get_strides(s2);\n\n this.shape = s2;\n this.length = l2;\n this.strides = st2;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function solve\n * @description\n * Solves the equation AX = B (where A is `x` and B is `y`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { solve } from 'vectorious/core/solve';\n * \n * solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport const solve = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).solve(array(y));\n\n/**\n * @function solve\n * @memberof NDArray.prototype\n * @description\n * Solves the equation AX = B (where A is current matrix and B is `x`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1, dtype } = this;\n const { data: d2, shape: [n, nrhs] } = x;\n\n try {\n const ipiv: Int32Array = new Int32Array(n);\n lapack.gesv(dtype, n, nrhs, d1, n, ipiv, d2, nrhs);\n } catch (err) {\n const [LU, ipiv] = this.lu_factor();\n const { data: d1 } = LU;\n const { data: d2 } = x;\n\n let i: number;\n let j: number;\n let k: number;\n\n for (i = 0; i < ipiv.length; i += 1) {\n if (i !== ipiv[i] - 1) {\n x.swap(i, ipiv[i] - 1);\n }\n }\n\n for (k = 0; k < nrhs; k += 1) {\n for (i = 0; i < n; i += 1) {\n for (j = 0; j < i; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n }\n\n for (i = n - 1; i >= 0; i -= 1) {\n for (j = i + 1; j < n; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n\n d2[i * nrhs + k] /= d1[i * n + i];\n }\n }\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sqrt\n * @description Returns the positive square root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sqrt } from 'vectorious/core/sqrt';\n * \n * sqrt([1, 4, 9]); // => array([1, 2, 3])\n */\nexport const sqrt = (x: NDArray | ArrayLike): NDArray => array(x).sqrt();\n\n/**\n * @function sqrt\n * @memberof NDArray.prototype\n * @description Returns the positive square root of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 4, 9]); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function square\n * @description Asserts if `x` is square.\n * @param {NDArray} x\n * @throws {Error} matrix is not square\n * @example\n * import { square } from 'vectorious/core/square';\n * \n * square([1, 2, 3]); // Error: matrix is not square\n */\nexport const square = (x: NDArray | ArrayLike): void => {\n array(x).square();\n};\n\n/**\n * @function square\n * @memberof NDArray.prototype\n * @description Asserts if current matrix is square.\n * @throws {Error} matrix is not square\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).square(); // Error: matrix is not square\n */\nexport default function(this: NDArray): void {\n const { length } = this.shape;\n const [r, c] = this.shape;\n\n if (length !== 2 || r !== c) {\n throw new Error('matrix is not square');\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function subtract\n * @description\n * Subtracts `y` from `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { subtract } from 'vectorious/core/subtract';\n * \n * subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])\n */\nexport const subtract = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).subtract(array(y));\n\n/**\n * @function subtract\n * @memberof NDArray.prototype\n * @description\n * Subtracts `x` from the current array.\n * Accelerated with BLAS `?axpy`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])\n */\nexport default function (this: NDArray, x: NDArray): NDArray {\n return this.add(x, -1);\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function sum\n * @description Sum of `x`\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { sum } from 'vectorious/core/sum';\n * \n * sum([1, 2, 3]); // => 6\n */\nexport const sum = (x: NDArray | ArrayLike): number => array(x).sum();\n\n/**\n * @function sum\n * @memberof NDArray.prototype\n * @description Sum of array elements\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sum(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let sum: number = 0;\n for (const i of iter) {\n sum += d1[i!];\n }\n\n return sum;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function swap\n * @description Swaps two rows `i` and `j` in `x`.\n * @param {NDArray} x\n * @param {Number} i\n * @param {Number} j\n * @returns {NDArray}\n * @example\n * import { swap } from 'vectorious/core/swap';\n * \n * swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])\n */\nexport const swap = (x: NDArray | ArrayLike, i: number, j: number): NDArray =>\n array(x).swap(i, j);\n\n/**\n * @function swap\n * @memberof NDArray.prototype\n * @description Swaps two rows `i` and `j` in current matrix\n * @param {Number} i\n * @param {Number} j\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])\n */\nexport default function(this: NDArray, i: number, j: number): NDArray {\n this.check(i, 0);\n this.check(j, 0);\n\n const { data: d1 } = this;\n const [, c] = this.shape;\n const d2: TypedArray = d1.slice(i * c, (i + 1) * c);\n\n d1.copyWithin(i * c, j * c, (j + 1) * c);\n d1.set(d2, j * c);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tan\n * @description Returns the tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tan } from 'vectorious/core/tan';\n * \n * tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport const tan = (x: NDArray | ArrayLike): NDArray => array(x).tan();\n\n/**\n * @function tan\n * @memberof NDArray.prototype\n * @description Returns the tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tanh\n * @description Returns the hyperbolic tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tanh } from 'vectorious/core/tanh';\n * \n * tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport const tanh = (x: NDArray | ArrayLike): NDArray => array(x).tanh();\n\n/**\n * @function tanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toArray\n * @description Converts `x` into a JavaScript array.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { toArray } from 'vectorious/core/toArray';\n * \n * toArray([1, 2, 3]); // => [1, 2, 3]\n */\nexport const toArray = (x: NDArray | ArrayLike): any => array(x).toArray();\n\n/**\n * @function toArray\n * @memberof NDArray.prototype\n * @description Converts current vector into a JavaScript array.\n * @param {Number} index\n * @param {Number} dim\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toArray(); // => [1, 2, 3]\n */\nexport default function(this: NDArray, index: number = 0, dim = 0): any {\n const { data: d1, shape: s1, strides: st1 } = this;\n const { length: ndim } = s1;\n\n if (dim >= ndim) {\n return d1[index];\n }\n\n const n = s1[dim];\n const stride = st1[dim];\n const list = [];\n\n for (let i = 0; i < n; i++) {\n const item = this.toArray(index, dim + 1);\n if (item === null) {\n return null;\n }\n\n list[i] = item;\n index += stride;\n }\n\n return list;\n};\n", "import { inspect } from 'util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toString\n * @description Converts `x` into a readable formatted string.\n * @param {NDArray} x\n * @returns {String}\n * @example\n * import { toString } from 'vectorious/core/toString';\n * \n * toString([1, 2, 3]); // => '1,2,3'\n */\nexport const toString = (x: NDArray | ArrayLike): string => array(x).toString();\n\n/**\n * @function toString\n * @memberof NDArray.prototype\n * @description Converts current vector into a readable formatted string.\n * @returns {String}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toString(); // => '1,2,3'\n */\nexport default function (this: NDArray): string {\n return `array(${inspect(this.toArray(), { depth: 10, breakLength: 40 })}, dtype=${this.dtype})`;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function trace\n * @description Gets the trace of `x` (the sum of all diagonal elements).\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { trace } from 'vectorious/core/trace';\n * \n * trace([[1, 2], [3, 4]]); // => 5\n */\nexport const trace = (x: NDArray | ArrayLike): number => array(x).trace();\n\n/**\n * @function trace\n * @memberof NDArray.prototype\n * @description Gets the trace of the matrix (the sum of all diagonal elements).\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).trace(); // => 5\n */\nexport default function(this: NDArray): number {\n const [r, c] = this.shape;\n const { data: d1 } = this;\n const n: number = Math.min(r, c);\n\n let result: number = 0;\n\n let j: number;\n for (j = 0; j < n; j += 1) {\n result += d1[j * c + j];\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function transpose\n * @description Transposes `x` (mirror across the diagonal).\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { transpose } from 'vectorious/core/transpose';\n * \n * transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport const transpose = (x: NDArray | ArrayLike): NDArray =>\n array(x).transpose();\n\n/**\n * @function transpose\n * @memberof NDArray.prototype\n * @description Transposes current matrix (mirror across the diagonal).\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport default function(this: NDArray): NDArray {\n if (this.shape.length < 2) {\n return this;\n }\n\n let tmp = this.shape[0];\n this.shape[0] = this.shape[1];\n this.shape[1] = tmp;\n\n tmp = this.strides[0];\n this.strides[0] = this.strides[1];\n this.strides[1] = tmp;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { trunc: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function trunc\n * @description\n * Returns the integer part of each element of `x`,\n * removing any fractional digits.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { trunc } from 'vectorious/core/trunc';\n * \n * trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])\n */\nexport const trunc = (x: NDArray | ArrayLike): NDArray => array(x).trunc();\n\n/**\n * @function trunc\n * @memberof NDArray.prototype\n * @description\n * Returns the integer part of each element of current array,\n * removing any fractional digits.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function magic\n * @description Creates a magic square matrix of size `n`\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { magic } from 'vectorious/core/magic';\n * \n * magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])\n */\nexport const magic = (n: number): NDArray => {\n if (n < 0) {\n throw new Error('invalid n');\n }\n\n const d1: TypedArray = new Float64Array(n * n);\n const magic = new NDArray(d1, { shape: [n, n] });\n const iter = new NDIter(magic);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n const a = n - ci - 1;\n const b = n - cj - 1;\n\n d1[i!] = ((cj + a * 2 + 1) % n) * n + ((b + a * 2 + 1) % n) + 1;\n [ci, cj] = iter.coords;\n }\n\n return magic;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function ones\n * @description Creates an array containing ones (`1`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { ones } from 'vectorious/core/ones';\n * \n * ones(3); // => array([1, 1, 1])\n */\nexport const ones = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(1);\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function random\n * @description Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { random } from 'vectorious/core/random';\n * \n * random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])\n */\nexport const random = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).map(() => Math.random());\n", "import { TypedArray, TypedArrayConstructor } from '../types';\n\nimport { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function range\n * @description\n * Creates an array containing a range (can be either ascending or descending)\n * of numbers specified by the arguments provided (e.g. `NDArray.range(0, .5, 2)`\n * gives an array containing all numbers in the interval `[0, 2)` separated by\n * steps of `0.5`)\n * @param {Number} start\n * @param {Number} step\n * @param {Number} stop\n * @returns {NDArray}\n * @example\n * import { range } from 'vectorious/core/range';\n * \n * range(1, 2, 9); // => array([1, 3, 5, 7])\n */\nexport const range = (...args: number[]): NDArray => {\n const type: TypedArrayConstructor = Float32Array;\n let backwards: boolean = false;\n let start: number;\n let step: number;\n let end: number;\n\n switch (args.length) {\n case 2:\n end = args.pop() as number;\n step = 1;\n start = args.pop() as number;\n break;\n case 3:\n end = args.pop() as number;\n step = args.pop() as number;\n start = args.pop() as number;\n break;\n default:\n throw new Error('invalid range');\n }\n\n if (end - start < 0) {\n const copy: number = end;\n end = start;\n start = copy;\n backwards = true;\n }\n\n if (step > end - start) {\n throw new Error('invalid range');\n }\n\n const data: TypedArray = new type(Math.ceil((end - start) / step));\n\n let i: number = start;\n let j: number = 0;\n\n if (backwards) {\n for (; i < end; i += step, j += 1) {\n data[j] = end - i + start;\n }\n } else {\n for (; i < end; i += step, j += 1) {\n data[j] = i;\n }\n }\n\n return new NDArray(data);\n};\n", "import {\n DType,\n INDArray,\n TypedArray,\n} from '../types';\nimport {\n flatten,\n get_dtype,\n get_length,\n get_shape,\n get_strides,\n get_type,\n is_typed_array,\n} from '../util';\nimport {\n NDIter,\n} from '../iterator';\n\nimport { default as abs } from './abs';\nimport { default as acos } from './acos';\nimport { default as acosh } from './acosh';\nimport { default as add } from './add';\nimport { default as angle } from './angle';\nimport { default as asin } from './asin';\nimport { default as asinh } from './asinh';\nimport { default as atan } from './atan';\nimport { default as atanh } from './atanh';\nimport { default as augment } from './augment';\nimport { default as binOp } from './binOp';\nimport { default as cbrt } from './cbrt';\nimport { default as ceil } from './ceil';\nimport { default as check } from './check';\nimport { default as combine } from './combine';\nimport { default as copy } from './copy';\nimport { default as cos } from './cos';\nimport { default as cosh } from './cosh';\nimport { default as cross } from './cross';\nimport { default as det } from './det';\nimport { default as diagonal } from './diagonal';\nimport { default as dot } from './dot';\nimport { default as eig } from './eig';\nimport { default as equals } from './equals';\nimport { default as equidimensional } from './equidimensional';\nimport { default as equilateral } from './equilateral';\nimport { default as exp } from './exp';\nimport { default as expm1 } from './expm1';\nimport { default as fill } from './fill';\nimport { default as floor } from './floor';\nimport { default as forEach } from './forEach';\nimport { default as fround } from './fround';\nimport { default as gauss } from './gauss';\nimport { default as get } from './get';\nimport { default as inv } from './inv';\nimport { default as log } from './log';\nimport { default as log10 } from './log10';\nimport { default as log1p } from './log1p';\nimport { default as log2 } from './log2';\nimport { default as lu } from './lu';\nimport { default as lu_factor } from './lu_factor';\nimport { default as map } from './map';\nimport { default as max } from './max';\nimport { default as mean } from './mean';\nimport { default as min } from './min';\nimport { default as multiply } from './multiply';\nimport { default as norm } from './norm';\nimport { default as normalize } from './normalize';\nimport { default as pow } from './pow';\nimport { default as prod } from './prod';\nimport { default as product } from './product';\nimport { default as project } from './project';\nimport { default as push } from './push';\nimport { default as rank } from './rank';\nimport { default as reciprocal } from './reciprocal';\nimport { default as reduce } from './reduce';\nimport { default as reshape } from './reshape';\nimport { default as round } from './round';\nimport { default as row_add } from './row_add';\nimport { default as scale } from './scale';\nimport { default as set } from './set';\nimport { default as sign } from './sign';\nimport { default as sin } from './sin';\nimport { default as sinh } from './sinh';\nimport { default as slice } from './slice';\nimport { default as solve } from './solve';\nimport { default as sqrt } from './sqrt';\nimport { default as square } from './square';\nimport { default as subtract } from './subtract';\nimport { default as sum } from './sum';\nimport { default as swap } from './swap';\nimport { default as tan } from './tan';\nimport { default as tanh } from './tanh';\nimport { default as toArray } from './toArray';\nimport { default as toString } from './toString';\nimport { default as trace } from './trace';\nimport { default as transpose } from './transpose';\nimport { default as trunc } from './trunc';\n\nconst inspectSymbol: unique symbol = Symbol.for('nodejs.util.inspect.custom');\n\n/**\n * @class NDArray\n * @description Constructs or copies an NDArray instance.\n * @param data\n * @param {Object} [options]\n * @param {Number[]} [options.shape]\n * @param {Number} [options.length]\n * @param {Number[]} [options.strides]\n * @param {string} [options.dtype]\n * @example\n * import { NDArray } from 'vectorious';\n *\n * new NDArray() // => array([], dtype=float64)\n * new NDArray([]) // => array([], dtype=float64)\n * new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)\n * new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)\n * new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)\n * new NDArray([1, 2, 3, 4], {\n * shape: [2, 2],\n * dtype: 'uint32'\n * }) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)\n */\nexport class NDArray implements INDArray {\n /**\n * @name data\n * @memberof NDArray.prototype\n * @type TypedArray\n * @default new Float64Array(0)\n */\n public data: TypedArray = new Float64Array(0);\n \n /**\n * @name dtype\n * @memberof NDArray.prototype\n * @type String\n * @default 'float64'\n */\n public dtype: DType = 'float64';\n\n /**\n * @name length\n * @memberof NDArray.prototype\n * @type Number\n * @default 0\n */\n public length: number = 0;\n\n /**\n * @name shape\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public shape: number[] = [0];\n\n /**\n * @name strides\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public strides: number[] = [0];\n\n public [inspectSymbol]: () => string = toString;\n public abs = abs;\n public acos = acos;\n public acosh = acosh;\n public add = add;\n public angle = angle;\n public asin = asin;\n public asinh = asinh;\n public atan = atan;\n public atanh = atanh;\n public augment = augment;\n public binOp = binOp;\n public cbrt = cbrt;\n public ceil = ceil;\n public check = check;\n public combine = combine;\n public copy = copy;\n public cos = cos;\n public cosh = cosh;\n public cross = cross;\n public det = det;\n public diagonal = diagonal;\n public dot = dot;\n public eig = eig;\n public equals = equals;\n public equidimensional = equidimensional;\n public equilateral = equilateral;\n public exp = exp;\n public expm1 = expm1;\n public fill = fill;\n public floor = floor;\n public forEach = forEach;\n public fround = fround;\n public gauss = gauss;\n public get = get;\n public inv = inv;\n public log = log;\n public log10 = log10;\n public log1p = log1p;\n public log2 = log2;\n public lu = lu;\n public lu_factor = lu_factor;\n public map = map;\n public max = max;\n public mean = mean;\n public min = min;\n public multiply = multiply;\n public norm = norm;\n public normalize = normalize;\n public pow = pow;\n public prod = prod;\n public product = product;\n public project = project;\n public push = push;\n public rank = rank;\n public reciprocal = reciprocal;\n public reduce = reduce;\n public reshape = reshape;\n public round = round;\n public row_add = row_add;\n public scale = scale;\n public set = set;\n public sign = sign;\n public sin = sin;\n public sinh = sinh;\n public slice = slice;\n public solve = solve;\n public sqrt = sqrt;\n public square = square;\n public subtract = subtract;\n public sum = sum;\n public swap = swap;\n public tan = tan;\n public tanh = tanh;\n public toArray = toArray;\n public toString = toString;\n public trace = trace;\n public transpose = transpose;\n public trunc = trunc;\n\n public constructor(\n data?: any,\n options?: {\n shape?: number[];\n length?: number;\n strides?: number[];\n dtype?: DType;\n }\n ) {\n if (!data) {\n return;\n }\n\n if (data instanceof NDArray) {\n return data;\n }\n\n if (data instanceof NDIter) {\n if (!options || !options.dtype) {\n throw new Error('dtype is missing');\n }\n\n if (data.shape) {\n options.shape = data.shape;\n }\n\n const length = data.length;\n data = new (get_type(options.dtype))(length);\n }\n\n const {\n shape = get_shape(data),\n length = get_length(shape),\n strides = get_strides(shape),\n dtype = get_dtype(data),\n } = options || {};\n\n this.data = is_typed_array(data) ? data : new (get_type(dtype))(flatten(data));\n this.shape = shape;\n this.length = length;\n this.dtype = dtype;\n this.strides = strides;\n }\n\n /**\n * @name x\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 0\n * @type Number\n */\n public get x(): number {\n return this.get(0);\n }\n\n public set x(value: number) {\n this.set(0, value);\n }\n\n /**\n * @name y\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 1\n * @type Number\n */\n public get y(): number {\n return this.get(1);\n }\n\n public set y(value: number) {\n this.set(1, value);\n }\n\n /**\n * @name z\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 2\n * @type Number\n */\n public get z(): number {\n return this.get(2);\n }\n\n public set z(value: number) {\n this.set(2, value);\n }\n\n /**\n * @name w\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 3\n * @type Number\n */\n public get w(): number {\n return this.get(3);\n }\n\n public set w(value: number) {\n this.set(3, value);\n }\n\n /**\n * @name T\n * @memberof NDArray.prototype\n * @description Short for this.copy().transpose()\n * @type NDArray\n */\n public get T() {\n return this.transpose();\n }\n}\n\nexport { abs } from './abs';\nexport { acos } from './acos';\nexport { acosh } from './acosh';\nexport { add } from './add';\nexport { angle } from './angle';\nexport { array } from './array';\nexport { asin } from './asin';\nexport { asinh } from './asinh';\nexport { atan } from './atan';\nexport { atanh } from './atanh';\nexport { augment } from './augment';\nexport { binOp } from './binOp';\nexport { cbrt } from './cbrt';\nexport { ceil } from './ceil';\nexport { check } from './check';\nexport { combine } from './combine';\nexport { copy } from './copy';\nexport { cos } from './cos';\nexport { cosh } from './cosh';\nexport { cross } from './cross';\nexport { det } from './det';\nexport { diagonal } from './diagonal';\nexport { dot } from './dot';\nexport { eig } from './eig';\nexport { equals } from './equals';\nexport { equidimensional } from './equidimensional';\nexport { equilateral } from './equilateral';\nexport { exp } from './exp';\nexport { expm1 } from './expm1';\nexport { eye } from './eye';\nexport { fill } from './fill';\nexport { floor } from './floor';\nexport { forEach } from './forEach';\nexport { fround } from './fround';\nexport { gauss } from './gauss';\nexport { get } from './get';\nexport { inv } from './inv';\nexport { log } from './log';\nexport { log10 } from './log10';\nexport { log1p } from './log1p';\nexport { log2 } from './log2';\nexport { lu } from './lu';\nexport { lu_factor } from './lu_factor';\nexport { magic } from './magic';\nexport { map } from './map';\nexport { matrix } from './matrix';\nexport { max } from './max';\nexport { mean } from './mean';\nexport { min } from './min';\nexport { multiply } from './multiply';\nexport { norm } from './norm';\nexport { normalize } from './normalize';\nexport { ones } from './ones';\nexport { pow } from './pow';\nexport { prod } from './prod';\nexport { product } from './product';\nexport { project } from './project';\nexport { push } from './push';\nexport { random } from './random';\nexport { range } from './range';\nexport { rank } from './rank';\nexport { reciprocal } from './reciprocal';\nexport { reduce } from './reduce';\nexport { reshape } from './reshape';\nexport { round } from './round';\nexport { row_add } from './row_add';\nexport { scale } from './scale';\nexport { set } from './set';\nexport { sign } from './sign';\nexport { sin } from './sin';\nexport { sinh } from './sinh';\nexport { slice } from './slice';\nexport { solve } from './solve';\nexport { sqrt } from './sqrt';\nexport { square } from './square';\nexport { subtract } from './subtract';\nexport { sum } from './sum';\nexport { swap } from './swap';\nexport { tan } from './tan';\nexport { tanh } from './tanh';\nexport { toArray } from './toArray';\nexport { toString } from './toString';\nexport { trace } from './trace';\nexport { transpose } from './transpose';\nexport { trunc } from './trunc';\nexport { zeros } from './zeros';\n\ntry {\n (window as any).v = NDArray;\n} catch (error) {}\n"], - "mappings": "opBAAA,sBAAO,QAAU,SAAkB,EAAK,CACtC,MAAO,IAAO,MAAO,IAAQ,UACxB,MAAO,GAAI,MAAS,YACpB,MAAO,GAAI,MAAS,YACpB,MAAO,GAAI,WAAc,cCJhC,kBAAI,MAAO,QAAO,QAAW,WAE3B,EAAO,QAAU,SAAkB,EAAM,EAAW,CAClD,EAAK,OAAS,EACd,EAAK,UAAY,OAAO,OAAO,EAAU,UAAW,CAClD,YAAa,CACX,MAAO,EACP,WAAY,GACZ,SAAU,GACV,aAAc,OAMpB,EAAO,QAAU,SAAkB,EAAM,EAAW,CAClD,EAAK,OAAS,EACd,GAAI,GAAW,UAAY,GAC3B,EAAS,UAAY,EAAU,UAC/B,EAAK,UAAY,GAAI,GACrB,EAAK,UAAU,YAAc,KCpBjC,aAqBA,GAAI,IAAe,WACnB,EAAQ,OAAS,SAAS,EAAG,CAC3B,GAAI,CAAC,EAAS,GAAI,CAEhB,OADI,GAAU,GACL,EAAI,EAAG,EAAI,UAAU,OAAQ,IACpC,EAAQ,KAAK,EAAQ,UAAU,KAEjC,MAAO,GAAQ,KAAK,KAsBtB,OAnBI,GAAI,EACJ,EAAO,UACP,EAAM,EAAK,OACX,EAAM,OAAO,GAAG,QAAQ,GAAc,SAAS,EAAG,CACpD,GAAI,IAAM,KAAM,MAAO,IACv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IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAI,CACb,MAAO,MAAK,cApOT,KAzHP,AAkKU,MAsRV,GAAI,CACF,AAAC,OAAe,EAAI,QACb,EAAP", + "sourcesContent": ["module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}", "if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n", "/**\n * @module Globals\n */\nexport * from './core';\nexport * from './iterator';\n", "import {\n DType,\n TypedArray,\n TypedArrayConstructor,\n} from './types';\n\nexport const flatten: (array: any[]) => number[] = (array: any[]): number[] =>\n array.reduce(\n (acc: any[], next: any): any[] => acc.concat(Array.isArray(next) ? flatten(next) : next),\n []\n );\n\nexport const is_typed_array: (array: any) => boolean = (array: any): boolean =>\n ArrayBuffer.isView(array) && !(array instanceof DataView);\n\nexport const get_length: (shape: number[]) => number = (shape: number[]): number =>\n shape.reduce((a: number, b: number): number => a * b, 1);\n\nexport const get_shape: (array: any) => number[] = (array: any): number[] => Array.isArray(array) || is_typed_array(array)\n ? [array.length].concat(get_shape(array[0]))\n : [];\n\nexport const get_strides: (shape: number[]) => number[] = (shape: number[]): number[] =>\n [\n ...shape\n .slice(1)\n .map((_: number, i: number): number => shape\n .slice(i + 1)\n .reduce((a: number, b: number): number => a * b, 1)\n ),\n 1,\n];\n\nexport const get_dtype: (array: TypedArray) => DType = (array: TypedArray): DType => {\n const {\n constructor: {\n name = 'Float32Array',\n } = {},\n } = array || {};\n\n switch (name) {\n case 'Int8Array': return 'int8';\n case 'Uint8Array': return 'uint8';\n case 'Int16Array': return 'int16';\n case 'Uint16Array': return 'uint16';\n case 'Int32Array': return 'int32';\n case 'Uint32Array': return 'uint32';\n case 'Uint8ClampedArray': return 'uint8c';\n case 'Float32Array': return 'float32';\n case 'Float64Array': return 'float64';\n default: return 'float64';\n }\n};\n\nexport const get_type: (dtype: DType) => TypedArrayConstructor = (dtype: DType): TypedArrayConstructor => {\n switch (dtype) {\n case 'int8': return Int8Array;\n case 'uint8': return Uint8Array;\n case 'int16': return Int16Array;\n case 'uint16': return Uint16Array;\n case 'int32': return Int32Array;\n case 'uint32': return Uint32Array;\n case 'uint8c': return Uint8ClampedArray;\n case 'float32': return Float32Array;\n case 'float64': return Float64Array;\n default: return Float64Array;\n }\n};", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function array\n * @description `array(...args)` is an alias for `new v(...args)`\n * @param {} ...args\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const array = (...args: any[]): NDArray => new NDArray(...args);\n", "import { NDArray } from '../';\nimport { array } from '../core/array';\n\nexport const V_MAXDIMS = 32;\n\n/**\n * @class NDIter\n * @description Constructs an NDIter instance.\n * @param {NDArray} x\n */\nexport class NDIter implements Iterator {\n /**\n * @name x\n * @memberof NDIter.prototype\n * @type NDArray\n */\n public x: NDArray;\n\n /**\n * @name shape\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name shapem1\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shapem1: number[];\n\n /**\n * @name strides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public strides: number[];\n\n /**\n * @name backstrides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public backstrides: number[];\n\n /**\n * @name length\n * @memberof NDIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name nd\n * @memberof NDIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name ndm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public ndm1: number;\n\n /**\n * @name index\n * @memberof NDIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name coords\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public coords: number[];\n\n /**\n * @name pos\n * @memberof NDIter.prototype\n * @type Number\n */\n public pos: number;\n\n /**\n * @name factors\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public factors: number[];\n\n /**\n * @name contiguous\n * @memberof NDIter.prototype\n * @type Boolean\n */\n public contiguous: boolean;\n\n constructor(x: NDArray | ArrayLike) {\n this.x = array(x);\n const {\n shape,\n strides,\n length,\n } = this.x;\n\n this.length = length;\n this.lengthm1 = length - 1;\n this.nd = shape.length;\n this.ndm1 = this.nd - 1;\n\n this.shape = Array(V_MAXDIMS).fill(0);\n this.strides = Array(V_MAXDIMS).fill(0);\n this.shapem1 = Array(V_MAXDIMS).fill(0);\n this.coords = Array(V_MAXDIMS).fill(0);\n this.backstrides = Array(V_MAXDIMS).fill(0);\n this.factors = Array(V_MAXDIMS).fill(0);\n\n if (this.nd !== 0) {\n this.factors[this.nd - 1] = 1;\n }\n\n this.contiguous = true;\n\n let stride = 1;\n let i;\n for (i = 0; i < this.nd; i += 1) {\n this.shape[i] = shape[i];\n this.shapem1[i] = shape[i] - 1;\n this.strides[i] = strides[i];\n this.backstrides[i] = strides[i] * this.shapem1[i];\n this.coords[i] = 0;\n\n // Check if C-contiguous\n if (shape[this.ndm1 - i] !== 1) {\n if (strides[i] !== stride) {\n this.contiguous = false;\n }\n\n stride *= shape[this.ndm1 - i];\n }\n\n if (i > 0) {\n this.factors[this.ndm1 - i] = this.factors[this.nd - i] * shape[this.nd - i];\n }\n }\n\n this.index = 0;\n this.pos = 0;\n }\n\n /**\n * @function done\n * @memberof NDIter.prototype\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDIter.prototype\n * @description Returns the current element of the iterator\n * @returns {Object} current\n * @returns {Number} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.current(); // { value: 1, done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next1d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 1 dimensional.\n */\n next1d() {\n const {\n strides,\n } = this;\n\n this.pos += strides[0];\n this.coords[0] += 1;\n }\n\n /**\n * @function nextcontiguous\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming its data is contiguous.\n */\n nextcontiguous() {\n this.pos += 1;\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 2 dimensional.\n */\n next2d() {\n const {\n strides,\n shapem1,\n backstrides,\n } = this;\n\n if (this.coords[1] < shapem1[1]) {\n this.coords[1] += 1;\n this.pos += strides[1];\n } else {\n this.coords[1] = 0;\n this.coords[0] += 1;\n this.pos += strides[0] - backstrides[1];\n }\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator\n */\n nextnd() {\n const {\n ndm1,\n shapem1,\n strides,\n backstrides,\n } = this;\n\n let i;\n for (i = ndm1; i >= 0; i -= 1) {\n if (this.coords[i] < shapem1[i]) {\n this.coords[i] += 1;\n this.pos += strides[i];\n break;\n }\n\n this.coords[i] = 0;\n this.pos -= backstrides[i];\n }\n }\n\n /**\n * @function next\n * @memberof NDIter.prototype\n * @description\n * Steps to the next position in the iterator.\n * Returns the current index of the iterator, or undefined if done.\n * @returns {Object}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.next(); // { value: 2, done: false }\n * iter.next(); // { value: 3, done: false }\n * iter.next(); // { done: true }\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n ndm1,\n contiguous,\n } = this;\n\n if (ndm1 === 0) {\n this.next1d();\n } else if (contiguous) {\n this.nextcontiguous();\n } else if (ndm1 === 1) {\n this.next2d();\n } else {\n this.nextnd();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n\n/**\n * @class NDMultiIter\n * @description Constructs an NDMultiIter instance.\n * @param {NDArray[]} ...args\n */\nexport class NDMultiIter implements Iterator {\n /**\n * @name iters\n * @memberof NDMultiIter.prototype\n * @type NDIter[]\n */\n public iters: NDIter[];\n\n /**\n * @name shape\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name nd\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name length\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name numiter\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public numiter: number;\n\n /**\n * @name index\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name pos\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public pos: number[];\n\n constructor(...args: (NDArray | ArrayLike)[]) {\n this.iters = args.map(arg => new NDIter(arg));\n this.numiter = args.length;\n\n let i;\n let nd;\n for (i = 0, nd = 0; i < this.numiter; i += 1) {\n nd = Math.max(nd, this.iters[i].x.shape.length);\n }\n\n this.nd = nd;\n this.shape = Array(nd).fill(0);\n\n let it;\n let j;\n let k;\n let tmp;\n for (i = 0; i < nd; i += 1) {\n this.shape[i] = 1;\n for (j = 0; j < this.numiter; j += 1) {\n it = this.iters[j];\n k = i + it.x.shape.length - nd;\n if (k >= 0) {\n tmp = it.x.shape[k];\n if (tmp == 1) {\n continue;\n }\n if (this.shape[i] == 1) {\n this.shape[i] = tmp;\n\n } else if (this.shape[i] !== tmp) {\n throw new Error('shape mismatch');\n }\n }\n }\n }\n\n tmp = this.shape.reduce((acc, dim) => acc * dim, 1);\n\n this.length = tmp;\n this.lengthm1 = tmp - 1;\n\n for (i = 0; i < this.numiter; i += 1) {\n it = this.iters[i];\n it.nd = this.nd;\n it.ndm1 = this.nd - 1;\n it.length = tmp;\n it.lengthm1 = tmp - 1;\n\n nd = it.x.shape.length;\n if (nd !== 0) {\n it.factors[this.nd - 1] = 1;\n }\n\n for (j = 0; j < this.nd; j += 1) {\n it.shape[j] = this.shape[j];\n it.shapem1[j] = this.shape[j] - 1;\n k = j + nd - this.nd;\n\n if ((k < 0) || it.x.shape[k] !== this.shape[j]) {\n it.contiguous = false;\n it.strides[j] = 0;\n } else {\n it.strides[j] = it.x.strides[k];\n }\n\n it.backstrides[j] = it.strides[j] * it.shapem1[j];\n\n if (j > 0) {\n it.factors[this.nd - j - 1] = it.factors[this.nd - j] * this.shape[this.nd - j]\n }\n }\n }\n\n this.index = 0;\n this.pos = Array(this.numiter).fill(0);\n }\n\n /**\n * @function done\n * @memberof NDMultiIter\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDMultiIter\n * @description Returns the current indices of the iterators\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.current(); // { value: [0, 0], done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next\n * @memberof NDMultiIter\n * @description\n * Steps to the next position in the iterator.\n * Returns the current indices of the iterators, or undefined if done.\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.next(); // { value: [0, 0], done: false }\n * iter.next(); // { value: [1, 1], done: false }\n * iter.next(); // { value: [2, 2], done: false },\n * iter.next(); // { value: undefined, done: true },\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n numiter,\n } = this;\n\n let it;\n let i;\n for (i = 0; i < numiter; i += 1) {\n it = this.iters[i];\n this.pos[i] = it.pos;\n it.next();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { abs: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function abs\n * @description Returns the absolute value of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { abs } from 'vectorious/core/abs';\n * \n * abs([-1, -2, -3]) // => array([1, 2, 3])\n */\nexport const abs = (x: NDArray | ArrayLike): NDArray => array(x).abs();\n\n/**\n * @function abs\n * @memberof NDArray.prototype\n * @description Returns the absolute value of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, -2, -3]).abs() // <=> array([1, 2, 3])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acos\n * @description Returns the arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acos } from 'vectorious/core/acos';\n * \n * acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport const acos = (x: NDArray | ArrayLike): NDArray => array(x).acos();\n\n/**\n * @function acos\n * @memberof NDArray.prototype\n * @description Returns the arccosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acosh\n * @description Returns the hyperbolic arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acosh } from 'vectorious/core/acosh';\n * \n * acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport const acosh = (x: NDArray | ArrayLike): NDArray => array(x).acosh();\n\n/**\n * @function acosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arccosine of each element of current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nblas: any;\ntry {\n nblas = require('nblas');\n} catch (err) {}\n\nexport const NoTrans = nblas && nblas.NoTrans;\nexport const Trans = nblas && nblas.Trans;\n\nexport function axpy(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.daxpy(n, alpha, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.saxpy(n, alpha, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function dot(dtype: DType, n: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.ddot(n, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.sdot(n, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function iamax(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.idamax(n, x, inc_x);\n case 'float32':\n return nblas.isamax(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gemm(dtype: DType, transx: number, transy: number, m: number, n: number, k: number, alpha: number, x: TypedArray, ldx: number, y: TypedArray, ldy: number, beta: number, z: TypedArray, ldz: number) {\n const { length: l1 } = x;\n const { length: l2 } = y;\n const { length: l3 } = z;\n\n if ((transx === nblas.NoTrans && l1 !== ldx * m) || (transx === nblas.Trans && l1 !== ldx * k)) {\n throw new Error('lengths do not match');\n }\n\n if ((transy === nblas.NoTrans && l2 !== ldy * k) || (transy === nblas.Trans && l2 !== ldy * n)) {\n throw new Error('lengths do not match');\n }\n\n if (l3 !== ldz * m) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n case 'float32':\n return nblas.sgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function nrm2(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dnrm2(n, x, inc_x);\n case 'float32':\n return nblas.snrm2(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function scal(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dscal(n, alpha, x, inc_x);\n case 'float32':\n return nblas.sscal(n, alpha, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function add\n * @description\n * Adds `y` multiplied by `alpha` to `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { add } from 'vectorious/core/add';\n * \n * add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])\n */\nexport const add = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, alpha: number = 1): NDArray =>\n array(x).add(array(y), alpha);\n\n/**\n * @function add\n * @memberof NDArray.prototype\n * @description\n * Adds `x` multiplied by `alpha` to the current array.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])\n */\nexport default function (this: NDArray, x: NDArray | ArrayLike, alpha: number = 1): NDArray {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = array(x);\n\n try {\n blas.axpy(dtype, l1, alpha, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n d1[i] += alpha * d2[j];\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function angle\n * @description Determines the angle between the `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {number}\n * @example\n * import { angle } from 'vectorious/core/angle';\n * \n * angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287\n */\nexport const angle = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).angle(array(y));\n\n/**\n * @function angle\n * @memberof NDArray.prototype\n * @description Determines the angle between the current vector and `x`.\n * @param {NDArray} x\n * @returns {number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): number {\n return f(this.dot(array(x)) / this.norm() / array(x).norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asin\n * @description Returns the arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asin } from 'vectorious/core/asin';\n * \n * asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport const asin = (x: NDArray | ArrayLike): NDArray => array(x).asin();\n\n/**\n * @function asin\n * @memberof NDArray.prototype\n * @description Returns the arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asinh\n * @description Returns the hyperbolic arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asinh } from 'vectorious/core/asinh';\n * \n * asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport const asinh = (x: NDArray | ArrayLike): NDArray => array(x).asinh();\n\n/**\n * @function asinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atan\n * @description Returns the arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atan } from 'vectorious/core/atan';\n * \n * atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport const atan = (x: NDArray | ArrayLike): NDArray => array(x).atan();\n\n/**\n * @function atan\n * @memberof NDArray.prototype\n * @description Returns the arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atanh\n * @description Returns the hyperbolic arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atanh } from 'vectorious/core/atanh';\n * \n * atanh([0, -0.5]); // => array([0, -0.5493061542510986])\n */\nexport const atanh = (x: NDArray | ArrayLike): NDArray => array(x).atanh();\n\n/**\n * @function atanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function zeros\n * @description Creates an array containing zeros (`0`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { zeros } from 'vectorious/core/zeros';\n * \n * zeros(3); // => array([0, 0, 0])\n */\nexport const zeros = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(0);\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\n\n/**\n * @static\n * @memberof module:Globals\n * @function augment\n * @description Augments `x` and `y`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { augment } from 'vectorious/core/augment';\n * \n * augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])\n */\nexport const augment = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).augment(array(y));\n\n/**\n * @function augment\n * @memberof NDArray.prototype\n * @description Augments `x` with current matrix.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): NDArray {\n const [r1, c1] = this.shape;\n const [r2, c2] = array(x).shape;\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n if (r2 === 0 || c2 === 0) {\n return this;\n }\n\n if (r1 !== r2) {\n throw new Error('rows do not match');\n }\n\n const y = zeros(r1, c1 + c2);\n const { data: d3 } = y;\n\n let i: number;\n let j: number;\n for (i = 0; i < r1; i += 1) {\n for (j = 0; j < c1; j += 1) {\n d3[i * (c1 + c2) + j] = d1[i * c1 + j];\n }\n }\n\n for (i = 0; i < r2; i += 1) {\n for (j = 0; j < c2; j += 1) {\n d3[i * (c1 + c2) + (j + c1)] = d2[i * c2 + j];\n }\n }\n\n return y;\n};\n", "\nimport { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function binOp\n * @description Perform binary operation `f` on `y` in `x`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { binOp } from 'vectorious/core/binOp';\n * \n * binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport const binOp = (\n x: NDArray | ArrayLike,\n y: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray => array(x).binOp(array(y), f);\n\n/**\n * @function binOp\n * @memberof NDArray.prototype\n * @description Perform binary operation `f` on `x` in the current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport default function(\n this: NDArray,\n x: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i] = f(d1[i], d2[j], i);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cbrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cbrt\n * @description Returns the cube root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport const cbrt = (x: NDArray | ArrayLike): NDArray => array(x).cbrt();\n\n/**\n * @function cbrt\n * @memberof NDArray.prototype\n * @description Returns the cube root of each element of current array.\n * @returns {this}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { ceil: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function ceil\n * @description Returns smallest integer greater than or equal to of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { ceil } from 'vectorious/core/ceil';\n * \n * ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])\n */\nexport const ceil = (x: NDArray | ArrayLike): NDArray => array(x).ceil();\n\n/**\n * @function ceil\n * @memberof NDArray.prototype\n * @description Returns smallest integer greater than or equal to of each element of current array.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function check\n * @description Asserts if indices `i, j, ..., n` are within the bounds of `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { check } from 'vectorious/core/check';\n * \n * check([0.5, 1.5, 2.5], 3); // Error: index out of bounds\n */\nexport const check = (x: NDArray | ArrayLike, ...indices: number[]): void => {\n array(x).check(...indices);\n};\n\n/**\n * @function check\n * @memberof NDArray.prototype\n * @description Asserts if indices `i, j, ..., n` are within the bounds of current array\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds\n */\nexport default function(this: NDArray, ...indices: number[]): void {\n const { shape: s1, length: l1 } = this;\n\n if (indices.length === 1) {\n const [i] = indices;\n if (i < 0 || i > l1 - 1 || !Number.isFinite(i)) {\n throw new Error('index out of bounds');\n }\n } else if (!s1.every((dim: number, i: number) =>\n dim > indices[i]\n && Number.isFinite(indices[i])\n && indices[i] >= 0\n )) {\n throw new Error('index out of bounds');\n }\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function combine\n * @description Combines the vector `x` with `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { combine } from 'vectorious/core/combine';\n * \n * combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport const combine = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).combine(array(y));\n\n/**\n * @function combine\n * @memberof NDArray.prototype\n * @description Combines the current vector with `x`\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n if (this.shape.length !== 1 && x.shape.length !== 1) {\n throw new Error('combine operation not permitted for multidimensional arrays');\n }\n\n const { length: l1, data: d1 } = this;\n const { length: l2, data: d2 } = x;\n\n if (l2 === 0) {\n return this;\n }\n\n if (l1 === 0) {\n this.data = new (get_type(x.dtype))(d2);\n this.length = l2;\n this.dtype = x.dtype;\n\n return this;\n }\n\n const l3: number = l1 + l2;\n const d3: TypedArray = new (get_type(this.dtype))(l3);\n\n d3.set(d1);\n d3.set(d2, l1);\n\n this.data = d3;\n this.length = l3;\n this.shape = [l3];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { NDMultiIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function copy\n * @description Makes a copy of `x`\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { copy } from 'vectorious/core/copy';\n * \n * copy([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const copy = (x: NDArray | ArrayLike): NDArray => array(x).copy();\n\n/**\n * @function copy\n * @memberof NDArray.prototype\n * @description Makes a copy of the class and underlying data\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).copy(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const x = zeros(...this.shape);\n\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d2[j] = d1[i];\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cos\n * @description Returns the cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cos } from 'vectorious/core/cos';\n * \n * cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])\n */\nexport const cos = (x: NDArray | ArrayLike): NDArray => array(x).cos();\n\n/**\n * @function cos\n * @memberof NDArray.prototype\n * @description Returns the cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cosh\n * @description Returns the hyperbolic cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cosh } from 'vectorious/core/cosh';\n * \n * cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport const cosh = (x: NDArray | ArrayLike): NDArray => array(x).cosh();\n\n/**\n * @function cosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function cross\n * @description\n * Computes the cross product of the `x` and the vector `y`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { cross } from 'vectorious/core/cross';\n * \n * cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])\n */\nexport const cross = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).cross(array(y));\n\n/**\n * @function cross\n * @memberof NDArray.prototype\n * @description\n * Computes the cross product of the current vector and the vector `x`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== 3 || l2 !== 3) {\n throw new Error('vectors must have three components');\n }\n\n const c1: number = this.y * x.z - this.z * x.y;\n const c2: number = this.z * x.x - this.x * x.z;\n const c3: number = this.x * x.y - this.y * x.x;\n\n this.x = c1;\n this.y = c2;\n this.z = c3;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function det\n * @description Gets the determinant of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { det } from 'vectorious/core/det';\n * \n * det([[0, 1], [2, 3]]); // => -2\n */\nexport const det = (x: NDArray | ArrayLike): number => array(x).det();\n\n/**\n * @function det\n * @memberof NDArray.prototype\n * @description Gets the determinant of current matrix using LU factorization.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[0, 1], [2, 3]]).det(); // => -2\n */\nexport default function(this: NDArray): number {\n this.square();\n\n const [n] = this.shape;\n const [LU, ipiv] = this.copy().lu_factor();\n const { data: d1 } = LU;\n\n let product: number = 1;\n let sign: number = 1;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n product *= d1[i * n + i];\n if (i !== ipiv[i] - 1) {\n sign *= -1;\n }\n }\n\n return sign * product;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function diagonal\n * @description Gets the diagonal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { diagonal } from 'vectorious/core/diagonal';\n * \n * diagonal([[1, 2], [3, 4]]); // => array([1, 4])\n */\nexport const diagonal = (x: NDArray | ArrayLike): NDArray =>\n array(x).diagonal();\n\n/**\n * @function diagonal\n * @memberof NDArray.prototype\n * @description Gets the diagonal of current matrix.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).diagonal(); // => array([1, 4])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { length: l1 } = this;\n const [r, c] = this.shape;\n const l2: number = Math.min(r, c);\n\n return this.reshape(l1).slice(0, l1, l2 + 1);\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function dot\n * @description\n * Performs dot multiplication with `x` and `y`.\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {Number}\n * @example\n * import { dot } from 'vectorious/core/dot';\n * \n * dot([1, 2, 3], [4, 5, 6]); // => 32\n */\nexport const dot = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).dot(array(y));\n\n/**\n * @function dot\n * @memberof NDArray.prototype\n * @description\n * Performs dot multiplication with `x` and current array\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).dot([4, 5, 6]); // => 32\n */\nexport default function(this: NDArray, x: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = x;\n\n let result: number = 0;\n try {\n result = blas.dot(dtype, l1, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n result += d1[i] * d2[j];\n }\n }\n\n return result;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function eye\n * @description Creates an identity matrix of size `n` and type `type`.\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { eye } from 'vectorious/core/eye';\n * \n * eye(2); // => array([[1, 0], [0, 1]])\n */\nexport const eye = (n: number): NDArray => {\n const x = new NDArray(new Float64Array(n * n), { shape: [n, n] });\n const { data: d1 } = x;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n d1[i * n + i] = 1;\n }\n\n return x;\n};\n", "import { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { eye } from './eye';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\n/**\n * @ignore\n * \u250C \u2510 \u250C \u2510\u250C \u2510\n * \u2502Skl\u2502 \u2502c \u2212s\u2502\u2502Skl\u2502\n * \u2502 \u2502 := \u2502 \u2502\u2502 \u2502\n * \u2502Sij\u2502 \u2502s c\u2502\u2502Sij\u2502\n * \u2514 \u2518 \u2514 \u2518\u2514 \u2518\n */\nconst rotate:\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number) => void =\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number): void => {\n const [n] = x.shape;\n const { data: d1 } = x;\n const temp: number = d1[k * n + l];\n const tau: number = 1 / (c + s);\n\n d1[k * n + l] = temp - s * (d1[i * n + j] + tau * temp);\n d1[i * n + j] += s * (temp - tau * d1[i * n + j]);\n };\n\n/**\n * @static\n * @memberof module:Globals\n * @function eig\n * @description\n * Gets eigenvalues and eigenvectors of `x` using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { eig } from 'vectorious/core/eig';\n * \n * eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport const eig = (x: NDArray | ArrayLike): [NDArray, NDArray] => array(x).eig();\n\n/**\n * @function eig\n * @memberof NDArray.prototype\n * @description\n * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport default function(this: NDArray): [NDArray, NDArray] {\n this.square();\n\n const [n] = this.shape;\n\n try {\n if (!['float32', 'float64'].includes(this.dtype)) {\n this.dtype = 'float32';\n this.data = get_type(this.dtype).from(this.data);\n }\n\n const jobvl: typeof nlapack.NDArrayEigenvector = nlapack.NoEigenvector;\n const jobvr: typeof nlapack.NDArrayEigenvector = nlapack.Eigenvector;\n\n const wr = zeros(n);\n const wi = zeros(n);\n\n const vl = zeros(n, n);\n const vr = zeros(n, n);\n\n const { data: d1 } = this;\n const { data: d2 } = wr;\n const { data: d3 } = wi;\n const { data: d4 } = vl;\n const { data: d5 } = vr;\n if (this.dtype === 'float64') {\n nlapack.dgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n if (this.dtype === 'float32') {\n nlapack.sgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n return [wr, vr];\n } catch (err) {\n const { data: d1 } = this;\n const p = eye(n);\n\n let max = 0;\n let i = 0;\n let j = 0;\n let k = 0;\n let l = 0;\n\n do {\n // Find maximum off-diagonal element\n for (i = 0; i < n; i += 1) {\n for (j = i + 1; j < n; j += 1) {\n if (Math.abs(d1[i * n + j]) >= max) {\n max = Math.abs(d1[i * n + j]);\n k = i;\n l = j;\n }\n }\n }\n\n // Find c and s\n let t;\n if (Math.abs(d1[k * n + l]) < Math.abs(d1[l * n + l]) * 1e-36) {\n t = d1[k * n + l] / d1[l * n + l];\n } else {\n const phi = d1[l * n + l] / 2 * d1[k * n + l];\n t = 1 / (Math.abs(phi) + Math.sqrt(phi * phi + 1));\n }\n\n const c = 1 / Math.sqrt(t * t + 1);\n const s = t * c;\n\n const e = d1[k * n + l];\n d1[k * n + l] = 0;\n d1[k * n + k] -= t * e;\n d1[l * n + l] += t * e;\n\n // Rotate rows and columns k and l\n for (i = 0; i < k; i += 1) {\n rotate(this, c, s, i, k, i, l);\n }\n\n for (i = k + 1; i < l; i += 1) {\n rotate(this, c, s, k, i, i, l);\n }\n\n for (i = l + 1; i < n; i += 1) {\n rotate(this, c, s, k, i, l, i);\n }\n\n // Rotate eigenvectors\n for (i = 0; i < n; i += 1) {\n rotate(p, c, s, i, k, i, l);\n }\n } while (max >= 1e-9);\n\n return [this.diagonal(), p];\n }\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function equals\n * @description Checks if `x` and `y` are equal.\n * @param {NDArray} x\n * @param {NDArray} y\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * equals([1, 2, 3], [1, 2, 3]); // => true\n */\nexport const equals = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, tolerance: number = 1e-6): boolean =>\n array(x).equals(array(y), tolerance);\n\n/**\n * @function equals\n * @memberof NDArray.prototype\n * @description Checks if current array and `x` are equal.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * array([1, 2, 3]).equals([1, 2, 3]); // => true\n */\nexport default function(this: NDArray, x: NDArray, tolerance: number = 1e-6): boolean {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n if (Math.abs(d1[i] - d2[j]) > tolerance) {\n return false;\n }\n }\n\n return true;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equidimensional\n * @description Asserts if `x` and `y` have the same shape\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} shapes x and y do not match\n * @example\n * import { equidimensional } from 'vectorious/core/equidimensional';\n * \n * equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport const equidimensional = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equidimensional(array(y));\n};\n\n/**\n * @deprecated\n * @function equidimensional\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same shape\n * @param {NDArray} x\n * @throws {Error} shapes x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { shape: s1 } = this;\n const { shape: s2 } = x;\n\n if (!s1.every((dim: number, i: number) => dim === s2[i])) {\n throw new Error(`shapes ${s1} and ${s2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equilateral\n * @description Asserts if `x` and `y` have the same length\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} lengths x and y do not match\n * @example\n * import { equilateral } from 'vectorious/core/equilateral';\n * \n * equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport const equilateral = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equilateral(array(y));\n};\n\n/**\n * @deprecated\n * @function equilateral\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same length\n * @param {NDArray} x\n * @throws {Error} lengths x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== l2) {\n throw new Error(`lengths ${l1} and ${l2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { exp: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function exp\n * @description\n * Returns e^x of each element of `x`, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { exp } from 'vectorious/core/exp';\n * \n * exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport const exp = (x: NDArray | ArrayLike): NDArray => array(x).exp();\n\n/**\n * @function exp\n * @memberof NDArray.prototype\n * @description\n * Returns e^x of each element of current array, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { expm1: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function expm1\n * @description Returns subtracting 1 from exp(x) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { expm1 } from 'vectorious/core/expm1';\n * \n * expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport const expm1 = (x: NDArray | ArrayLike): NDArray => array(x).expm1();\n\n/**\n * @function expm1\n * @memberof NDArray.prototype\n * @description Returns subtracting 1 from exp(x) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function fill\n * @description Fills `x` with a scalar value\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { fill } from 'vectorious/core/fill';\n * \n * fill([1, 2, 3], 0); // => array([0, 0, 0])\n */\nexport const fill = (\n x: NDArray | ArrayLike,\n value: number | ((index: number) => number) = 0\n): NDArray =>\n array(x).fill(value);\n\n/**\n * @function fill\n * @memberof NDArray.prototype\n * @description Fills the current array with a scalar value\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])\n */\nexport default function(this: NDArray, value: number | ((index: number) => number) = 0): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = value instanceof Function ? value(iter.pos) : value;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { floor: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function floor\n * @description Returns the largest integer less than or equal to a number of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { floor } from 'vectorious/core/floor';\n * \n * floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])\n */\nexport const floor = (x: NDArray | ArrayLike): NDArray => array(x).floor();\n\n/**\n * @function floor\n * @memberof NDArray.prototype\n * @description Returns the largest integer less than or equal to a number of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function forEach\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {NDArray} x\n * @param {Function} f\n * @example\n * import { forEach } from 'vectorious/core/forEach';\n * \n * forEach([1, 2, 3], console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport const forEach = (\n x: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void => {\n x.forEach(f);\n};\n\n/**\n * @function forEach\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {Function} f\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).forEach(console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n f.call(this, d1[i!], i!, d1);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { fround: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function fround\n * @description Returns the nearest single precision float representation of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { fround } from 'vectorious/core/fround';\n * \n * fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])\n */\nexport const fround = (x: NDArray | ArrayLike): NDArray => array(x).fround();\n\n/**\n * @function fround\n * @memberof NDArray.prototype\n * @description Returns the nearest single precision float representation of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\nexport function getrf(dtype: DType, m: number, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== m * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetrf(m, n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetrf(m, n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function getri(dtype: DType, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== n * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetri(n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetri(n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gesv(dtype: DType, n: number, nrhs: number, x: TypedArray, ldx: number, ipiv: Int32Array, y: TypedArray, ldy: number) {\n if (x.length !== ldx * n || y.length !== ldy * nrhs) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n case 'float32':\n return nlapack.sgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n// import { diagonal } from './diagonal';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function gauss\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { gauss } from 'vectorious/core/gauss';\n * \n * gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])\n */\nexport const gauss = (x: NDArray | ArrayLike): NDArray => array(x).gauss();\n\n/**\n * @function gauss\n * @memberof NDArray.prototype\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])\n */\nexport default function(this: NDArray): NDArray {\n const { shape: [r, c], data: d1, dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(Math.min(r, c));\n\n lapack.getrf(dtype, r, c, d1, c, ipiv);\n\n const iter = new NDIter(this);\n\n // Zero out lower triangular part of matrix\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d1[i!] = 0;\n }\n\n [ci, cj] = iter.coords;\n }\n } catch (err) {\n let lead: number = 0;\n let leadValue: number;\n let pivot: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (i = 0; i < r; i += 1) {\n if (c <= lead) {\n return this;\n }\n\n j = i;\n while (d1[j * c + lead] === 0) {\n j += 1;\n if (r === j) {\n j = i;\n lead += 1;\n\n if (c === lead) {\n return this;\n }\n }\n }\n\n if (i !== j) {\n this.swap(i, j);\n }\n\n pivot = d1[i * c + lead];\n if (pivot !== 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n\n for (j = 0; j < r; j += 1) {\n leadValue = d1[j * c + lead];\n if (j !== i) {\n for (k = 0; k < c; k += 1) {\n d1[j * c + k] -= d1[i * c + k] * leadValue;\n }\n }\n }\n\n lead += 1;\n }\n\n for (i = 0; i < r; i += 1) {\n pivot = 0;\n for (j = 0; j < c; j += 1) {\n if (pivot === 0) {\n pivot = d1[i * c + j];\n }\n }\n\n if (pivot === 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function get\n * @description Gets the element at `i, j, ..., n` from `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { get } from 'vectorious/core/get';\n * \n * get([1, 2, 3], 2); // 3\n */\nexport const get = (x: NDArray | ArrayLike, ...indices: number[]): number =>\n array(x).get(...indices);\n\n/**\n * @function get\n * @memberof NDArray.prototype\n * @description Gets the element at `i, j, ..., n` from current vector.\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).get(2); // 3\n */\nexport default function(this: NDArray, ...indices: number[]): number {\n this.check(...indices);\n\n const { data: d1, shape: s1 } = this;\n const { length: ndim } = s1;\n let index: number = indices[ndim - 1];\n\n let i: number;\n let j: number;\n for (i = 0; i < ndim - 1; i += 1) {\n let p: number = 1;\n for (j = i + 1; j < ndim; j += 1) {\n p *= s1[j];\n }\n\n index += indices[i] * p;\n }\n\n return d1[index];\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { eye } from './eye';\nimport { augment } from './augment';\nimport { zeros } from './zeros';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function inv\n * @description\n * Determines the inverse of `x`.\n * Accelerated with LAPACK `?getrf` and `?getri`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { inv } from 'vectorious/core/inv';\n * \n * inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport const inv = (x: NDArray | ArrayLike): NDArray => array(x).inv();\n\n/**\n * @function inv\n * @memberof NDArray.prototype\n * @description\n * Determines the inverse of current matrix using Gaussian elimination.\n * Accelerated with LAPACK `?getri`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { shape: [n], dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(n);\n\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n lapack.getri(dtype, n, d1, n, ipiv);\n\n return this;\n } catch (err) {\n const identity = eye(n);\n const rref = augment(this, identity).gauss();\n const left = zeros(n, n);\n const right = zeros(n, n);\n\n const { data: d1 } = rref;\n const { data: d2 } = left;\n const { data: d3 } = right;\n\n const iter = new NDIter(rref);\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < n) {\n d2[ci * n + cj] = d1[i!];\n } else {\n d3[ci * n + (cj - n)] = d1[i!];\n }\n\n [ci, cj] = iter.coords;\n }\n\n if (!left.equals(identity)) {\n throw new Error('matrix is not invertible');\n }\n\n return right;\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log\n * @description Returns the natural logarithm (log_e, also ln) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log } from 'vectorious/core/log';\n * \n * log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport const log = (x: NDArray | ArrayLike): NDArray => array(x).log();\n\n/**\n * @function log\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log10: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log10\n * @description Returns the base 10 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log10 } from 'vectorious/core/log10';\n * \n * log10([10, 100, 1000]); // => array([1, 2, 3])\n */\nexport const log10 = (x: NDArray | ArrayLike): NDArray => array(x).log10();\n\n/**\n * @function log10\n * @memberof NDArray.prototype\n * @description Returns the base 10 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log1p: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log1p\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log1p } from 'vectorious/core/log1p';\n * \n * log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport const log1p = (x: NDArray | ArrayLike): NDArray => array(x).log1p();\n\n/**\n * @function log1p\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log2: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log2\n * @description Returns the base 2 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log2 } from 'vectorious/core/log2';\n * \n * log2([1, 2, 4]); // => array([0, 1, 2])\n */\nexport const log2 = (x: NDArray | ArrayLike): NDArray => array(x).log2();\n\n/**\n * @function log2\n * @memberof NDArray.prototype\n * @description Returns the base 2 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 4]).log2(); // => array([0, 1, 2])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu\n * @description\n * Performs full LU decomposition on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu } from 'vectorious/core/lu';\n * \n * lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu = (x: NDArray | ArrayLike): [NDArray, NDArray, Int32Array] =>\n array(x).lu();\n\n/**\n * @function lu\n * @memberof NDArray.prototype\n * @description\n * Performs full LU decomposition on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function (this: NDArray): [NDArray, NDArray, Int32Array] {\n const [LU, ipiv] = this.copy().lu_factor();\n const L = LU.copy();\n const U = LU.copy();\n const { data: d1 } = L;\n const { data: d2 } = U;\n\n const iter = new NDIter(LU);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d2[i!] = 0;\n } else {\n d1[i!] = ci === cj ? 1 : 0;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return [L, U, ipiv];\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu_factor\n * @description\n * Performs LU factorization on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu_factor } from 'vectorious/core/lu_factor';\n * \n * lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu_factor = (x: NDArray | ArrayLike): [NDArray, Int32Array] =>\n array(x).lu_factor();\n\n/**\n * @function lu_factor\n * @memberof NDArray.prototype\n * @description\n * Performs LU factorization on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function(this: NDArray): [NDArray, Int32Array] {\n const { data: d1, shape: [n], dtype } = this;\n const ipiv: Int32Array = new Int32Array(n);\n\n try {\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n } catch (err) {\n let max: number;\n let abs: number;\n let diag: number;\n let p: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (k = 0; k < n; k += 1) {\n p = k;\n max = Math.abs(d1[k * n + k]);\n for (j = k + 1; j < n; j += 1) {\n abs = Math.abs(d1[j * n + k]);\n if (max < abs) {\n max = abs;\n p = j;\n }\n }\n\n ipiv[k] = p + 1;\n\n if (p !== k) {\n this.swap(k, p);\n }\n\n diag = d1[k * n + k];\n for (i = k + 1; i < n; i += 1) {\n d1[i * n + k] /= diag;\n }\n\n for (i = k + 1; i < n; i += 1) {\n for (j = k + 1; j < n - 1; j += 2) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n d1[i * n + j + 1] -= d1[i * n + k] * d1[k * n + j + 1];\n }\n\n if (j === n - 1) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n }\n }\n }\n }\n\n return [this, ipiv];\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function map\n * @description Equivalent to `TypedArray.prototype.map`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { map } from 'vectorious/core/map';\n * \n * map([1, 2, 3], value => -value); // => array([-1, -2, -3])\n */\nexport const map = (\n x: NDArray | ArrayLike,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray => array(x).map(f);\n\n/**\n * @function map\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.map`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n const map = f.bind(this);\n\n const copy = this.copy();\n const { data: d2 } = copy;\n\n for (const i of iter) {\n d2[i!] = map(d1[i!], i!, d1);\n }\n\n return copy;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function max\n * @description\n * Gets the maximum value (largest) element of `x`.\n * Accelerated with BLAS `i?amax`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { max } from 'vectorious/core/max';\n * \n * max([1, 2, 3]); // => 3\n */\nexport const max = (x: NDArray | ArrayLike): number => array(x).max();\n\n/**\n * @function max\n * @memberof NDArray.prototype\n * @description\n * Gets the maximum value (smallest) element of current array.\n * Accelerated with BLAS `i?amax`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).max(); // => 3\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let max: number = Number.NEGATIVE_INFINITY;\n\n try {\n max = d1[blas.iamax(dtype, l1, d1, 1)];\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n const value = d1[i!];\n if (max < value) {\n max = value;\n }\n }\n }\n\n return max;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function mean\n * @description Gets the arithmetic mean of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { mean } from 'vectorious/core/mean';\n * \n * mean([1, 2, 3]); // => 2\n */\nexport const mean = (x: NDArray | ArrayLike): number => array(x).mean();\n\n/**\n * @function mean\n * @memberof NDArray.prototype\n * @description Gets the arithmetic mean of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).mean(); // => 2\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1 } = this;\n const iter = new NDIter(this);\n\n let mean: number = 0;\n for (const i of iter) {\n mean += d1[i!];\n }\n\n return mean / l1;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function min\n * @description Gets the minimum value (smallest) element of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { min } from 'vectorious/core/min';\n * \n * min([1, 2, 3]); // => 1\n */\nexport const min = (x: NDArray | ArrayLike): number => array(x).min();\n\n/**\n * @function min\n * @memberof NDArray.prototype\n * @description Gets the minimum value (smallest) element of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).min(); // 1\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n\n const iter = new NDIter(this);\n\n let min: number = Number.POSITIVE_INFINITY;\n for (const i of iter) {\n const value = d1[i!];\n if (min > value) {\n min = value;\n }\n }\n\n return min;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function matrix\n * @description Creates a matrix of `r` rows and `c` columns.\n * @param {Number} r\n * @param {Number} c\n * @returns {NDArray}\n * @example\n * import { matrix } from 'vectorious/core/matrix';\n * \n * matrix(2, 2); // => array([[0, 0], [0, 0]])\n */\nexport const matrix = (r: number, c: number): NDArray =>\n new NDArray(\n new Float64Array(r * c),\n { shape: [r, c] }\n );\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { matrix } from './matrix';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function multiply\n * @description\n * Multiplies two matrices `x` and `y` of matching dimensions.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { multiply } from 'vectorious/core/multiply';\n * \n * multiply([[1, 2]], [[1], [2]]); // => array([[5]])\n */\nexport const multiply = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).multiply(array(y));\n\n/**\n * @function multiply\n * @memberof NDArray.prototype\n * @description\n * Multiplies current matrix with `x`.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { shape: [r1, c1], data: d1, dtype } = this;\n const { shape: [r2, c2], data: d2 } = x;\n\n if (c1 !== r2) {\n throw new Error('sizes do not match');\n }\n\n const y = matrix(r1, c2);\n const { data: d3 } = y;\n\n try {\n blas.gemm(dtype, blas.NoTrans, blas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);\n } catch (err) {\n const iter = new NDIter(y);\n\n let k;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n let sum = 0;\n for (k = 0; k < c1; k += 1) {\n sum += d1[ci * c1 + k] * d2[k * c2 + cj];\n }\n\n d3[i!] = sum;\n [ci, cj] = iter.coords;\n }\n }\n\n return y;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as blas from '../blas';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function norm\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { norm } from 'vectorious/core/norm';\n * \n * norm([1, 2, 3]); // => 3.7416574954986572\n */\nexport const norm = (x: NDArray | ArrayLike): number => array(x).norm();\n\n/**\n * @function norm\n * @memberof NDArray.prototype\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).norm(); // => 3.7416574954986572\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let result: number = 0;\n\n try {\n result = blas.nrm2(dtype, l1, d1, 1);\n } catch (err) {\n result = f(this.dot(this));\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function normalize\n * @description Normalizes `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { normalize } from 'vectorious/core/normalize';\n * \n * normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport const normalize = (x: NDArray | ArrayLike): NDArray =>\n array(x).normalize();\n\n/**\n * @function normalize\n * @memberof NDArray.prototype\n * @description Normalizes current vector.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport default function(this: NDArray): NDArray {\n return this.scale(1 / this.norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { pow: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function pow\n * @description Returns each element of `x` to the exponent power, that is, element^exponent.\n * @param {NDArray} x\n * @param {Number} exponent\n * @returns {NDArray}\n * @example\n * import { pow } from 'vectorious/core/pow';\n * \n * pow([1, 2, 3], 2); // => array([1, 4, 9])\n */\nexport const pow = (x: NDArray | ArrayLike, exponent: number): NDArray =>\n array(x).pow(exponent);\n\n/**\n * @function pow\n * @memberof NDArray.prototype\n * @description Returns each element of current array to the exponent power, that is, element^exponent.\n * @param {Number} exponent\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])\n */\nexport default function(this: NDArray, exponent: number): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!], exponent);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function prod\n * @description Product of all elements of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { prod } from 'vectorious/core/prod';\n * \n * prod([1, 2, 3]); // => 6\n */\nexport const prod = (x: NDArray | ArrayLike): number => array(x).prod();\n\n/**\n * @function prod\n * @memberof NDArray.prototype\n * @description Product of all elements of current array\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).prod(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let prod: number = 1;\n for (const i of iter) {\n prod *= d1[i!];\n }\n\n return prod;\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function product\n * @description Hadamard product of `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { product } from 'vectorious/core/product';\n * \n * product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])\n */\nexport const product = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).product(array(y));\n\n/**\n * @function product\n * @memberof NDArray.prototype\n * @description Hadamard product of current matrix and `x`\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i!] *= d2[j!];\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function project\n * @description Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { project } from 'vectorious/core/project';\n * \n * project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport const project = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).project(array(y));\n\n/**\n * @function project\n * @memberof NDArray.prototype\n * @description Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n return x.scale(this.dot(x) / x.dot(x));\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function push\n * @description Pushes a new `value` into `x`.\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { push } from 'vectorious/core/push';\n * \n * push([1, 2, 3], 4); // => array([1, 2, 3, 4])\n */\nexport const push = (x: NDArray | ArrayLike, value: number): NDArray =>\n array(x).push(value);\n\n/**\n * @function push\n * @memberof NDArray.prototype\n * @description Pushes a new `value` into current vector.\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])\n */\nexport default function(this: NDArray, value: number): NDArray {\n if (this.shape.length !== 1) {\n throw new Error('push operation not permitted for multidimensional arrays');\n }\n\n const { data: d1, length: l1 } = this;\n const l2: number = l1 + 1;\n const d2: TypedArray = new (get_type(this.dtype))(l2);\n\n d2.set(d1);\n d2[l1] = value;\n\n this.data = d2;\n this.length = l2;\n this.shape = [l2];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function rank\n * @description Finds the rank of `x` using gaussian elimination.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { rank } from 'vectorious/core/rank';\n * \n * rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1\n */\nexport const rank = (x: NDArray | ArrayLike, tolerance: number = 1e-6): number => array(x).rank(tolerance);\n\n/**\n * @function rank\n * @memberof NDArray.prototype\n * @description Finds the rank of current matrix using gaussian elimination.\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1\n * @todo Switch to SVD algorithm\n */\nexport default function(this: NDArray, tolerance: number = 1e-6): number {\n const { data: d1 } = this.copy().gauss();\n\n const iter = new NDIter(this);\n\n let rk: number = 0;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (rk <= ci && cj >= ci && d1[i!] > tolerance) {\n rk += 1;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return rk;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reciprocal\n * @description Gets the element-wise reciprocal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { reciprocal } from 'vectorious/core/reciprocal';\n * \n * reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport const reciprocal = (x: NDArray | ArrayLike): NDArray =>\n array(x).reciprocal();\n\n/**\n * @function reciprocal\n * @memberof NDArray.prototype\n * @description Gets the element-wise reciprocal of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = 1 / d1[i!];\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reduce\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {NDArray} x\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { reduce } from 'vectorious/core/reduce';\n * \n * reduce([1, 2, 3], (a, b) => a + b, 0); // => 6\n */\nexport const reduce = (\n x: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number => array(x).reduce(f, initialValue);\n\n/**\n * @function reduce\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6\n */\nexport default function(\n this: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number {\n const { data: d1, length: l1 } = this;\n if (l1 === 0 && typeof initialValue === 'undefined') {\n throw new Error('Reduce of empty array with no initial value.');\n }\n\n const iter = new NDIter(this);\n const reduce = f.bind(this);\n\n let value: number;\n\n if (typeof initialValue === 'undefined') {\n value = d1[0];\n iter.next();\n } else {\n value = initialValue;\n }\n\n for (const i of iter) {\n value = reduce(value, d1[i!], i!, d1);\n }\n\n return value;\n};\n", "import { get_strides } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reshape\n * @description Reshapes `x`\n * @param {NDArray} x\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { reshape } from 'vectorious/core/reshape';\n * \n * reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])\n */\nexport const reshape = (x: NDArray | ArrayLike, ...shape: number[]): NDArray =>\n array(x).reshape(...shape);\n\n/**\n * @function reshape\n * @memberof NDArray.prototype\n * @description Reshapes current array\n * @param {Number[]} ...shape\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])\n */\nexport default function(this: NDArray, ...shape: number[]): NDArray {\n const { length } = this;\n if (shape.reduce((sum: number, dim: number) => sum * dim, 1) !== length) {\n throw new Error(`shape ${shape} does not match length ${length}`);\n }\n\n this.shape = shape;\n this.strides = get_strides(shape);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { round: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function round\n * @description Returns the value of each element of `x` rounded to the nearest integer.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { round } from 'vectorious/core/round';\n * \n * round([1.2, 2.8, 3.5]); // => array([1, 3, 4])\n */\nexport const round = (x: NDArray | ArrayLike): NDArray => array(x).round();\n\n/**\n * @function round\n * @memberof NDArray.prototype\n * @description Returns the value of each element of current array rounded to the nearest integer.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function row_add\n * @description Adds a multiple of one row multiplied by `scalar` to another inside `x`.\n * @param {NDArray} x\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { row_add } from 'vectorious/core/row_add';\n * \n * row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])\n */\nexport const row_add = (\n x: NDArray | ArrayLike,\n dest: number,\n source: number,\n scalar: number = 1\n): NDArray =>\n array(x).row_add(dest, source, scalar);\n\n/**\n * @function row_add\n * @memberof NDArray.prototype\n * @description Adds a multiple of one row multiplied by `scalar` to another inside current matrix.\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])\n */\nexport default function(this: NDArray, dest: number, source: number, scalar: number = 1): NDArray {\n this.check(dest, 0);\n this.check(source, 0);\n\n const [, c] = this.shape;\n const { data: d1 } = this;\n\n let j: number;\n for (j = 0; j < c; j += 1) {\n d1[dest * c + j] += d1[source * c + j] * scalar;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function scale\n * @description\n * Multiplies all elements of `x` with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {NDArray} x\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { scale } from 'vectorious/core/scale';\n * \n * scale([1, 2, 3], 2); // => array([2, 4, 6])\n */\nexport const scale = (x: NDArray | ArrayLike, scalar: number): NDArray =>\n array(x).scale(scalar);\n\n/**\n * @function scale\n * @memberof NDArray.prototype\n * @description\n * Multiplies all elements of current array with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])\n */\nexport default function(this: NDArray, scalar: number): NDArray {\n const { data: d1, length: l1, dtype } = this;\n\n try {\n blas.scal(dtype, l1, scalar, d1, 1);\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] *= scalar;\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function set\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { set } from 'vectorious/core/set';\n * \n * set([1, 2, 3], 1, 0); // => array([1, 0, 3])\n */\nexport const set = (x: NDArray, ...args: number[]): void => {\n x.set(...args);\n};\n\n/**\n * @function set\n * @memberof NDArray.prototype\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])\n */\nexport default function(this: NDArray, ...args: number[]): void {\n const indices: number[] = args.slice(0, -1);\n const value: number = args[args.length - 1];\n\n this.check(...indices);\n\n const { shape: s1 } = this;\n let index: number = indices[indices.length - 1];\n\n let i: number;\n for (i = 0; i < indices.length - 1; i += 1) {\n index += indices[i] * s1[i + 1];\n }\n\n this.data[index] = value;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sign: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sign\n * @description\n * Returns the sign of each element of `x`, indicating\n * whether it is positive, negative or zero.\n * @param {Number} x\n * @returns {NDArray}\n * @example\n * import { sign } from 'vectorious/core/sign';\n * \n * sign([1, 2, 3]); // => array([1, 1, 1])\n */\nexport const sign = (x: NDArray | ArrayLike): NDArray => array(x).sign();\n\n/**\n * @function sign\n * @memberof NDArray.prototype\n * @description\n * Returns the sign of each element of current array, indicating\n * whether it is positive, negative or zero.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sign(); // <=> array([1, 1, 1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sin\n * @description Returns the sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sin } from 'vectorious/core/sin';\n * \n * sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])\n */\nexport const sin = (x: NDArray | ArrayLike): NDArray => array(x).sin();\n\n/**\n * @function sin\n * @memberof NDArray.prototype\n * @description Returns the sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sinh\n * @description Returns the hyperbolic sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sinh } from 'vectorious/core/sinh';\n * \n * sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport const sinh = (x: NDArray | ArrayLike): NDArray => array(x).sinh();\n\n/**\n * @function sinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\nimport { get_length, get_strides } from '../util';\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function slice\n * @description Slices `x` in the corresponding dimension\n * @param {NDArray} x\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {NDArray}\n * @example\n * import { slice } from 'vectorious/core/slice';\n * \n * slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])\n */\nexport const slice = (\n x: NDArray | ArrayLike,\n begin?: number,\n end?: number,\n step?: number\n): NDArray =>\n array(x).slice(begin, end, step);\n\n/**\n * @function slice\n * @memberof NDArray.prototype\n * @description Slices the current array along the leading dimension\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])\n */\nexport default function(\n this: NDArray,\n begin: number = 0,\n end: number = this.shape[0],\n step: number = 1\n): NDArray {\n const { data: d1, shape: s1 } = this;\n const nd = s1.length;\n\n if (begin < 0 || end < 0) {\n return this.slice(begin < 0 ? s1[s1.length - 1] + begin : begin, end < 0 ? s1[s1.length - 1] + end : end);\n }\n\n if (begin > end) {\n return this.slice(end, begin, step);\n }\n\n if (step <= 0) {\n throw new Error('step argument has to be a positive integer');\n }\n\n const s2: number[] = [Math.ceil((end - begin) / Math.abs(step)), ...s1.slice(1)];\n const l2: number = get_length(s2);\n const st2: number[] = get_strides(s2);\n const d2: TypedArray = nd > 1\n ? d1.subarray(begin * s2[s2.length - 1], end * s2[s2.length - 1])\n : d1.subarray(begin, end);\n\n st2[0] *= step;\n\n return new NDArray(d2, {\n shape: s2,\n length: l2,\n strides: st2,\n });\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function solve\n * @description\n * Solves the equation AX = B (where A is `x` and B is `y`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { solve } from 'vectorious/core/solve';\n * \n * solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport const solve = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).solve(array(y));\n\n/**\n * @function solve\n * @memberof NDArray.prototype\n * @description\n * Solves the equation AX = B (where A is current matrix and B is `x`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1, dtype } = this;\n const { data: d2, shape: [n, nrhs] } = x;\n\n try {\n const ipiv: Int32Array = new Int32Array(n);\n lapack.gesv(dtype, n, nrhs, d1, n, ipiv, d2, nrhs);\n } catch (err) {\n const [LU, ipiv] = this.lu_factor();\n const { data: d1 } = LU;\n const { data: d2 } = x;\n\n let i: number;\n let j: number;\n let k: number;\n\n for (i = 0; i < ipiv.length; i += 1) {\n if (i !== ipiv[i] - 1) {\n x.swap(i, ipiv[i] - 1);\n }\n }\n\n for (k = 0; k < nrhs; k += 1) {\n for (i = 0; i < n; i += 1) {\n for (j = 0; j < i; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n }\n\n for (i = n - 1; i >= 0; i -= 1) {\n for (j = i + 1; j < n; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n\n d2[i * nrhs + k] /= d1[i * n + i];\n }\n }\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sqrt\n * @description Returns the positive square root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sqrt } from 'vectorious/core/sqrt';\n * \n * sqrt([1, 4, 9]); // => array([1, 2, 3])\n */\nexport const sqrt = (x: NDArray | ArrayLike): NDArray => array(x).sqrt();\n\n/**\n * @function sqrt\n * @memberof NDArray.prototype\n * @description Returns the positive square root of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 4, 9]); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function square\n * @description Asserts if `x` is square.\n * @param {NDArray} x\n * @throws {Error} matrix is not square\n * @example\n * import { square } from 'vectorious/core/square';\n * \n * square([1, 2, 3]); // Error: matrix is not square\n */\nexport const square = (x: NDArray | ArrayLike): void => {\n array(x).square();\n};\n\n/**\n * @function square\n * @memberof NDArray.prototype\n * @description Asserts if current matrix is square.\n * @throws {Error} matrix is not square\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).square(); // Error: matrix is not square\n */\nexport default function(this: NDArray): void {\n const { length } = this.shape;\n const [r, c] = this.shape;\n\n if (length !== 2 || r !== c) {\n throw new Error('matrix is not square');\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function subtract\n * @description\n * Subtracts `y` from `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { subtract } from 'vectorious/core/subtract';\n * \n * subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])\n */\nexport const subtract = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).subtract(array(y));\n\n/**\n * @function subtract\n * @memberof NDArray.prototype\n * @description\n * Subtracts `x` from the current array.\n * Accelerated with BLAS `?axpy`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])\n */\nexport default function (this: NDArray, x: NDArray): NDArray {\n return this.add(x, -1);\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function sum\n * @description Sum of `x`\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { sum } from 'vectorious/core/sum';\n * \n * sum([1, 2, 3]); // => 6\n */\nexport const sum = (x: NDArray | ArrayLike): number => array(x).sum();\n\n/**\n * @function sum\n * @memberof NDArray.prototype\n * @description Sum of array elements\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sum(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let sum: number = 0;\n for (const i of iter) {\n sum += d1[i!];\n }\n\n return sum;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function swap\n * @description Swaps two rows `i` and `j` in `x`.\n * @param {NDArray} x\n * @param {Number} i\n * @param {Number} j\n * @returns {NDArray}\n * @example\n * import { swap } from 'vectorious/core/swap';\n * \n * swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])\n */\nexport const swap = (x: NDArray | ArrayLike, i: number, j: number): NDArray =>\n array(x).swap(i, j);\n\n/**\n * @function swap\n * @memberof NDArray.prototype\n * @description Swaps two rows `i` and `j` in current matrix\n * @param {Number} i\n * @param {Number} j\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])\n */\nexport default function(this: NDArray, i: number, j: number): NDArray {\n this.check(i, 0);\n this.check(j, 0);\n\n const { data: d1 } = this;\n const [, c] = this.shape;\n const d2: TypedArray = d1.slice(i * c, (i + 1) * c);\n\n d1.copyWithin(i * c, j * c, (j + 1) * c);\n d1.set(d2, j * c);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tan\n * @description Returns the tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tan } from 'vectorious/core/tan';\n * \n * tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport const tan = (x: NDArray | ArrayLike): NDArray => array(x).tan();\n\n/**\n * @function tan\n * @memberof NDArray.prototype\n * @description Returns the tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tanh\n * @description Returns the hyperbolic tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tanh } from 'vectorious/core/tanh';\n * \n * tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport const tanh = (x: NDArray | ArrayLike): NDArray => array(x).tanh();\n\n/**\n * @function tanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toArray\n * @description Converts `x` into a JavaScript array.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { toArray } from 'vectorious/core/toArray';\n * \n * toArray([1, 2, 3]); // => [1, 2, 3]\n */\nexport const toArray = (x: NDArray | ArrayLike): any => array(x).toArray();\n\n/**\n * @function toArray\n * @memberof NDArray.prototype\n * @description Converts current vector into a JavaScript array.\n * @param {Number} index\n * @param {Number} dim\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toArray(); // => [1, 2, 3]\n */\nexport default function(this: NDArray, index: number = 0, dim = 0): any {\n const { data: d1, shape: s1, strides: st1 } = this;\n const { length: ndim } = s1;\n\n if (dim >= ndim) {\n return d1[index];\n }\n\n const n = s1[dim];\n const stride = st1[dim];\n const list = [];\n\n for (let i = 0; i < n; i++) {\n const item = this.toArray(index, dim + 1);\n if (item === null) {\n return null;\n }\n\n list[i] = item;\n index += stride;\n }\n\n return list;\n};\n", "import { inspect } from 'util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toString\n * @description Converts `x` into a readable formatted string.\n * @param {NDArray} x\n * @returns {String}\n * @example\n * import { toString } from 'vectorious/core/toString';\n * \n * toString([1, 2, 3]); // => '1,2,3'\n */\nexport const toString = (x: NDArray | ArrayLike): string => array(x).toString();\n\n/**\n * @function toString\n * @memberof NDArray.prototype\n * @description Converts current vector into a readable formatted string.\n * @returns {String}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toString(); // => '1,2,3'\n */\nexport default function (this: NDArray): string {\n return `array(${inspect(this.toArray(), { depth: 10, breakLength: 40 })}, dtype=${this.dtype})`;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function trace\n * @description Gets the trace of `x` (the sum of all diagonal elements).\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { trace } from 'vectorious/core/trace';\n * \n * trace([[1, 2], [3, 4]]); // => 5\n */\nexport const trace = (x: NDArray | ArrayLike): number => array(x).trace();\n\n/**\n * @function trace\n * @memberof NDArray.prototype\n * @description Gets the trace of the matrix (the sum of all diagonal elements).\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).trace(); // => 5\n */\nexport default function(this: NDArray): number {\n const [r, c] = this.shape;\n const { data: d1 } = this;\n const n: number = Math.min(r, c);\n\n let result: number = 0;\n\n let j: number;\n for (j = 0; j < n; j += 1) {\n result += d1[j * c + j];\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function transpose\n * @description Transposes `x` (mirror across the diagonal).\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { transpose } from 'vectorious/core/transpose';\n * \n * transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport const transpose = (x: NDArray | ArrayLike): NDArray =>\n array(x).transpose();\n\n/**\n * @function transpose\n * @memberof NDArray.prototype\n * @description Transposes current matrix (mirror across the diagonal).\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport default function(this: NDArray): NDArray {\n if (this.shape.length < 2) {\n return this;\n }\n\n let tmp = this.shape[0];\n this.shape[0] = this.shape[1];\n this.shape[1] = tmp;\n\n tmp = this.strides[0];\n this.strides[0] = this.strides[1];\n this.strides[1] = tmp;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { trunc: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function trunc\n * @description\n * Returns the integer part of each element of `x`,\n * removing any fractional digits.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { trunc } from 'vectorious/core/trunc';\n * \n * trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])\n */\nexport const trunc = (x: NDArray | ArrayLike): NDArray => array(x).trunc();\n\n/**\n * @function trunc\n * @memberof NDArray.prototype\n * @description\n * Returns the integer part of each element of current array,\n * removing any fractional digits.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function magic\n * @description Creates a magic square matrix of size `n`\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { magic } from 'vectorious/core/magic';\n * \n * magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])\n */\nexport const magic = (n: number): NDArray => {\n if (n < 0) {\n throw new Error('invalid n');\n }\n\n const d1: TypedArray = new Float64Array(n * n);\n const magic = new NDArray(d1, { shape: [n, n] });\n const iter = new NDIter(magic);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n const a = n - ci - 1;\n const b = n - cj - 1;\n\n d1[i!] = ((cj + a * 2 + 1) % n) * n + ((b + a * 2 + 1) % n) + 1;\n [ci, cj] = iter.coords;\n }\n\n return magic;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function ones\n * @description Creates an array containing ones (`1`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { ones } from 'vectorious/core/ones';\n * \n * ones(3); // => array([1, 1, 1])\n */\nexport const ones = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(1);\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function random\n * @description Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { random } from 'vectorious/core/random';\n * \n * random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])\n */\nexport const random = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).map(() => Math.random());\n", "import { TypedArray, TypedArrayConstructor } from '../types';\n\nimport { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function range\n * @description\n * Creates an array containing a range (can be either ascending or descending)\n * of numbers specified by the arguments provided (e.g. `NDArray.range(0, .5, 2)`\n * gives an array containing all numbers in the interval `[0, 2)` separated by\n * steps of `0.5`)\n * @param {Number} start\n * @param {Number} step\n * @param {Number} stop\n * @returns {NDArray}\n * @example\n * import { range } from 'vectorious/core/range';\n * \n * range(1, 2, 9); // => array([1, 3, 5, 7])\n */\nexport const range = (...args: number[]): NDArray => {\n const type: TypedArrayConstructor = Float32Array;\n let backwards: boolean = false;\n let start: number;\n let step: number;\n let end: number;\n\n switch (args.length) {\n case 2:\n end = args.pop() as number;\n step = 1;\n start = args.pop() as number;\n break;\n case 3:\n end = args.pop() as number;\n step = args.pop() as number;\n start = args.pop() as number;\n break;\n default:\n throw new Error('invalid range');\n }\n\n if (end - start < 0) {\n const copy: number = end;\n end = start;\n start = copy;\n backwards = true;\n }\n\n if (step > end - start) {\n throw new Error('invalid range');\n }\n\n const data: TypedArray = new type(Math.ceil((end - start) / step));\n\n let i: number = start;\n let j: number = 0;\n\n if (backwards) {\n for (; i < end; i += step, j += 1) {\n data[j] = end - i + start;\n }\n } else {\n for (; i < end; i += step, j += 1) {\n data[j] = i;\n }\n }\n\n return new NDArray(data);\n};\n", "import {\n DType,\n INDArray,\n TypedArray,\n} from '../types';\nimport {\n flatten,\n get_dtype,\n get_length,\n get_shape,\n get_strides,\n get_type,\n is_typed_array,\n} from '../util';\nimport {\n NDIter,\n} from '../iterator';\n\nimport { default as abs } from './abs';\nimport { default as acos } from './acos';\nimport { default as acosh } from './acosh';\nimport { default as add } from './add';\nimport { default as angle } from './angle';\nimport { default as asin } from './asin';\nimport { default as asinh } from './asinh';\nimport { default as atan } from './atan';\nimport { default as atanh } from './atanh';\nimport { default as augment } from './augment';\nimport { default as binOp } from './binOp';\nimport { default as cbrt } from './cbrt';\nimport { default as ceil } from './ceil';\nimport { default as check } from './check';\nimport { default as combine } from './combine';\nimport { default as copy } from './copy';\nimport { default as cos } from './cos';\nimport { default as cosh } from './cosh';\nimport { default as cross } from './cross';\nimport { default as det } from './det';\nimport { default as diagonal } from './diagonal';\nimport { default as dot } from './dot';\nimport { default as eig } from './eig';\nimport { default as equals } from './equals';\nimport { default as equidimensional } from './equidimensional';\nimport { default as equilateral } from './equilateral';\nimport { default as exp } from './exp';\nimport { default as expm1 } from './expm1';\nimport { default as fill } from './fill';\nimport { default as floor } from './floor';\nimport { default as forEach } from './forEach';\nimport { default as fround } from './fround';\nimport { default as gauss } from './gauss';\nimport { default as get } from './get';\nimport { default as inv } from './inv';\nimport { default as log } from './log';\nimport { default as log10 } from './log10';\nimport { default as log1p } from './log1p';\nimport { default as log2 } from './log2';\nimport { default as lu } from './lu';\nimport { default as lu_factor } from './lu_factor';\nimport { default as map } from './map';\nimport { default as max } from './max';\nimport { default as mean } from './mean';\nimport { default as min } from './min';\nimport { default as multiply } from './multiply';\nimport { default as norm } from './norm';\nimport { default as normalize } from './normalize';\nimport { default as pow } from './pow';\nimport { default as prod } from './prod';\nimport { default as product } from './product';\nimport { default as project } from './project';\nimport { default as push } from './push';\nimport { default as rank } from './rank';\nimport { default as reciprocal } from './reciprocal';\nimport { default as reduce } from './reduce';\nimport { default as reshape } from './reshape';\nimport { default as round } from './round';\nimport { default as row_add } from './row_add';\nimport { default as scale } from './scale';\nimport { default as set } from './set';\nimport { default as sign } from './sign';\nimport { default as sin } from './sin';\nimport { default as sinh } from './sinh';\nimport { default as slice } from './slice';\nimport { default as solve } from './solve';\nimport { default as sqrt } from './sqrt';\nimport { default as square } from './square';\nimport { default as subtract } from './subtract';\nimport { default as sum } from './sum';\nimport { default as swap } from './swap';\nimport { default as tan } from './tan';\nimport { default as tanh } from './tanh';\nimport { default as toArray } from './toArray';\nimport { default as toString } from './toString';\nimport { default as trace } from './trace';\nimport { default as transpose } from './transpose';\nimport { default as trunc } from './trunc';\n\nconst inspectSymbol: unique symbol = Symbol.for('nodejs.util.inspect.custom');\n\n/**\n * @class NDArray\n * @description Constructs or copies an NDArray instance.\n * @param data\n * @param {Object} [options]\n * @param {Number[]} [options.shape]\n * @param {Number} [options.length]\n * @param {Number[]} [options.strides]\n * @param {string} [options.dtype]\n * @example\n * import { NDArray } from 'vectorious';\n *\n * new NDArray() // => array([], dtype=float64)\n * new NDArray([]) // => array([], dtype=float64)\n * new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)\n * new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)\n * new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)\n * new NDArray([1, 2, 3, 4], {\n * shape: [2, 2],\n * dtype: 'uint32'\n * }) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)\n */\nexport class NDArray implements INDArray {\n /**\n * @name data\n * @memberof NDArray.prototype\n * @type TypedArray\n * @default new Float64Array(0)\n */\n public data: TypedArray = new Float64Array(0);\n \n /**\n * @name dtype\n * @memberof NDArray.prototype\n * @type String\n * @default 'float64'\n */\n public dtype: DType = 'float64';\n\n /**\n * @name length\n * @memberof NDArray.prototype\n * @type Number\n * @default 0\n */\n public length: number = 0;\n\n /**\n * @name shape\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public shape: number[] = [0];\n\n /**\n * @name strides\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public strides: number[] = [0];\n\n public [inspectSymbol]: () => string = toString;\n public abs = abs;\n public acos = acos;\n public acosh = acosh;\n public add = add;\n public angle = angle;\n public asin = asin;\n public asinh = asinh;\n public atan = atan;\n public atanh = atanh;\n public augment = augment;\n public binOp = binOp;\n public cbrt = cbrt;\n public ceil = ceil;\n public check = check;\n public combine = combine;\n public copy = copy;\n public cos = cos;\n public cosh = cosh;\n public cross = cross;\n public det = det;\n public diagonal = diagonal;\n public dot = dot;\n public eig = eig;\n public equals = equals;\n public equidimensional = equidimensional;\n public equilateral = equilateral;\n public exp = exp;\n public expm1 = expm1;\n public fill = fill;\n public floor = floor;\n public forEach = forEach;\n public fround = fround;\n public gauss = gauss;\n public get = get;\n public inv = inv;\n public log = log;\n public log10 = log10;\n public log1p = log1p;\n public log2 = log2;\n public lu = lu;\n public lu_factor = lu_factor;\n public map = map;\n public max = max;\n public mean = mean;\n public min = min;\n public multiply = multiply;\n public norm = norm;\n public normalize = normalize;\n public pow = pow;\n public prod = prod;\n public product = product;\n public project = project;\n public push = push;\n public rank = rank;\n public reciprocal = reciprocal;\n public reduce = reduce;\n public reshape = reshape;\n public round = round;\n public row_add = row_add;\n public scale = scale;\n public set = set;\n public sign = sign;\n public sin = sin;\n public sinh = sinh;\n public slice = slice;\n public solve = solve;\n public sqrt = sqrt;\n public square = square;\n public subtract = subtract;\n public sum = sum;\n public swap = swap;\n public tan = tan;\n public tanh = tanh;\n public toArray = toArray;\n public toString = toString;\n public trace = trace;\n public transpose = transpose;\n public trunc = trunc;\n\n public constructor(\n data?: any,\n options?: {\n shape?: number[];\n length?: number;\n strides?: number[];\n dtype?: DType;\n }\n ) {\n if (!data) {\n return;\n }\n\n if (data instanceof NDArray) {\n return data;\n }\n\n if (data instanceof NDIter) {\n if (!options || !options.dtype) {\n throw new Error('dtype is missing');\n }\n\n if (data.shape) {\n options.shape = data.shape;\n }\n\n const length = data.length;\n data = new (get_type(options.dtype))(length);\n }\n\n const {\n shape = get_shape(data),\n length = get_length(shape),\n strides = get_strides(shape),\n dtype = get_dtype(data),\n } = options || {};\n\n this.data = is_typed_array(data) ? data : new (get_type(dtype))(flatten(data));\n this.shape = shape;\n this.length = length;\n this.dtype = dtype;\n this.strides = strides;\n }\n\n /**\n * @name x\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 0\n * @type Number\n */\n public get x(): number {\n return this.get(0);\n }\n\n public set x(value: number) {\n this.set(0, value);\n }\n\n /**\n * @name y\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 1\n * @type Number\n */\n public get y(): number {\n return this.get(1);\n }\n\n public set y(value: number) {\n this.set(1, value);\n }\n\n /**\n * @name z\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 2\n * @type Number\n */\n public get z(): number {\n return this.get(2);\n }\n\n public set z(value: number) {\n this.set(2, value);\n }\n\n /**\n * @name w\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 3\n * @type Number\n */\n public get w(): number {\n return this.get(3);\n }\n\n public set w(value: number) {\n this.set(3, value);\n }\n\n /**\n * @name T\n * @memberof NDArray.prototype\n * @description Short for `this.transpose()`\n * @type NDArray\n */\n public get T() {\n return this.transpose();\n }\n}\n\nexport { abs } from './abs';\nexport { acos } from './acos';\nexport { acosh } from './acosh';\nexport { add } from './add';\nexport { angle } from './angle';\nexport { array } from './array';\nexport { asin } from './asin';\nexport { asinh } from './asinh';\nexport { atan } from './atan';\nexport { atanh } from './atanh';\nexport { augment } from './augment';\nexport { binOp } from './binOp';\nexport { cbrt } from './cbrt';\nexport { ceil } from './ceil';\nexport { check } from './check';\nexport { combine } from './combine';\nexport { copy } from './copy';\nexport { cos } from './cos';\nexport { cosh } from './cosh';\nexport { cross } from './cross';\nexport { det } from './det';\nexport { diagonal } from './diagonal';\nexport { dot } from './dot';\nexport { eig } from './eig';\nexport { equals } from './equals';\nexport { equidimensional } from './equidimensional';\nexport { equilateral } from './equilateral';\nexport { exp } from './exp';\nexport { expm1 } from './expm1';\nexport { eye } from './eye';\nexport { fill } from './fill';\nexport { floor } from './floor';\nexport { forEach } from './forEach';\nexport { fround } from './fround';\nexport { gauss } from './gauss';\nexport { get } from './get';\nexport { inv } from './inv';\nexport { log } from './log';\nexport { log10 } from './log10';\nexport { log1p } from './log1p';\nexport { log2 } from './log2';\nexport { lu } from './lu';\nexport { lu_factor } from './lu_factor';\nexport { magic } from './magic';\nexport { map } from './map';\nexport { matrix } from './matrix';\nexport { max } from './max';\nexport { mean } from './mean';\nexport { min } from './min';\nexport { multiply } from './multiply';\nexport { norm } from './norm';\nexport { normalize } from './normalize';\nexport { ones } from './ones';\nexport { pow } from './pow';\nexport { prod } from './prod';\nexport { product } from './product';\nexport { project } from './project';\nexport { push } from './push';\nexport { random } from './random';\nexport { range } from './range';\nexport { rank } from './rank';\nexport { reciprocal } from './reciprocal';\nexport { reduce } from './reduce';\nexport { reshape } from './reshape';\nexport { round } from './round';\nexport { row_add } from './row_add';\nexport { scale } from './scale';\nexport { set } from './set';\nexport { sign } from './sign';\nexport { sin } from './sin';\nexport { sinh } from './sinh';\nexport { slice } from './slice';\nexport { solve } from './solve';\nexport { sqrt } from './sqrt';\nexport { square } from './square';\nexport { subtract } from './subtract';\nexport { sum } from './sum';\nexport { swap } from './swap';\nexport { tan } from './tan';\nexport { tanh } from './tanh';\nexport { toArray } from './toArray';\nexport { toString } from './toString';\nexport { trace } from './trace';\nexport { transpose } from './transpose';\nexport { trunc } from './trunc';\nexport { zeros } from './zeros';\n\ntry {\n (window as any).v = NDArray;\n} catch (error) {}\n"], + "mappings": "opBAAA,sBAAO,QAAU,SAAkB,EAAK,CACtC,MAAO,IAAO,MAAO,IAAQ,UACxB,MAAO,GAAI,MAAS,YACpB,MAAO,GAAI,MAAS,YACpB,MAAO,GAAI,WAAc,cCJhC,kBAAI,MAAO,QAAO,QAAW,WAE3B,EAAO,Q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Ae,EAAI,QACb,EAAP", "names": [] } diff --git a/dist/index.js b/dist/index.js index 258311fb..695a6817 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -var Ho=Object.create,E=Object.defineProperty,Jo=Object.getPrototypeOf,Ko=Object.prototype.hasOwnProperty,Qo=Object.getOwnPropertyNames,Zo=Object.getOwnPropertyDescriptor;var C=r=>E(r,"__esModule",{value:!0});var ra=(r,t)=>{for(var o in t)E(r,o,{get:t[o],enumerable:!0})},ta=(r,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qo(t))!Ko.call(r,a)&&a!=="default"&&E(r,a,{get:()=>t[a],enumerable:!(o=Zo(t,a))||o.enumerable});return r},oa=r=>ta(C(E(r!=null?Ho(Jo(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);C(exports);ra(exports,{NDArray:()=>A,NDIter:()=>c,NDMultiIter:()=>b,V_MAXDIMS:()=>x,abs:()=>Y,acos:()=>G,acosh:()=>W,add:()=>tr,angle:()=>ar,array:()=>i,asin:()=>nr,asinh:()=>sr,atan:()=>pr,atanh:()=>yr,augment:()=>q,binOp:()=>hr,cbrt:()=>dr,ceil:()=>br,check:()=>Nr,combine:()=>gr,copy:()=>kr,cos:()=>Ir,cosh:()=>vr,cross:()=>Er,det:()=>jr,diagonal:()=>zr,dot:()=>Sr,eig:()=>Or,equals:()=>Cr,equidimensional:()=>Rr,equilateral:()=>Br,exp:()=>Pr,expm1:()=>Xr,eye:()=>k,fill:()=>Jr,floor:()=>Qr,forEach:()=>rt,fround:()=>ot,gauss:()=>it,get:()=>mt,inv:()=>ct,log:()=>ft,log10:()=>ht,log1p:()=>dt,log2:()=>bt,lu:()=>Nt,lu_factor:()=>gt,magic:()=>Go,map:()=>kt,matrix:()=>_,max:()=>It,mean:()=>vt,min:()=>Et,multiply:()=>jt,norm:()=>zt,normalize:()=>St,ones:()=>Po,pow:()=>Ot,prod:()=>Ct,product:()=>Rt,project:()=>Bt,push:()=>Pt,random:()=>Wo,range:()=>Xo,rank:()=>Xt,reciprocal:()=>Jt,reduce:()=>Qt,reshape:()=>ro,round:()=>oo,row_add:()=>eo,scale:()=>io,set:()=>mo,sign:()=>co,sin:()=>fo,sinh:()=>ho,slice:()=>Ao,solve:()=>Do,sqrt:()=>xo,square:()=>wo,subtract:()=>Lo,sum:()=>To,swap:()=>Mo,tan:()=>qo,tanh:()=>_o,toArray:()=>Fo,toString:()=>Oo,trace:()=>$o,transpose:()=>Vo,trunc:()=>Yo,zeros:()=>D});var z=r=>r.reduce((t,o)=>t.concat(Array.isArray(o)?z(o):o),[]),F=r=>ArrayBuffer.isView(r)&&!(r instanceof DataView),V=r=>r.reduce((t,o)=>t*o,1),S=r=>Array.isArray(r)||F(r)?[r.length].concat(S(r[0])):[],w=r=>[...r.slice(1).map((t,o)=>r.slice(o+1).reduce((a,n)=>a*n,1)),1],R=r=>{let{constructor:{name:t="Float32Array"}={}}=r||{};switch(t){case"Int8Array":return"int8";case"Uint8Array":return"uint8";case"Int16Array":return"int16";case"Uint16Array":return"uint16";case"Int32Array":return"int32";case"Uint32Array":return"uint32";case"Uint8ClampedArray":return"uint8c";case"Float32Array":return"float32";case"Float64Array":return"float64";default:return"float64"}},N=r=>{switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"uint8c":return Uint8ClampedArray;case"float32":return Float32Array;case"float64":return Float64Array;default:return Float64Array}};var i=(...r)=>new A(...r);var x=32,c=class{constructor(t){this.x=i(t);let{shape:o,strides:a,length:n}=this.x;this.length=n,this.lengthm1=n-1,this.nd=o.length,this.ndm1=this.nd-1,this.shape=Array(x).fill(0),this.strides=Array(x).fill(0),this.shapem1=Array(x).fill(0),this.coords=Array(x).fill(0),this.backstrides=Array(x).fill(0),this.factors=Array(x).fill(0),this.nd!==0&&(this.factors[this.nd-1]=1),this.contiguous=!0;let e=1,s;for(s=0;s0&&(this.factors[this.ndm1-s]=this.factors[this.nd-s]*o[this.nd-s]);this.index=0,this.pos=0}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next1d(){let{strides:t}=this;this.pos+=t[0],this.coords[0]+=1}nextcontiguous(){this.pos+=1}next2d(){let{strides:t,shapem1:o,backstrides:a}=this;this.coords[1]=0;e-=1){if(this.coords[e]new c(p)),this.numiter=t.length;let o,a;for(o=0,a=0;o=0){if(m=n.x.shape[s],m==1)continue;if(this.shape[o]==1)this.shape[o]=m;else if(this.shape[o]!==m)throw new Error("shape mismatch")}for(m=this.shape.reduce((p,y)=>p*y,1),this.length=m,this.lengthm1=m-1,o=0;o0&&(n.factors[this.nd-e-1]=n.factors[this.nd-e]*this.shape[this.nd-e]);this.index=0,this.pos=Array(this.numiter).fill(0)}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next(){let t=this.current();this.index+=1;let{numiter:o}=this,a,n;for(n=0;ni(r).abs();function B(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=aa(r[o]);return this}var{acos:ea}=Math,G=r=>i(r).acos();function P(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ea(r[o]);return this}var{acosh:na}=Math,W=r=>i(r).acosh();function X(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=na(r[o]);return this}var d;try{d=require("nblas")}catch(r){}var U=d&&d.NoTrans,Ja=d&&d.Trans;function H(r,t,o,a,n,e,s){if(a.length/n!==t||e.length/s!==t)throw new Error("lengths do not match");switch(r){case"float64":return d.daxpy(t,o,a,n,e,s);case"float32":return d.saxpy(t,o,a,n,e,s);default:throw new Error("wrong dtype")}}function J(r,t,o,a,n,e){if(o.length/a!==t||n.length/e!==t)throw new Error("lengths do not match");switch(r){case"float64":return d.ddot(t,o,a,n,e);case"float32":return d.sdot(t,o,a,n,e);default:throw new Error("wrong dtype")}}function K(r,t,o,a){if(o.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return d.idamax(t,o,a);case"float32":return d.isamax(t,o,a);default:throw new Error("wrong dtype")}}function Q(r,t,o,a,n,e,s,m,p,y,f,u,h,l){let{length:I}=m,{length:v}=y,{length:M}=h;if(t===d.NoTrans&&I!==p*a||t===d.Trans&&I!==p*e)throw new Error("lengths do not match");if(o===d.NoTrans&&v!==f*e||o===d.Trans&&v!==f*n)throw new Error("lengths do not match");if(M!==l*a)throw new Error("lengths do not match");switch(r){case"float64":return d.dgemm(t,o,a,n,e,s,m,p,y,f,u,h,l);case"float32":return d.sgemm(t,o,a,n,e,s,m,p,y,f,u,h,l);default:throw new Error("wrong dtype")}}function Z(r,t,o,a){if(o.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return d.dnrm2(t,o,a);case"float32":return d.snrm2(t,o,a);default:throw new Error("wrong dtype")}}function rr(r,t,o,a,n){if(a.length/n!==t)throw new Error("lengths do not match");switch(r){case"float64":return d.dscal(t,o,a,n);case"float32":return d.sscal(t,o,a,n);default:throw new Error("wrong dtype")}}var tr=(r,t,o=1)=>i(r).add(i(t),o);function or(r,t=1){let{data:o,length:a,dtype:n}=this,{data:e}=i(r);try{H(n,a,t,e,1,o,1)}catch(s){let m=new b(this,r);for(let[p,y]of m)o[p]+=t*e[y]}return this}var{acos:ia}=Math,ar=(r,t)=>i(r).angle(i(t));function er(r){return ia(this.dot(i(r))/this.norm()/i(r).norm())}var{asin:sa}=Math,nr=r=>i(r).asin();function ir(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=sa(r[o]);return this}var{asinh:ma}=Math,sr=r=>i(r).asinh();function mr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ma(r[o]);return this}var{atan:pa}=Math,pr=r=>i(r).atan();function cr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=pa(r[o]);return this}var{atanh:ca}=Math,yr=r=>i(r).atanh();function fr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ca(r[o]);return this}var D=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(0);var q=(r,t)=>i(r).augment(i(t));function ur(r){let[t,o]=this.shape,[a,n]=i(r).shape,{data:e}=this,{data:s}=i(r);if(a===0||n===0)return this;if(t!==a)throw new Error("rows do not match");let m=D(t,o+n),{data:p}=m,y,f;for(y=0;yi(r).binOp(i(t),o);function lr(r,t){let{data:o}=this,{data:a}=i(r),n=new b(this,r);for(let[e,s]of n)o[e]=t(o[e],a[s],e);return this}var{cbrt:ya}=Math,dr=r=>i(r).cbrt();function Ar(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ya(r[o]);return this}var{ceil:fa}=Math,br=r=>i(r).ceil();function Dr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=fa(r[o]);return this}var Nr=(r,...t)=>{i(r).check(...t)};function xr(...r){let{shape:t,length:o}=this;if(r.length===1){let[a]=r;if(a<0||a>o-1||!Number.isFinite(a))throw new Error("index out of bounds")}else if(!t.every((a,n)=>a>r[n]&&Number.isFinite(r[n])&&r[n]>=0))throw new Error("index out of bounds")}var gr=(r,t)=>i(r).combine(i(t));function wr(r){if(this.shape.length!==1&&r.shape.length!==1)throw new Error("combine operation not permitted for multidimensional arrays");let{length:t,data:o}=this,{length:a,data:n}=r;if(a===0)return this;if(t===0)return this.data=new(N(r.dtype))(n),this.length=a,this.dtype=r.dtype,this;let e=t+a,s=new(N(this.dtype))(e);return s.set(o),s.set(n,t),this.data=s,this.length=e,this.shape=[e],this}var kr=r=>i(r).copy();function Lr(){let r=D(...this.shape),{data:t}=this,{data:o}=r,a=new b(this,r);for(let[n,e]of a)o[e]=t[n];return r}var{cos:ua}=Math,Ir=r=>i(r).cos();function Tr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ua(r[o]);return this}var{cosh:ha}=Math,vr=r=>i(r).cosh();function Mr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ha(r[o]);return this}var Er=(r,t)=>i(r).cross(i(t));function qr(r){let{length:t}=this,{length:o}=r;if(t!==3||o!==3)throw new Error("vectors must have three components");let a=this.y*r.z-this.z*r.y,n=this.z*r.x-this.x*r.z,e=this.x*r.y-this.y*r.x;return this.x=a,this.y=n,this.z=e,this}var jr=r=>i(r).det();function _r(){this.square();let[r]=this.shape,[t,o]=this.copy().lu_factor(),{data:a}=t,n=1,e=1,s;for(s=0;si(r).diagonal();function Fr(){this.square();let{length:r}=this,[t,o]=this.shape,a=Math.min(t,o);return this.reshape(r).slice(0,r,a+1)}var Sr=(r,t)=>i(r).dot(i(t));function Ur(r){let{data:t,length:o,dtype:a}=this,{data:n}=r,e=0;try{e=J(a,o,n,1,t,1)}catch(s){let m=new b(this,r);for(let[p,y]of m)e+=t[p]*n[y]}return e}var k=r=>{let t=new A(new Float64Array(r*r),{shape:[r,r]}),{data:o}=t,a;for(a=0;a{let[m]=r.shape,{data:p}=r,y=p[a*m+n],f=1/(t+o);p[a*m+n]=y-o*(p[e*m+s]+f*y),p[e*m+s]+=o*(y-f*p[e*m+s])},Or=r=>i(r).eig();function $r(){this.square();let[r]=this.shape;try{["float32","float64"].includes(this.dtype)||(this.dtype="float32",this.data=N(this.dtype).from(this.data));let t=T.NoEigenvector,o=T.Eigenvector,a=D(r),n=D(r),e=D(r,r),s=D(r,r),{data:m}=this,{data:p}=a,{data:y}=n,{data:f}=e,{data:u}=s;return this.dtype==="float64"&&T.dgeev(t,o,r,m,r,p,y,f,r,u,r),this.dtype==="float32"&&T.sgeev(t,o,r,m,r,p,y,f,r,u,r),[a,s]}catch(t){let{data:o}=this,a=k(r),n=0,e=0,s=0,m=0,p=0;do{for(e=0;e=n&&(n=Math.abs(o[e*r+s]),m=e,p=s);let y;if(Math.abs(o[m*r+p])=1e-9);return[this.diagonal(),a]}}var Cr=(r,t,o=1e-6)=>i(r).equals(i(t),o);function Vr(r,t=1e-6){let{data:o}=this,{data:a}=r,n=new b(this,r);for(let[e,s]of n)if(Math.abs(o[e]-a[s])>t)return!1;return!0}var Rr=(r,t)=>{i(r).equidimensional(i(t))};function Yr(r){let{shape:t}=this,{shape:o}=r;if(!t.every((a,n)=>a===o[n]))throw new Error(`shapes ${t} and ${o} do not match`)}var Br=(r,t)=>{i(r).equilateral(i(t))};function Gr(r){let{length:t}=this,{length:o}=r;if(t!==o)throw new Error(`lengths ${t} and ${o} do not match`)}var{exp:la}=Math,Pr=r=>i(r).exp();function Wr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=la(r[o]);return this}var{expm1:da}=Math,Xr=r=>i(r).expm1();function Hr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=da(r[o]);return this}var Jr=(r,t=0)=>i(r).fill(t);function Kr(r=0){let{data:t}=this,o=new c(this);for(let a of o)t[a]=r instanceof Function?r(o.pos):r;return this}var{floor:Aa}=Math,Qr=r=>i(r).floor();function Zr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Aa(r[o]);return this}var rt=(r,t)=>{r.forEach(t)};function tt(r){let{data:t}=this,o=new c(this);for(let a of o)r.call(this,t[a],a,t)}var{fround:ba}=Math,ot=r=>i(r).fround();function at(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ba(r[o]);return this}var g;try{g=require("nlapack")}catch(r){}function L(r,t,o,a,n,e){if(a.length!==t*o)throw new Error("lengths do not match");switch(r){case"float64":return g.dgetrf(t,o,a,n,e);case"float32":return g.sgetrf(t,o,a,n,e);default:throw new Error("wrong dtype")}}function et(r,t,o,a,n){if(o.length!==t*t)throw new Error("lengths do not match");switch(r){case"float64":return g.dgetri(t,o,a,n);case"float32":return g.sgetri(t,o,a,n);default:throw new Error("wrong dtype")}}function nt(r,t,o,a,n,e,s,m){if(a.length!==n*t||s.length!==m*o)throw new Error("lengths do not match");switch(r){case"float64":return g.dgesv(t,o,a,n,e,s,m);case"float32":return g.sgesv(t,o,a,n,e,s,m);default:throw new Error("wrong dtype")}}var it=r=>i(r).gauss();function st(){let{shape:[r,t],data:o,dtype:a}=this;try{let{data:n}=this,e=new Int32Array(Math.min(r,t));L(a,r,t,n,t,e);let s=new c(this),[m,p]=s.coords;for(let y of s)pi(r).get(...t);function pt(...r){this.check(...r);let{data:t,shape:o}=this,{length:a}=o,n=r[a-1],e,s;for(e=0;ei(r).inv();function yt(){this.square();let{shape:[r],dtype:t}=this;try{let{data:o}=this,a=new Int32Array(r);return L(t,r,r,o,r,a),et(t,r,o,r,a),this}catch(o){let a=k(r),n=q(this,a).gauss(),e=D(r,r),s=D(r,r),{data:m}=n,{data:p}=e,{data:y}=s,f=new c(n),[u,h]=f.coords;for(let l of f)hi(r).log();function ut(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Da(r[o]);return this}var{log10:Na}=Math,ht=r=>i(r).log10();function lt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Na(r[o]);return this}var{log1p:xa}=Math,dt=r=>i(r).log1p();function At(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=xa(r[o]);return this}var{log2:ga}=Math,bt=r=>i(r).log2();function Dt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ga(r[o]);return this}var Nt=r=>i(r).lu();function xt(){let[r,t]=this.copy().lu_factor(),o=r.copy(),a=r.copy(),{data:n}=o,{data:e}=a,s=new c(r),[m,p]=s.coords;for(let y of s)pi(r).lu_factor();function wt(){let{data:r,shape:[t],dtype:o}=this,a=new Int32Array(t);try{L(o,t,t,r,t,a)}catch(n){let e,s,m,p,y,f,u;for(u=0;ui(r).map(t);function Lt(r){let{data:t}=this,o=new c(this),a=r.bind(this),n=this.copy(),{data:e}=n;for(let s of o)e[s]=a(t[s],s,t);return n}var It=r=>i(r).max();function Tt(){let{data:r,length:t,dtype:o}=this,a=Number.NEGATIVE_INFINITY;try{a=r[K(o,t,r,1)]}catch(n){let e=new c(this);for(let s of e){let m=r[s];ai(r).mean();function Mt(){let{data:r,length:t}=this,o=new c(this),a=0;for(let n of o)a+=r[n];return a/t}var Et=r=>i(r).min();function qt(){let{data:r}=this,t=new c(this),o=Number.POSITIVE_INFINITY;for(let a of t){let n=r[a];o>n&&(o=n)}return o}var _=(r,t)=>new A(new Float64Array(r*t),{shape:[r,t]});var jt=(r,t)=>i(r).multiply(i(t));function _t(r){let{shape:[t,o],data:a,dtype:n}=this,{shape:[e,s],data:m}=r;if(o!==e)throw new Error("sizes do not match");let p=_(t,s),{data:y}=p;try{Q(n,U,U,t,s,o,1,a,o,m,s,0,y,s)}catch(f){let u=new c(p),h,[l,I]=u.coords;for(let v of u){let M=0;for(h=0;hi(r).norm();function Ft(){let{data:r,length:t,dtype:o}=this,a=0;try{a=Z(o,t,r,1)}catch(n){a=wa(this.dot(this))}return a}var St=r=>i(r).normalize();function Ut(){return this.scale(1/this.norm())}var{pow:ka}=Math,Ot=(r,t)=>i(r).pow(t);function $t(r){let{data:t}=this,o=new c(this);for(let a of o)t[a]=ka(t[a],r);return this}var Ct=r=>i(r).prod();function Vt(){let{data:r}=this,t=new c(this),o=1;for(let a of t)o*=r[a];return o}var Rt=(r,t)=>i(r).product(i(t));function Yt(r){let{data:t}=this,{data:o}=r,a=new b(this,r);for(let[n,e]of a)t[n]*=o[e];return this}var Bt=(r,t)=>i(r).project(i(t));function Gt(r){return r.scale(this.dot(r)/r.dot(r))}var Pt=(r,t)=>i(r).push(t);function Wt(r){if(this.shape.length!==1)throw new Error("push operation not permitted for multidimensional arrays");let{data:t,length:o}=this,a=o+1,n=new(N(this.dtype))(a);return n.set(t),n[o]=r,this.data=n,this.length=a,this.shape=[a],this}var Xt=(r,t=1e-6)=>i(r).rank(t);function Ht(r=1e-6){let{data:t}=this.copy().gauss(),o=new c(this),a=0,[n,e]=o.coords;for(let s of o)a<=n&&e>=n&&t[s]>r&&(a+=1),[n,e]=o.coords;return a}var Jt=r=>i(r).reciprocal();function Kt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=1/r[o];return this}var Qt=(r,t,o)=>i(r).reduce(t,o);function Zt(r,t){let{data:o,length:a}=this;if(a===0&&typeof t=="undefined")throw new Error("Reduce of empty array with no initial value.");let n=new c(this),e=r.bind(this),s;typeof t=="undefined"?(s=o[0],n.next()):s=t;for(let m of n)s=e(s,o[m],m,o);return s}var ro=(r,...t)=>i(r).reshape(...t);function to(...r){let{length:t}=this;if(r.reduce((o,a)=>o*a,1)!==t)throw new Error(`shape ${r} does not match length ${t}`);return this.shape=r,this.strides=w(r),this}var{round:La}=Math,oo=r=>i(r).round();function ao(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=La(r[o]);return this}var eo=(r,t,o,a=1)=>i(r).row_add(t,o,a);function no(r,t,o=1){this.check(r,0),this.check(t,0);let[,a]=this.shape,{data:n}=this,e;for(e=0;ei(r).scale(t);function so(r){let{data:t,length:o,dtype:a}=this;try{rr(a,o,r,t,1)}catch(n){let e=new c(this);for(let s of e)t[s]*=r}return this}var mo=(r,...t)=>{r.set(...t)};function po(...r){let t=r.slice(0,-1),o=r[r.length-1];this.check(...t);let{shape:a}=this,n=t[t.length-1],e;for(e=0;ei(r).sign();function yo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ia(r[o]);return this}var{sin:Ta}=Math,fo=r=>i(r).sin();function uo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ta(r[o]);return this}var{sinh:va}=Math,ho=r=>i(r).sinh();function lo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=va(r[o]);return this}var Ao=(r,t,o,a)=>i(r).slice(t,o,a);function bo(r=0,t=this.shape[0],o=1){let{shape:a}=this,n=a.length;if(r<0||t<0)return this.slice(r<0?n+r:r,t<0?n+t:t);if(o===0)throw new Error("step argument cannot be 0");let e=[Math.ceil((t-r)/o),...a.slice(1)],s=e.reduce((p,y)=>p*y,1),m=w(e);return this.shape=e,this.length=s,this.strides=m,this}var Do=(r,t)=>i(r).solve(i(t));function No(r){let{data:t,dtype:o}=this,{data:a,shape:[n,e]}=r;try{let s=new Int32Array(n);nt(o,n,e,t,n,s,a,e)}catch(s){let[m,p]=this.lu_factor(),{data:y}=m,{data:f}=r,u,h,l;for(u=0;u=0;u-=1){for(h=u+1;hi(r).sqrt();function go(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ma(r[o]);return this}var wo=r=>{i(r).square()};function ko(){let{length:r}=this.shape,[t,o]=this.shape;if(r!==2||t!==o)throw new Error("matrix is not square")}var Lo=(r,t)=>i(r).subtract(i(t));function Io(r){return this.add(r,-1)}var To=r=>i(r).sum();function vo(){let{data:r}=this,t=new c(this),o=0;for(let a of t)o+=r[a];return o}var Mo=(r,t,o)=>i(r).swap(t,o);function Eo(r,t){this.check(r,0),this.check(t,0);let{data:o}=this,[,a]=this.shape,n=o.slice(r*a,(r+1)*a);return o.copyWithin(r*a,t*a,(t+1)*a),o.set(n,t*a),this}var{tan:Ea}=Math,qo=r=>i(r).tan();function jo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ea(r[o]);return this}var{tanh:qa}=Math,_o=r=>i(r).tanh();function zo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=qa(r[o]);return this}var Fo=r=>i(r).toArray();function So(r=0,t=0){let{data:o,shape:a,strides:n}=this,{length:e}=a;if(t>=e)return o[r];let s=a[t],m=n[t],p=[];for(let y=0;yi(r).toString();function O(){return`array(${(0,Uo.inspect)(this.toArray(),{depth:10,breakLength:40})}, dtype=${this.dtype})`}var $o=r=>i(r).trace();function Co(){let[r,t]=this.shape,{data:o}=this,a=Math.min(r,t),n=0,e;for(e=0;ei(r).transpose();function Ro(){if(this.shape.length<2)return this;let r=this.shape[0];return this.shape[0]=this.shape[1],this.shape[1]=r,r=this.strides[0],this.strides[0]=this.strides[1],this.strides[1]=r,this}var{trunc:ja}=Math,Yo=r=>i(r).trunc();function Bo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ja(r[o]);return this}var Go=r=>{if(r<0)throw new Error("invalid n");let t=new Float64Array(r*r),o=new A(t,{shape:[r,r]}),a=new c(o),[n,e]=a.coords;for(let s of a){let m=r-n-1,p=r-e-1;t[s]=(e+m*2+1)%r*r+(p+m*2+1)%r+1,[n,e]=a.coords}return o};var Po=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(1);var Wo=(...r)=>new A(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).map(()=>Math.random());var Xo=(...r)=>{let t=Float32Array,o=!1,a,n,e;switch(r.length){case 2:e=r.pop(),n=1,a=r.pop();break;case 3:e=r.pop(),n=r.pop(),a=r.pop();break;default:throw new Error("invalid range")}if(e-a<0){let y=e;e=a,a=y,o=!0}if(n>e-a)throw new Error("invalid range");let s=new t(Math.ceil((e-a)/n)),m=a,p=0;if(o)for(;mE(r,"__esModule",{value:!0});var ra=(r,t)=>{for(var o in t)E(r,o,{get:t[o],enumerable:!0})},ta=(r,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qo(t))!Ko.call(r,a)&&a!=="default"&&E(r,a,{get:()=>t[a],enumerable:!(o=Zo(t,a))||o.enumerable});return r},oa=r=>ta(V(E(r!=null?Ho(Jo(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);V(exports);ra(exports,{NDArray:()=>d,NDIter:()=>c,NDMultiIter:()=>b,V_MAXDIMS:()=>x,abs:()=>Y,acos:()=>G,acosh:()=>W,add:()=>tr,angle:()=>ar,array:()=>i,asin:()=>nr,asinh:()=>sr,atan:()=>pr,atanh:()=>yr,augment:()=>j,binOp:()=>hr,cbrt:()=>dr,ceil:()=>br,check:()=>Nr,combine:()=>gr,copy:()=>kr,cos:()=>Ir,cosh:()=>vr,cross:()=>Er,det:()=>jr,diagonal:()=>zr,dot:()=>Sr,eig:()=>Or,equals:()=>Cr,equidimensional:()=>Rr,equilateral:()=>Br,exp:()=>Pr,expm1:()=>Xr,eye:()=>k,fill:()=>Jr,floor:()=>Qr,forEach:()=>rt,fround:()=>ot,gauss:()=>it,get:()=>mt,inv:()=>ct,log:()=>ft,log10:()=>ht,log1p:()=>dt,log2:()=>bt,lu:()=>Nt,lu_factor:()=>gt,magic:()=>Go,map:()=>kt,matrix:()=>z,max:()=>It,mean:()=>vt,min:()=>Et,multiply:()=>jt,norm:()=>zt,normalize:()=>St,ones:()=>Po,pow:()=>Ot,prod:()=>Ct,product:()=>Rt,project:()=>Bt,push:()=>Pt,random:()=>Wo,range:()=>Xo,rank:()=>Xt,reciprocal:()=>Jt,reduce:()=>Qt,reshape:()=>ro,round:()=>oo,row_add:()=>eo,scale:()=>io,set:()=>mo,sign:()=>co,sin:()=>fo,sinh:()=>ho,slice:()=>Ao,solve:()=>Do,sqrt:()=>xo,square:()=>wo,subtract:()=>Lo,sum:()=>To,swap:()=>Mo,tan:()=>qo,tanh:()=>_o,toArray:()=>Fo,toString:()=>Oo,trace:()=>$o,transpose:()=>Vo,trunc:()=>Yo,zeros:()=>D});var F=r=>r.reduce((t,o)=>t.concat(Array.isArray(o)?F(o):o),[]),S=r=>ArrayBuffer.isView(r)&&!(r instanceof DataView),q=r=>r.reduce((t,o)=>t*o,1),U=r=>Array.isArray(r)||S(r)?[r.length].concat(U(r[0])):[],w=r=>[...r.slice(1).map((t,o)=>r.slice(o+1).reduce((a,n)=>a*n,1)),1],R=r=>{let{constructor:{name:t="Float32Array"}={}}=r||{};switch(t){case"Int8Array":return"int8";case"Uint8Array":return"uint8";case"Int16Array":return"int16";case"Uint16Array":return"uint16";case"Int32Array":return"int32";case"Uint32Array":return"uint32";case"Uint8ClampedArray":return"uint8c";case"Float32Array":return"float32";case"Float64Array":return"float64";default:return"float64"}},N=r=>{switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"uint8c":return Uint8ClampedArray;case"float32":return Float32Array;case"float64":return Float64Array;default:return Float64Array}};var i=(...r)=>new d(...r);var x=32,c=class{constructor(t){this.x=i(t);let{shape:o,strides:a,length:n}=this.x;this.length=n,this.lengthm1=n-1,this.nd=o.length,this.ndm1=this.nd-1,this.shape=Array(x).fill(0),this.strides=Array(x).fill(0),this.shapem1=Array(x).fill(0),this.coords=Array(x).fill(0),this.backstrides=Array(x).fill(0),this.factors=Array(x).fill(0),this.nd!==0&&(this.factors[this.nd-1]=1),this.contiguous=!0;let e=1,s;for(s=0;s0&&(this.factors[this.ndm1-s]=this.factors[this.nd-s]*o[this.nd-s]);this.index=0,this.pos=0}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next1d(){let{strides:t}=this;this.pos+=t[0],this.coords[0]+=1}nextcontiguous(){this.pos+=1}next2d(){let{strides:t,shapem1:o,backstrides:a}=this;this.coords[1]=0;e-=1){if(this.coords[e]new c(p)),this.numiter=t.length;let o,a;for(o=0,a=0;o=0){if(m=n.x.shape[s],m==1)continue;if(this.shape[o]==1)this.shape[o]=m;else if(this.shape[o]!==m)throw new Error("shape mismatch")}for(m=this.shape.reduce((p,y)=>p*y,1),this.length=m,this.lengthm1=m-1,o=0;o0&&(n.factors[this.nd-e-1]=n.factors[this.nd-e]*this.shape[this.nd-e]);this.index=0,this.pos=Array(this.numiter).fill(0)}done(){return this.index>this.lengthm1}current(){let t=this.done();return{value:t?void 0:this.pos,done:t}}next(){let t=this.current();this.index+=1;let{numiter:o}=this,a,n;for(n=0;ni(r).abs();function B(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=aa(r[o]);return this}var{acos:ea}=Math,G=r=>i(r).acos();function P(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ea(r[o]);return this}var{acosh:na}=Math,W=r=>i(r).acosh();function X(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=na(r[o]);return this}var A;try{A=require("nblas")}catch(r){}var O=A&&A.NoTrans,Ja=A&&A.Trans;function H(r,t,o,a,n,e,s){if(a.length/n!==t||e.length/s!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.daxpy(t,o,a,n,e,s);case"float32":return A.saxpy(t,o,a,n,e,s);default:throw new Error("wrong dtype")}}function J(r,t,o,a,n,e){if(o.length/a!==t||n.length/e!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.ddot(t,o,a,n,e);case"float32":return A.sdot(t,o,a,n,e);default:throw new Error("wrong dtype")}}function K(r,t,o,a){if(o.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.idamax(t,o,a);case"float32":return A.isamax(t,o,a);default:throw new Error("wrong dtype")}}function Q(r,t,o,a,n,e,s,m,p,y,f,u,h,l){let{length:I}=m,{length:v}=y,{length:M}=h;if(t===A.NoTrans&&I!==p*a||t===A.Trans&&I!==p*e)throw new Error("lengths do not match");if(o===A.NoTrans&&v!==f*e||o===A.Trans&&v!==f*n)throw new Error("lengths do not match");if(M!==l*a)throw new Error("lengths do not match");switch(r){case"float64":return A.dgemm(t,o,a,n,e,s,m,p,y,f,u,h,l);case"float32":return A.sgemm(t,o,a,n,e,s,m,p,y,f,u,h,l);default:throw new Error("wrong dtype")}}function Z(r,t,o,a){if(o.length/a!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.dnrm2(t,o,a);case"float32":return A.snrm2(t,o,a);default:throw new Error("wrong dtype")}}function rr(r,t,o,a,n){if(a.length/n!==t)throw new Error("lengths do not match");switch(r){case"float64":return A.dscal(t,o,a,n);case"float32":return A.sscal(t,o,a,n);default:throw new Error("wrong dtype")}}var tr=(r,t,o=1)=>i(r).add(i(t),o);function or(r,t=1){let{data:o,length:a,dtype:n}=this,{data:e}=i(r);try{H(n,a,t,e,1,o,1)}catch(s){let m=new b(this,r);for(let[p,y]of m)o[p]+=t*e[y]}return this}var{acos:ia}=Math,ar=(r,t)=>i(r).angle(i(t));function er(r){return ia(this.dot(i(r))/this.norm()/i(r).norm())}var{asin:sa}=Math,nr=r=>i(r).asin();function ir(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=sa(r[o]);return this}var{asinh:ma}=Math,sr=r=>i(r).asinh();function mr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ma(r[o]);return this}var{atan:pa}=Math,pr=r=>i(r).atan();function cr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=pa(r[o]);return this}var{atanh:ca}=Math,yr=r=>i(r).atanh();function fr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ca(r[o]);return this}var D=(...r)=>new d(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(0);var j=(r,t)=>i(r).augment(i(t));function ur(r){let[t,o]=this.shape,[a,n]=i(r).shape,{data:e}=this,{data:s}=i(r);if(a===0||n===0)return this;if(t!==a)throw new Error("rows do not match");let m=D(t,o+n),{data:p}=m,y,f;for(y=0;yi(r).binOp(i(t),o);function lr(r,t){let{data:o}=this,{data:a}=i(r),n=new b(this,r);for(let[e,s]of n)o[e]=t(o[e],a[s],e);return this}var{cbrt:ya}=Math,dr=r=>i(r).cbrt();function Ar(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ya(r[o]);return this}var{ceil:fa}=Math,br=r=>i(r).ceil();function Dr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=fa(r[o]);return this}var Nr=(r,...t)=>{i(r).check(...t)};function xr(...r){let{shape:t,length:o}=this;if(r.length===1){let[a]=r;if(a<0||a>o-1||!Number.isFinite(a))throw new Error("index out of bounds")}else if(!t.every((a,n)=>a>r[n]&&Number.isFinite(r[n])&&r[n]>=0))throw new Error("index out of bounds")}var gr=(r,t)=>i(r).combine(i(t));function wr(r){if(this.shape.length!==1&&r.shape.length!==1)throw new Error("combine operation not permitted for multidimensional arrays");let{length:t,data:o}=this,{length:a,data:n}=r;if(a===0)return this;if(t===0)return this.data=new(N(r.dtype))(n),this.length=a,this.dtype=r.dtype,this;let e=t+a,s=new(N(this.dtype))(e);return s.set(o),s.set(n,t),this.data=s,this.length=e,this.shape=[e],this}var kr=r=>i(r).copy();function Lr(){let r=D(...this.shape),{data:t}=this,{data:o}=r,a=new b(this,r);for(let[n,e]of a)o[e]=t[n];return r}var{cos:ua}=Math,Ir=r=>i(r).cos();function Tr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ua(r[o]);return this}var{cosh:ha}=Math,vr=r=>i(r).cosh();function Mr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ha(r[o]);return this}var Er=(r,t)=>i(r).cross(i(t));function qr(r){let{length:t}=this,{length:o}=r;if(t!==3||o!==3)throw new Error("vectors must have three components");let a=this.y*r.z-this.z*r.y,n=this.z*r.x-this.x*r.z,e=this.x*r.y-this.y*r.x;return this.x=a,this.y=n,this.z=e,this}var jr=r=>i(r).det();function _r(){this.square();let[r]=this.shape,[t,o]=this.copy().lu_factor(),{data:a}=t,n=1,e=1,s;for(s=0;si(r).diagonal();function Fr(){this.square();let{length:r}=this,[t,o]=this.shape,a=Math.min(t,o);return this.reshape(r).slice(0,r,a+1)}var Sr=(r,t)=>i(r).dot(i(t));function Ur(r){let{data:t,length:o,dtype:a}=this,{data:n}=r,e=0;try{e=J(a,o,n,1,t,1)}catch(s){let m=new b(this,r);for(let[p,y]of m)e+=t[p]*n[y]}return e}var k=r=>{let t=new d(new Float64Array(r*r),{shape:[r,r]}),{data:o}=t,a;for(a=0;a{let[m]=r.shape,{data:p}=r,y=p[a*m+n],f=1/(t+o);p[a*m+n]=y-o*(p[e*m+s]+f*y),p[e*m+s]+=o*(y-f*p[e*m+s])},Or=r=>i(r).eig();function $r(){this.square();let[r]=this.shape;try{["float32","float64"].includes(this.dtype)||(this.dtype="float32",this.data=N(this.dtype).from(this.data));let t=T.NoEigenvector,o=T.Eigenvector,a=D(r),n=D(r),e=D(r,r),s=D(r,r),{data:m}=this,{data:p}=a,{data:y}=n,{data:f}=e,{data:u}=s;return this.dtype==="float64"&&T.dgeev(t,o,r,m,r,p,y,f,r,u,r),this.dtype==="float32"&&T.sgeev(t,o,r,m,r,p,y,f,r,u,r),[a,s]}catch(t){let{data:o}=this,a=k(r),n=0,e=0,s=0,m=0,p=0;do{for(e=0;e=n&&(n=Math.abs(o[e*r+s]),m=e,p=s);let y;if(Math.abs(o[m*r+p])=1e-9);return[this.diagonal(),a]}}var Cr=(r,t,o=1e-6)=>i(r).equals(i(t),o);function Vr(r,t=1e-6){let{data:o}=this,{data:a}=r,n=new b(this,r);for(let[e,s]of n)if(Math.abs(o[e]-a[s])>t)return!1;return!0}var Rr=(r,t)=>{i(r).equidimensional(i(t))};function Yr(r){let{shape:t}=this,{shape:o}=r;if(!t.every((a,n)=>a===o[n]))throw new Error(`shapes ${t} and ${o} do not match`)}var Br=(r,t)=>{i(r).equilateral(i(t))};function Gr(r){let{length:t}=this,{length:o}=r;if(t!==o)throw new Error(`lengths ${t} and ${o} do not match`)}var{exp:la}=Math,Pr=r=>i(r).exp();function Wr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=la(r[o]);return this}var{expm1:da}=Math,Xr=r=>i(r).expm1();function Hr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=da(r[o]);return this}var Jr=(r,t=0)=>i(r).fill(t);function Kr(r=0){let{data:t}=this,o=new c(this);for(let a of o)t[a]=r instanceof Function?r(o.pos):r;return this}var{floor:Aa}=Math,Qr=r=>i(r).floor();function Zr(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Aa(r[o]);return this}var rt=(r,t)=>{r.forEach(t)};function tt(r){let{data:t}=this,o=new c(this);for(let a of o)r.call(this,t[a],a,t)}var{fround:ba}=Math,ot=r=>i(r).fround();function at(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ba(r[o]);return this}var g;try{g=require("nlapack")}catch(r){}function L(r,t,o,a,n,e){if(a.length!==t*o)throw new Error("lengths do not match");switch(r){case"float64":return g.dgetrf(t,o,a,n,e);case"float32":return g.sgetrf(t,o,a,n,e);default:throw new Error("wrong dtype")}}function et(r,t,o,a,n){if(o.length!==t*t)throw new Error("lengths do not match");switch(r){case"float64":return g.dgetri(t,o,a,n);case"float32":return g.sgetri(t,o,a,n);default:throw new Error("wrong dtype")}}function nt(r,t,o,a,n,e,s,m){if(a.length!==n*t||s.length!==m*o)throw new Error("lengths do not match");switch(r){case"float64":return g.dgesv(t,o,a,n,e,s,m);case"float32":return g.sgesv(t,o,a,n,e,s,m);default:throw new Error("wrong dtype")}}var it=r=>i(r).gauss();function st(){let{shape:[r,t],data:o,dtype:a}=this;try{let{data:n}=this,e=new Int32Array(Math.min(r,t));L(a,r,t,n,t,e);let s=new c(this),[m,p]=s.coords;for(let y of s)pi(r).get(...t);function pt(...r){this.check(...r);let{data:t,shape:o}=this,{length:a}=o,n=r[a-1],e,s;for(e=0;ei(r).inv();function yt(){this.square();let{shape:[r],dtype:t}=this;try{let{data:o}=this,a=new Int32Array(r);return L(t,r,r,o,r,a),et(t,r,o,r,a),this}catch(o){let a=k(r),n=j(this,a).gauss(),e=D(r,r),s=D(r,r),{data:m}=n,{data:p}=e,{data:y}=s,f=new c(n),[u,h]=f.coords;for(let l of f)hi(r).log();function ut(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Da(r[o]);return this}var{log10:Na}=Math,ht=r=>i(r).log10();function lt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Na(r[o]);return this}var{log1p:xa}=Math,dt=r=>i(r).log1p();function At(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=xa(r[o]);return this}var{log2:ga}=Math,bt=r=>i(r).log2();function Dt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ga(r[o]);return this}var Nt=r=>i(r).lu();function xt(){let[r,t]=this.copy().lu_factor(),o=r.copy(),a=r.copy(),{data:n}=o,{data:e}=a,s=new c(r),[m,p]=s.coords;for(let y of s)pi(r).lu_factor();function wt(){let{data:r,shape:[t],dtype:o}=this,a=new Int32Array(t);try{L(o,t,t,r,t,a)}catch(n){let e,s,m,p,y,f,u;for(u=0;ui(r).map(t);function Lt(r){let{data:t}=this,o=new c(this),a=r.bind(this),n=this.copy(),{data:e}=n;for(let s of o)e[s]=a(t[s],s,t);return n}var It=r=>i(r).max();function Tt(){let{data:r,length:t,dtype:o}=this,a=Number.NEGATIVE_INFINITY;try{a=r[K(o,t,r,1)]}catch(n){let e=new c(this);for(let s of e){let m=r[s];ai(r).mean();function Mt(){let{data:r,length:t}=this,o=new c(this),a=0;for(let n of o)a+=r[n];return a/t}var Et=r=>i(r).min();function qt(){let{data:r}=this,t=new c(this),o=Number.POSITIVE_INFINITY;for(let a of t){let n=r[a];o>n&&(o=n)}return o}var z=(r,t)=>new d(new Float64Array(r*t),{shape:[r,t]});var jt=(r,t)=>i(r).multiply(i(t));function _t(r){let{shape:[t,o],data:a,dtype:n}=this,{shape:[e,s],data:m}=r;if(o!==e)throw new Error("sizes do not match");let p=z(t,s),{data:y}=p;try{Q(n,O,O,t,s,o,1,a,o,m,s,0,y,s)}catch(f){let u=new c(p),h,[l,I]=u.coords;for(let v of u){let M=0;for(h=0;hi(r).norm();function Ft(){let{data:r,length:t,dtype:o}=this,a=0;try{a=Z(o,t,r,1)}catch(n){a=wa(this.dot(this))}return a}var St=r=>i(r).normalize();function Ut(){return this.scale(1/this.norm())}var{pow:ka}=Math,Ot=(r,t)=>i(r).pow(t);function $t(r){let{data:t}=this,o=new c(this);for(let a of o)t[a]=ka(t[a],r);return this}var Ct=r=>i(r).prod();function Vt(){let{data:r}=this,t=new c(this),o=1;for(let a of t)o*=r[a];return o}var Rt=(r,t)=>i(r).product(i(t));function Yt(r){let{data:t}=this,{data:o}=r,a=new b(this,r);for(let[n,e]of a)t[n]*=o[e];return this}var Bt=(r,t)=>i(r).project(i(t));function Gt(r){return r.scale(this.dot(r)/r.dot(r))}var Pt=(r,t)=>i(r).push(t);function Wt(r){if(this.shape.length!==1)throw new Error("push operation not permitted for multidimensional arrays");let{data:t,length:o}=this,a=o+1,n=new(N(this.dtype))(a);return n.set(t),n[o]=r,this.data=n,this.length=a,this.shape=[a],this}var Xt=(r,t=1e-6)=>i(r).rank(t);function Ht(r=1e-6){let{data:t}=this.copy().gauss(),o=new c(this),a=0,[n,e]=o.coords;for(let s of o)a<=n&&e>=n&&t[s]>r&&(a+=1),[n,e]=o.coords;return a}var Jt=r=>i(r).reciprocal();function Kt(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=1/r[o];return this}var Qt=(r,t,o)=>i(r).reduce(t,o);function Zt(r,t){let{data:o,length:a}=this;if(a===0&&typeof t=="undefined")throw new Error("Reduce of empty array with no initial value.");let n=new c(this),e=r.bind(this),s;typeof t=="undefined"?(s=o[0],n.next()):s=t;for(let m of n)s=e(s,o[m],m,o);return s}var ro=(r,...t)=>i(r).reshape(...t);function to(...r){let{length:t}=this;if(r.reduce((o,a)=>o*a,1)!==t)throw new Error(`shape ${r} does not match length ${t}`);return this.shape=r,this.strides=w(r),this}var{round:La}=Math,oo=r=>i(r).round();function ao(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=La(r[o]);return this}var eo=(r,t,o,a=1)=>i(r).row_add(t,o,a);function no(r,t,o=1){this.check(r,0),this.check(t,0);let[,a]=this.shape,{data:n}=this,e;for(e=0;ei(r).scale(t);function so(r){let{data:t,length:o,dtype:a}=this;try{rr(a,o,r,t,1)}catch(n){let e=new c(this);for(let s of e)t[s]*=r}return this}var mo=(r,...t)=>{r.set(...t)};function po(...r){let t=r.slice(0,-1),o=r[r.length-1];this.check(...t);let{shape:a}=this,n=t[t.length-1],e;for(e=0;ei(r).sign();function yo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ia(r[o]);return this}var{sin:Ta}=Math,fo=r=>i(r).sin();function uo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ta(r[o]);return this}var{sinh:va}=Math,ho=r=>i(r).sinh();function lo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=va(r[o]);return this}var Ao=(r,t,o,a)=>i(r).slice(t,o,a);function bo(r=0,t=this.shape[0],o=1){let{data:a,shape:n}=this,e=n.length;if(r<0||t<0)return this.slice(r<0?n[n.length-1]+r:r,t<0?n[n.length-1]+t:t);if(r>t)return this.slice(t,r,o);if(o<=0)throw new Error("step argument has to be a positive integer");let s=[Math.ceil((t-r)/Math.abs(o)),...n.slice(1)],m=q(s),p=w(s),y=e>1?a.subarray(r*s[s.length-1],t*s[s.length-1]):a.subarray(r,t);return p[0]*=o,new d(y,{shape:s,length:m,strides:p})}var Do=(r,t)=>i(r).solve(i(t));function No(r){let{data:t,dtype:o}=this,{data:a,shape:[n,e]}=r;try{let s=new Int32Array(n);nt(o,n,e,t,n,s,a,e)}catch(s){let[m,p]=this.lu_factor(),{data:y}=m,{data:f}=r,u,h,l;for(u=0;u=0;u-=1){for(h=u+1;hi(r).sqrt();function go(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ma(r[o]);return this}var wo=r=>{i(r).square()};function ko(){let{length:r}=this.shape,[t,o]=this.shape;if(r!==2||t!==o)throw new Error("matrix is not square")}var Lo=(r,t)=>i(r).subtract(i(t));function Io(r){return this.add(r,-1)}var To=r=>i(r).sum();function vo(){let{data:r}=this,t=new c(this),o=0;for(let a of t)o+=r[a];return o}var Mo=(r,t,o)=>i(r).swap(t,o);function Eo(r,t){this.check(r,0),this.check(t,0);let{data:o}=this,[,a]=this.shape,n=o.slice(r*a,(r+1)*a);return o.copyWithin(r*a,t*a,(t+1)*a),o.set(n,t*a),this}var{tan:Ea}=Math,qo=r=>i(r).tan();function jo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=Ea(r[o]);return this}var{tanh:qa}=Math,_o=r=>i(r).tanh();function zo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=qa(r[o]);return this}var Fo=r=>i(r).toArray();function So(r=0,t=0){let{data:o,shape:a,strides:n}=this,{length:e}=a;if(t>=e)return o[r];let s=a[t],m=n[t],p=[];for(let y=0;yi(r).toString();function $(){return`array(${(0,Uo.inspect)(this.toArray(),{depth:10,breakLength:40})}, dtype=${this.dtype})`}var $o=r=>i(r).trace();function Co(){let[r,t]=this.shape,{data:o}=this,a=Math.min(r,t),n=0,e;for(e=0;ei(r).transpose();function Ro(){if(this.shape.length<2)return this;let r=this.shape[0];return this.shape[0]=this.shape[1],this.shape[1]=r,r=this.strides[0],this.strides[0]=this.strides[1],this.strides[1]=r,this}var{trunc:ja}=Math,Yo=r=>i(r).trunc();function Bo(){let{data:r}=this,t=new c(this);for(let o of t)r[o]=ja(r[o]);return this}var Go=r=>{if(r<0)throw new Error("invalid n");let t=new Float64Array(r*r),o=new d(t,{shape:[r,r]}),a=new c(o),[n,e]=a.coords;for(let s of a){let m=r-n-1,p=r-e-1;t[s]=(e+m*2+1)%r*r+(p+m*2+1)%r+1,[n,e]=a.coords}return o};var Po=(...r)=>new d(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).fill(1);var Wo=(...r)=>new d(new Float64Array(r.reduce((t,o)=>t*o,1)),{shape:r}).map(()=>Math.random());var Xo=(...r)=>{let t=Float32Array,o=!1,a,n,e;switch(r.length){case 2:e=r.pop(),n=1,a=r.pop();break;case 3:e=r.pop(),n=r.pop(),a=r.pop();break;default:throw new Error("invalid range")}if(e-a<0){let y=e;e=a,a=y,o=!0}if(n>e-a)throw new Error("invalid range");let s=new t(Math.ceil((e-a)/n)),m=a,p=0;if(o)for(;m number[] = (array: any[]): number[] =>\n array.reduce(\n (acc: any[], next: any): any[] => acc.concat(Array.isArray(next) ? flatten(next) : next),\n []\n );\n\nexport const is_typed_array: (array: any) => boolean = (array: any): boolean =>\n ArrayBuffer.isView(array) && !(array instanceof DataView);\n\nexport const get_length: (shape: number[]) => number = (shape: number[]): number =>\n shape.reduce((a: number, b: number): number => a * b, 1);\n\nexport const get_shape: (array: any) => number[] = (array: any): number[] => Array.isArray(array) || is_typed_array(array)\n ? [array.length].concat(get_shape(array[0]))\n : [];\n\nexport const get_strides: (shape: number[]) => number[] = (shape: number[]): number[] =>\n [\n ...shape\n .slice(1)\n .map((_: number, i: number): number => shape\n .slice(i + 1)\n .reduce((a: number, b: number): number => a * b, 1)\n ),\n 1,\n];\n\nexport const get_dtype: (array: TypedArray) => DType = (array: TypedArray): DType => {\n const {\n constructor: {\n name = 'Float32Array',\n } = {},\n } = array || {};\n\n switch (name) {\n case 'Int8Array': return 'int8';\n case 'Uint8Array': return 'uint8';\n case 'Int16Array': return 'int16';\n case 'Uint16Array': return 'uint16';\n case 'Int32Array': return 'int32';\n case 'Uint32Array': return 'uint32';\n case 'Uint8ClampedArray': return 'uint8c';\n case 'Float32Array': return 'float32';\n case 'Float64Array': return 'float64';\n default: return 'float64';\n }\n};\n\nexport const get_type: (dtype: DType) => TypedArrayConstructor = (dtype: DType): TypedArrayConstructor => {\n switch (dtype) {\n case 'int8': return Int8Array;\n case 'uint8': return Uint8Array;\n case 'int16': return Int16Array;\n case 'uint16': return Uint16Array;\n case 'int32': return Int32Array;\n case 'uint32': return Uint32Array;\n case 'uint8c': return Uint8ClampedArray;\n case 'float32': return Float32Array;\n case 'float64': return Float64Array;\n default: return Float64Array;\n }\n};", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function array\n * @description `array(...args)` is an alias for `new v(...args)`\n * @param {} ...args\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const array = (...args: any[]): NDArray => new NDArray(...args);\n", "import { NDArray } from '../';\nimport { array } from '../core/array';\n\nexport const V_MAXDIMS = 32;\n\n/**\n * @class NDIter\n * @description Constructs an NDIter instance.\n * @param {NDArray} x\n */\nexport class NDIter implements Iterator {\n /**\n * @name x\n * @memberof NDIter.prototype\n * @type NDArray\n */\n public x: NDArray;\n\n /**\n * @name shape\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name shapem1\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shapem1: number[];\n\n /**\n * @name strides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public strides: number[];\n\n /**\n * @name backstrides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public backstrides: number[];\n\n /**\n * @name length\n * @memberof NDIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name nd\n * @memberof NDIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name ndm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public ndm1: number;\n\n /**\n * @name index\n * @memberof NDIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name coords\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public coords: number[];\n\n /**\n * @name pos\n * @memberof NDIter.prototype\n * @type Number\n */\n public pos: number;\n\n /**\n * @name factors\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public factors: number[];\n\n /**\n * @name contiguous\n * @memberof NDIter.prototype\n * @type Boolean\n */\n public contiguous: boolean;\n\n constructor(x: NDArray | ArrayLike) {\n this.x = array(x);\n const {\n shape,\n strides,\n length,\n } = this.x;\n\n this.length = length;\n this.lengthm1 = length - 1;\n this.nd = shape.length;\n this.ndm1 = this.nd - 1;\n\n this.shape = Array(V_MAXDIMS).fill(0);\n this.strides = Array(V_MAXDIMS).fill(0);\n this.shapem1 = Array(V_MAXDIMS).fill(0);\n this.coords = Array(V_MAXDIMS).fill(0);\n this.backstrides = Array(V_MAXDIMS).fill(0);\n this.factors = Array(V_MAXDIMS).fill(0);\n\n if (this.nd !== 0) {\n this.factors[this.nd - 1] = 1;\n }\n\n this.contiguous = true;\n\n let stride = 1;\n let i;\n for (i = 0; i < this.nd; i += 1) {\n this.shape[i] = shape[i];\n this.shapem1[i] = shape[i] - 1;\n this.strides[i] = strides[i];\n this.backstrides[i] = strides[i] * this.shapem1[i];\n this.coords[i] = 0;\n\n // Check if C-contiguous\n if (shape[this.ndm1 - i] !== 1) {\n if (strides[i] !== stride) {\n this.contiguous = false;\n }\n\n stride *= shape[this.ndm1 - i];\n }\n\n if (i > 0) {\n this.factors[this.ndm1 - i] = this.factors[this.nd - i] * shape[this.nd - i];\n }\n }\n\n this.index = 0;\n this.pos = 0;\n }\n\n /**\n * @function done\n * @memberof NDIter.prototype\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDIter.prototype\n * @description Returns the current element of the iterator\n * @returns {Object} current\n * @returns {Number} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.current(); // { value: 1, done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next1d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 1 dimensional.\n */\n next1d() {\n const {\n strides,\n } = this;\n\n this.pos += strides[0];\n this.coords[0] += 1;\n }\n\n /**\n * @function nextcontiguous\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming its data is contiguous.\n */\n nextcontiguous() {\n this.pos += 1;\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 2 dimensional.\n */\n next2d() {\n const {\n strides,\n shapem1,\n backstrides,\n } = this;\n\n if (this.coords[1] < shapem1[1]) {\n this.coords[1] += 1;\n this.pos += strides[1];\n } else {\n this.coords[1] = 0;\n this.coords[0] += 1;\n this.pos += strides[0] - backstrides[1];\n }\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator\n */\n nextnd() {\n const {\n ndm1,\n shapem1,\n strides,\n backstrides,\n } = this;\n\n let i;\n for (i = ndm1; i >= 0; i -= 1) {\n if (this.coords[i] < shapem1[i]) {\n this.coords[i] += 1;\n this.pos += strides[i];\n break;\n }\n\n this.coords[i] = 0;\n this.pos -= backstrides[i];\n }\n }\n\n /**\n * @function next\n * @memberof NDIter.prototype\n * @description\n * Steps to the next position in the iterator.\n * Returns the current index of the iterator, or undefined if done.\n * @returns {Object}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.next(); // { value: 2, done: false }\n * iter.next(); // { value: 3, done: false }\n * iter.next(); // { done: true }\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n ndm1,\n contiguous,\n } = this;\n\n if (ndm1 === 0) {\n this.next1d();\n } else if (contiguous) {\n this.nextcontiguous();\n } else if (ndm1 === 1) {\n this.next2d();\n } else {\n this.nextnd();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n\n/**\n * @class NDMultiIter\n * @description Constructs an NDMultiIter instance.\n * @param {NDArray[]} ...args\n */\nexport class NDMultiIter implements Iterator {\n /**\n * @name iters\n * @memberof NDMultiIter.prototype\n * @type NDIter[]\n */\n public iters: NDIter[];\n\n /**\n * @name shape\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name nd\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name length\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name numiter\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public numiter: number;\n\n /**\n * @name index\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name pos\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public pos: number[];\n\n constructor(...args: (NDArray | ArrayLike)[]) {\n this.iters = args.map(arg => new NDIter(arg));\n this.numiter = args.length;\n\n let i;\n let nd;\n for (i = 0, nd = 0; i < this.numiter; i += 1) {\n nd = Math.max(nd, this.iters[i].x.shape.length);\n }\n\n this.nd = nd;\n this.shape = Array(nd).fill(0);\n\n let it;\n let j;\n let k;\n let tmp;\n for (i = 0; i < nd; i += 1) {\n this.shape[i] = 1;\n for (j = 0; j < this.numiter; j += 1) {\n it = this.iters[j];\n k = i + it.x.shape.length - nd;\n if (k >= 0) {\n tmp = it.x.shape[k];\n if (tmp == 1) {\n continue;\n }\n if (this.shape[i] == 1) {\n this.shape[i] = tmp;\n\n } else if (this.shape[i] !== tmp) {\n throw new Error('shape mismatch');\n }\n }\n }\n }\n\n tmp = this.shape.reduce((acc, dim) => acc * dim, 1);\n\n this.length = tmp;\n this.lengthm1 = tmp - 1;\n\n for (i = 0; i < this.numiter; i += 1) {\n it = this.iters[i];\n it.nd = this.nd;\n it.ndm1 = this.nd - 1;\n it.length = tmp;\n it.lengthm1 = tmp - 1;\n\n nd = it.x.shape.length;\n if (nd !== 0) {\n it.factors[this.nd - 1] = 1;\n }\n\n for (j = 0; j < this.nd; j += 1) {\n it.shape[j] = this.shape[j];\n it.shapem1[j] = this.shape[j] - 1;\n k = j + nd - this.nd;\n\n if ((k < 0) || it.x.shape[k] !== this.shape[j]) {\n it.contiguous = false;\n it.strides[j] = 0;\n } else {\n it.strides[j] = it.x.strides[k];\n }\n\n it.backstrides[j] = it.strides[j] * it.shapem1[j];\n\n if (j > 0) {\n it.factors[this.nd - j - 1] = it.factors[this.nd - j] * this.shape[this.nd - j]\n }\n }\n }\n\n this.index = 0;\n this.pos = Array(this.numiter).fill(0);\n }\n\n /**\n * @function done\n * @memberof NDMultiIter\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDMultiIter\n * @description Returns the current indices of the iterators\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.current(); // { value: [0, 0], done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next\n * @memberof NDMultiIter\n * @description\n * Steps to the next position in the iterator.\n * Returns the current indices of the iterators, or undefined if done.\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.next(); // { value: [0, 0], done: false }\n * iter.next(); // { value: [1, 1], done: false }\n * iter.next(); // { value: [2, 2], done: false },\n * iter.next(); // { value: undefined, done: true },\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n numiter,\n } = this;\n\n let it;\n let i;\n for (i = 0; i < numiter; i += 1) {\n it = this.iters[i];\n this.pos[i] = it.pos;\n it.next();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { abs: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function abs\n * @description Returns the absolute value of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { abs } from 'vectorious/core/abs';\n * \n * abs([-1, -2, -3]) // => array([1, 2, 3])\n */\nexport const abs = (x: NDArray | ArrayLike): NDArray => array(x).abs();\n\n/**\n * @function abs\n * @memberof NDArray.prototype\n * @description Returns the absolute value of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, -2, -3]).abs() // <=> array([1, 2, 3])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acos\n * @description Returns the arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acos } from 'vectorious/core/acos';\n * \n * acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport const acos = (x: NDArray | ArrayLike): NDArray => array(x).acos();\n\n/**\n * @function acos\n * @memberof NDArray.prototype\n * @description Returns the arccosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acosh\n * @description Returns the hyperbolic arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acosh } from 'vectorious/core/acosh';\n * \n * acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport const acosh = (x: NDArray | ArrayLike): NDArray => array(x).acosh();\n\n/**\n * @function acosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arccosine of each element of current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nblas: any;\ntry {\n nblas = require('nblas');\n} catch (err) {}\n\nexport const NoTrans = nblas && nblas.NoTrans;\nexport const Trans = nblas && nblas.Trans;\n\nexport function axpy(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.daxpy(n, alpha, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.saxpy(n, alpha, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function dot(dtype: DType, n: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.ddot(n, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.sdot(n, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function iamax(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.idamax(n, x, inc_x);\n case 'float32':\n return nblas.isamax(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gemm(dtype: DType, transx: number, transy: number, m: number, n: number, k: number, alpha: number, x: TypedArray, ldx: number, y: TypedArray, ldy: number, beta: number, z: TypedArray, ldz: number) {\n const { length: l1 } = x;\n const { length: l2 } = y;\n const { length: l3 } = z;\n\n if ((transx === nblas.NoTrans && l1 !== ldx * m) || (transx === nblas.Trans && l1 !== ldx * k)) {\n throw new Error('lengths do not match');\n }\n\n if ((transy === nblas.NoTrans && l2 !== ldy * k) || (transy === nblas.Trans && l2 !== ldy * n)) {\n throw new Error('lengths do not match');\n }\n\n if (l3 !== ldz * m) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n case 'float32':\n return nblas.sgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function nrm2(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dnrm2(n, x, inc_x);\n case 'float32':\n return nblas.snrm2(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function scal(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dscal(n, alpha, x, inc_x);\n case 'float32':\n return nblas.sscal(n, alpha, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function add\n * @description\n * Adds `y` multiplied by `alpha` to `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { add } from 'vectorious/core/add';\n * \n * add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])\n */\nexport const add = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, alpha: number = 1): NDArray =>\n array(x).add(array(y), alpha);\n\n/**\n * @function add\n * @memberof NDArray.prototype\n * @description\n * Adds `x` multiplied by `alpha` to the current array.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])\n */\nexport default function (this: NDArray, x: NDArray | ArrayLike, alpha: number = 1): NDArray {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = array(x);\n\n try {\n blas.axpy(dtype, l1, alpha, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n d1[i] += alpha * d2[j];\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function angle\n * @description Determines the angle between the `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {number}\n * @example\n * import { angle } from 'vectorious/core/angle';\n * \n * angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287\n */\nexport const angle = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).angle(array(y));\n\n/**\n * @function angle\n * @memberof NDArray.prototype\n * @description Determines the angle between the current vector and `x`.\n * @param {NDArray} x\n * @returns {number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): number {\n return f(this.dot(array(x)) / this.norm() / array(x).norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asin\n * @description Returns the arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asin } from 'vectorious/core/asin';\n * \n * asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport const asin = (x: NDArray | ArrayLike): NDArray => array(x).asin();\n\n/**\n * @function asin\n * @memberof NDArray.prototype\n * @description Returns the arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asinh\n * @description Returns the hyperbolic arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asinh } from 'vectorious/core/asinh';\n * \n * asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport const asinh = (x: NDArray | ArrayLike): NDArray => array(x).asinh();\n\n/**\n * @function asinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atan\n * @description Returns the arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atan } from 'vectorious/core/atan';\n * \n * atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport const atan = (x: NDArray | ArrayLike): NDArray => array(x).atan();\n\n/**\n * @function atan\n * @memberof NDArray.prototype\n * @description Returns the arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atanh\n * @description Returns the hyperbolic arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atanh } from 'vectorious/core/atanh';\n * \n * atanh([0, -0.5]); // => array([0, -0.5493061542510986])\n */\nexport const atanh = (x: NDArray | ArrayLike): NDArray => array(x).atanh();\n\n/**\n * @function atanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function zeros\n * @description Creates an array containing zeros (`0`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { zeros } from 'vectorious/core/zeros';\n * \n * zeros(3); // => array([0, 0, 0])\n */\nexport const zeros = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(0);\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\n\n/**\n * @static\n * @memberof module:Globals\n * @function augment\n * @description Augments `x` and `y`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { augment } from 'vectorious/core/augment';\n * \n * augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])\n */\nexport const augment = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).augment(array(y));\n\n/**\n * @function augment\n * @memberof NDArray.prototype\n * @description Augments `x` with current matrix.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): NDArray {\n const [r1, c1] = this.shape;\n const [r2, c2] = array(x).shape;\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n if (r2 === 0 || c2 === 0) {\n return this;\n }\n\n if (r1 !== r2) {\n throw new Error('rows do not match');\n }\n\n const y = zeros(r1, c1 + c2);\n const { data: d3 } = y;\n\n let i: number;\n let j: number;\n for (i = 0; i < r1; i += 1) {\n for (j = 0; j < c1; j += 1) {\n d3[i * (c1 + c2) + j] = d1[i * c1 + j];\n }\n }\n\n for (i = 0; i < r2; i += 1) {\n for (j = 0; j < c2; j += 1) {\n d3[i * (c1 + c2) + (j + c1)] = d2[i * c2 + j];\n }\n }\n\n return y;\n};\n", "\nimport { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function binOp\n * @description Perform binary operation `f` on `y` in `x`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { binOp } from 'vectorious/core/binOp';\n * \n * binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport const binOp = (\n x: NDArray | ArrayLike,\n y: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray => array(x).binOp(array(y), f);\n\n/**\n * @function binOp\n * @memberof NDArray.prototype\n * @description Perform binary operation `f` on `x` in the current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport default function(\n this: NDArray,\n x: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i] = f(d1[i], d2[j], i);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cbrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cbrt\n * @description Returns the cube root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport const cbrt = (x: NDArray | ArrayLike): NDArray => array(x).cbrt();\n\n/**\n * @function cbrt\n * @memberof NDArray.prototype\n * @description Returns the cube root of each element of current array.\n * @returns {this}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { ceil: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function ceil\n * @description Returns smallest integer greater than or equal to of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { ceil } from 'vectorious/core/ceil';\n * \n * ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])\n */\nexport const ceil = (x: NDArray | ArrayLike): NDArray => array(x).ceil();\n\n/**\n * @function ceil\n * @memberof NDArray.prototype\n * @description Returns smallest integer greater than or equal to of each element of current array.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function check\n * @description Asserts if indices `i, j, ..., n` are within the bounds of `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { check } from 'vectorious/core/check';\n * \n * check([0.5, 1.5, 2.5], 3); // Error: index out of bounds\n */\nexport const check = (x: NDArray | ArrayLike, ...indices: number[]): void => {\n array(x).check(...indices);\n};\n\n/**\n * @function check\n * @memberof NDArray.prototype\n * @description Asserts if indices `i, j, ..., n` are within the bounds of current array\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds\n */\nexport default function(this: NDArray, ...indices: number[]): void {\n const { shape: s1, length: l1 } = this;\n\n if (indices.length === 1) {\n const [i] = indices;\n if (i < 0 || i > l1 - 1 || !Number.isFinite(i)) {\n throw new Error('index out of bounds');\n }\n } else if (!s1.every((dim: number, i: number) =>\n dim > indices[i]\n && Number.isFinite(indices[i])\n && indices[i] >= 0\n )) {\n throw new Error('index out of bounds');\n }\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function combine\n * @description Combines the vector `x` with `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { combine } from 'vectorious/core/combine';\n * \n * combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport const combine = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).combine(array(y));\n\n/**\n * @function combine\n * @memberof NDArray.prototype\n * @description Combines the current vector with `x`\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n if (this.shape.length !== 1 && x.shape.length !== 1) {\n throw new Error('combine operation not permitted for multidimensional arrays');\n }\n\n const { length: l1, data: d1 } = this;\n const { length: l2, data: d2 } = x;\n\n if (l2 === 0) {\n return this;\n }\n\n if (l1 === 0) {\n this.data = new (get_type(x.dtype))(d2);\n this.length = l2;\n this.dtype = x.dtype;\n\n return this;\n }\n\n const l3: number = l1 + l2;\n const d3: TypedArray = new (get_type(this.dtype))(l3);\n\n d3.set(d1);\n d3.set(d2, l1);\n\n this.data = d3;\n this.length = l3;\n this.shape = [l3];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { NDMultiIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function copy\n * @description Makes a copy of `x`\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { copy } from 'vectorious/core/copy';\n * \n * copy([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const copy = (x: NDArray | ArrayLike): NDArray => array(x).copy();\n\n/**\n * @function copy\n * @memberof NDArray.prototype\n * @description Makes a copy of the class and underlying data\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).copy(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const x = zeros(...this.shape);\n\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d2[j] = d1[i];\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cos\n * @description Returns the cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cos } from 'vectorious/core/cos';\n * \n * cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])\n */\nexport const cos = (x: NDArray | ArrayLike): NDArray => array(x).cos();\n\n/**\n * @function cos\n * @memberof NDArray.prototype\n * @description Returns the cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cosh\n * @description Returns the hyperbolic cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cosh } from 'vectorious/core/cosh';\n * \n * cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport const cosh = (x: NDArray | ArrayLike): NDArray => array(x).cosh();\n\n/**\n * @function cosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function cross\n * @description\n * Computes the cross product of the `x` and the vector `y`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { cross } from 'vectorious/core/cross';\n * \n * cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])\n */\nexport const cross = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).cross(array(y));\n\n/**\n * @function cross\n * @memberof NDArray.prototype\n * @description\n * Computes the cross product of the current vector and the vector `x`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== 3 || l2 !== 3) {\n throw new Error('vectors must have three components');\n }\n\n const c1: number = this.y * x.z - this.z * x.y;\n const c2: number = this.z * x.x - this.x * x.z;\n const c3: number = this.x * x.y - this.y * x.x;\n\n this.x = c1;\n this.y = c2;\n this.z = c3;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function det\n * @description Gets the determinant of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { det } from 'vectorious/core/det';\n * \n * det([[0, 1], [2, 3]]); // => -2\n */\nexport const det = (x: NDArray | ArrayLike): number => array(x).det();\n\n/**\n * @function det\n * @memberof NDArray.prototype\n * @description Gets the determinant of current matrix using LU factorization.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[0, 1], [2, 3]]).det(); // => -2\n */\nexport default function(this: NDArray): number {\n this.square();\n\n const [n] = this.shape;\n const [LU, ipiv] = this.copy().lu_factor();\n const { data: d1 } = LU;\n\n let product: number = 1;\n let sign: number = 1;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n product *= d1[i * n + i];\n if (i !== ipiv[i] - 1) {\n sign *= -1;\n }\n }\n\n return sign * product;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function diagonal\n * @description Gets the diagonal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { diagonal } from 'vectorious/core/diagonal';\n * \n * diagonal([[1, 2], [3, 4]]); // => array([1, 4])\n */\nexport const diagonal = (x: NDArray | ArrayLike): NDArray =>\n array(x).diagonal();\n\n/**\n * @function diagonal\n * @memberof NDArray.prototype\n * @description Gets the diagonal of current matrix.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).diagonal(); // => array([1, 4])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { length: l1 } = this;\n const [r, c] = this.shape;\n const l2: number = Math.min(r, c);\n\n return this.reshape(l1).slice(0, l1, l2 + 1);\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function dot\n * @description\n * Performs dot multiplication with `x` and `y`.\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {Number}\n * @example\n * import { dot } from 'vectorious/core/dot';\n * \n * dot([1, 2, 3], [4, 5, 6]); // => 32\n */\nexport const dot = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).dot(array(y));\n\n/**\n * @function dot\n * @memberof NDArray.prototype\n * @description\n * Performs dot multiplication with `x` and current array\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).dot([4, 5, 6]); // => 32\n */\nexport default function(this: NDArray, x: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = x;\n\n let result: number = 0;\n try {\n result = blas.dot(dtype, l1, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n result += d1[i] * d2[j];\n }\n }\n\n return result;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function eye\n * @description Creates an identity matrix of size `n` and type `type`.\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { eye } from 'vectorious/core/eye';\n * \n * eye(2); // => array([[1, 0], [0, 1]])\n */\nexport const eye = (n: number): NDArray => {\n const x = new NDArray(new Float64Array(n * n), { shape: [n, n] });\n const { data: d1 } = x;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n d1[i * n + i] = 1;\n }\n\n return x;\n};\n", "import { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { eye } from './eye';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\n/**\n * @ignore\n * \u250C \u2510 \u250C \u2510\u250C \u2510\n * \u2502Skl\u2502 \u2502c \u2212s\u2502\u2502Skl\u2502\n * \u2502 \u2502 := \u2502 \u2502\u2502 \u2502\n * \u2502Sij\u2502 \u2502s c\u2502\u2502Sij\u2502\n * \u2514 \u2518 \u2514 \u2518\u2514 \u2518\n */\nconst rotate:\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number) => void =\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number): void => {\n const [n] = x.shape;\n const { data: d1 } = x;\n const temp: number = d1[k * n + l];\n const tau: number = 1 / (c + s);\n\n d1[k * n + l] = temp - s * (d1[i * n + j] + tau * temp);\n d1[i * n + j] += s * (temp - tau * d1[i * n + j]);\n };\n\n/**\n * @static\n * @memberof module:Globals\n * @function eig\n * @description\n * Gets eigenvalues and eigenvectors of `x` using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { eig } from 'vectorious/core/eig';\n * \n * eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport const eig = (x: NDArray | ArrayLike): [NDArray, NDArray] => array(x).eig();\n\n/**\n * @function eig\n * @memberof NDArray.prototype\n * @description\n * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport default function(this: NDArray): [NDArray, NDArray] {\n this.square();\n\n const [n] = this.shape;\n\n try {\n if (!['float32', 'float64'].includes(this.dtype)) {\n this.dtype = 'float32';\n this.data = get_type(this.dtype).from(this.data);\n }\n\n const jobvl: typeof nlapack.NDArrayEigenvector = nlapack.NoEigenvector;\n const jobvr: typeof nlapack.NDArrayEigenvector = nlapack.Eigenvector;\n\n const wr = zeros(n);\n const wi = zeros(n);\n\n const vl = zeros(n, n);\n const vr = zeros(n, n);\n\n const { data: d1 } = this;\n const { data: d2 } = wr;\n const { data: d3 } = wi;\n const { data: d4 } = vl;\n const { data: d5 } = vr;\n if (this.dtype === 'float64') {\n nlapack.dgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n if (this.dtype === 'float32') {\n nlapack.sgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n return [wr, vr];\n } catch (err) {\n const { data: d1 } = this;\n const p = eye(n);\n\n let max = 0;\n let i = 0;\n let j = 0;\n let k = 0;\n let l = 0;\n\n do {\n // Find maximum off-diagonal element\n for (i = 0; i < n; i += 1) {\n for (j = i + 1; j < n; j += 1) {\n if (Math.abs(d1[i * n + j]) >= max) {\n max = Math.abs(d1[i * n + j]);\n k = i;\n l = j;\n }\n }\n }\n\n // Find c and s\n let t;\n if (Math.abs(d1[k * n + l]) < Math.abs(d1[l * n + l]) * 1e-36) {\n t = d1[k * n + l] / d1[l * n + l];\n } else {\n const phi = d1[l * n + l] / 2 * d1[k * n + l];\n t = 1 / (Math.abs(phi) + Math.sqrt(phi * phi + 1));\n }\n\n const c = 1 / Math.sqrt(t * t + 1);\n const s = t * c;\n\n const e = d1[k * n + l];\n d1[k * n + l] = 0;\n d1[k * n + k] -= t * e;\n d1[l * n + l] += t * e;\n\n // Rotate rows and columns k and l\n for (i = 0; i < k; i += 1) {\n rotate(this, c, s, i, k, i, l);\n }\n\n for (i = k + 1; i < l; i += 1) {\n rotate(this, c, s, k, i, i, l);\n }\n\n for (i = l + 1; i < n; i += 1) {\n rotate(this, c, s, k, i, l, i);\n }\n\n // Rotate eigenvectors\n for (i = 0; i < n; i += 1) {\n rotate(p, c, s, i, k, i, l);\n }\n } while (max >= 1e-9);\n\n return [this.diagonal(), p];\n }\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function equals\n * @description Checks if `x` and `y` are equal.\n * @param {NDArray} x\n * @param {NDArray} y\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * equals([1, 2, 3], [1, 2, 3]); // => true\n */\nexport const equals = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, tolerance: number = 1e-6): boolean =>\n array(x).equals(array(y), tolerance);\n\n/**\n * @function equals\n * @memberof NDArray.prototype\n * @description Checks if current array and `x` are equal.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * array([1, 2, 3]).equals([1, 2, 3]); // => true\n */\nexport default function(this: NDArray, x: NDArray, tolerance: number = 1e-6): boolean {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n if (Math.abs(d1[i] - d2[j]) > tolerance) {\n return false;\n }\n }\n\n return true;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equidimensional\n * @description Asserts if `x` and `y` have the same shape\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} shapes x and y do not match\n * @example\n * import { equidimensional } from 'vectorious/core/equidimensional';\n * \n * equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport const equidimensional = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equidimensional(array(y));\n};\n\n/**\n * @deprecated\n * @function equidimensional\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same shape\n * @param {NDArray} x\n * @throws {Error} shapes x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { shape: s1 } = this;\n const { shape: s2 } = x;\n\n if (!s1.every((dim: number, i: number) => dim === s2[i])) {\n throw new Error(`shapes ${s1} and ${s2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equilateral\n * @description Asserts if `x` and `y` have the same length\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} lengths x and y do not match\n * @example\n * import { equilateral } from 'vectorious/core/equilateral';\n * \n * equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport const equilateral = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equilateral(array(y));\n};\n\n/**\n * @deprecated\n * @function equilateral\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same length\n * @param {NDArray} x\n * @throws {Error} lengths x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== l2) {\n throw new Error(`lengths ${l1} and ${l2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { exp: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function exp\n * @description\n * Returns e^x of each element of `x`, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { exp } from 'vectorious/core/exp';\n * \n * exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport const exp = (x: NDArray | ArrayLike): NDArray => array(x).exp();\n\n/**\n * @function exp\n * @memberof NDArray.prototype\n * @description\n * Returns e^x of each element of current array, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { expm1: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function expm1\n * @description Returns subtracting 1 from exp(x) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { expm1 } from 'vectorious/core/expm1';\n * \n * expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport const expm1 = (x: NDArray | ArrayLike): NDArray => array(x).expm1();\n\n/**\n * @function expm1\n * @memberof NDArray.prototype\n * @description Returns subtracting 1 from exp(x) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function fill\n * @description Fills `x` with a scalar value\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { fill } from 'vectorious/core/fill';\n * \n * fill([1, 2, 3], 0); // => array([0, 0, 0])\n */\nexport const fill = (\n x: NDArray | ArrayLike,\n value: number | ((index: number) => number) = 0\n): NDArray =>\n array(x).fill(value);\n\n/**\n * @function fill\n * @memberof NDArray.prototype\n * @description Fills the current array with a scalar value\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])\n */\nexport default function(this: NDArray, value: number | ((index: number) => number) = 0): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = value instanceof Function ? value(iter.pos) : value;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { floor: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function floor\n * @description Returns the largest integer less than or equal to a number of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { floor } from 'vectorious/core/floor';\n * \n * floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])\n */\nexport const floor = (x: NDArray | ArrayLike): NDArray => array(x).floor();\n\n/**\n * @function floor\n * @memberof NDArray.prototype\n * @description Returns the largest integer less than or equal to a number of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function forEach\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {NDArray} x\n * @param {Function} f\n * @example\n * import { forEach } from 'vectorious/core/forEach';\n * \n * forEach([1, 2, 3], console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport const forEach = (\n x: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void => {\n x.forEach(f);\n};\n\n/**\n * @function forEach\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {Function} f\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).forEach(console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n f.call(this, d1[i!], i!, d1);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { fround: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function fround\n * @description Returns the nearest single precision float representation of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { fround } from 'vectorious/core/fround';\n * \n * fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])\n */\nexport const fround = (x: NDArray | ArrayLike): NDArray => array(x).fround();\n\n/**\n * @function fround\n * @memberof NDArray.prototype\n * @description Returns the nearest single precision float representation of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\nexport function getrf(dtype: DType, m: number, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== m * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetrf(m, n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetrf(m, n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function getri(dtype: DType, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== n * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetri(n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetri(n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gesv(dtype: DType, n: number, nrhs: number, x: TypedArray, ldx: number, ipiv: Int32Array, y: TypedArray, ldy: number) {\n if (x.length !== ldx * n || y.length !== ldy * nrhs) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n case 'float32':\n return nlapack.sgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n// import { diagonal } from './diagonal';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function gauss\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { gauss } from 'vectorious/core/gauss';\n * \n * gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])\n */\nexport const gauss = (x: NDArray | ArrayLike): NDArray => array(x).gauss();\n\n/**\n * @function gauss\n * @memberof NDArray.prototype\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])\n */\nexport default function(this: NDArray): NDArray {\n const { shape: [r, c], data: d1, dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(Math.min(r, c));\n\n lapack.getrf(dtype, r, c, d1, c, ipiv);\n\n const iter = new NDIter(this);\n\n // Zero out lower triangular part of matrix\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d1[i!] = 0;\n }\n\n [ci, cj] = iter.coords;\n }\n } catch (err) {\n let lead: number = 0;\n let leadValue: number;\n let pivot: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (i = 0; i < r; i += 1) {\n if (c <= lead) {\n return this;\n }\n\n j = i;\n while (d1[j * c + lead] === 0) {\n j += 1;\n if (r === j) {\n j = i;\n lead += 1;\n\n if (c === lead) {\n return this;\n }\n }\n }\n\n if (i !== j) {\n this.swap(i, j);\n }\n\n pivot = d1[i * c + lead];\n if (pivot !== 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n\n for (j = 0; j < r; j += 1) {\n leadValue = d1[j * c + lead];\n if (j !== i) {\n for (k = 0; k < c; k += 1) {\n d1[j * c + k] -= d1[i * c + k] * leadValue;\n }\n }\n }\n\n lead += 1;\n }\n\n for (i = 0; i < r; i += 1) {\n pivot = 0;\n for (j = 0; j < c; j += 1) {\n if (pivot === 0) {\n pivot = d1[i * c + j];\n }\n }\n\n if (pivot === 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function get\n * @description Gets the element at `i, j, ..., n` from `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { get } from 'vectorious/core/get';\n * \n * get([1, 2, 3], 2); // 3\n */\nexport const get = (x: NDArray | ArrayLike, ...indices: number[]): number =>\n array(x).get(...indices);\n\n/**\n * @function get\n * @memberof NDArray.prototype\n * @description Gets the element at `i, j, ..., n` from current vector.\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).get(2); // 3\n */\nexport default function(this: NDArray, ...indices: number[]): number {\n this.check(...indices);\n\n const { data: d1, shape: s1 } = this;\n const { length: ndim } = s1;\n let index: number = indices[ndim - 1];\n\n let i: number;\n let j: number;\n for (i = 0; i < ndim - 1; i += 1) {\n let p: number = 1;\n for (j = i + 1; j < ndim; j += 1) {\n p *= s1[j];\n }\n\n index += indices[i] * p;\n }\n\n return d1[index];\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { eye } from './eye';\nimport { augment } from './augment';\nimport { zeros } from './zeros';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function inv\n * @description\n * Determines the inverse of `x`.\n * Accelerated with LAPACK `?getrf` and `?getri`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { inv } from 'vectorious/core/inv';\n * \n * inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport const inv = (x: NDArray | ArrayLike): NDArray => array(x).inv();\n\n/**\n * @function inv\n * @memberof NDArray.prototype\n * @description\n * Determines the inverse of current matrix using Gaussian elimination.\n * Accelerated with LAPACK `?getri`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { shape: [n], dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(n);\n\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n lapack.getri(dtype, n, d1, n, ipiv);\n\n return this;\n } catch (err) {\n const identity = eye(n);\n const rref = augment(this, identity).gauss();\n const left = zeros(n, n);\n const right = zeros(n, n);\n\n const { data: d1 } = rref;\n const { data: d2 } = left;\n const { data: d3 } = right;\n\n const iter = new NDIter(rref);\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < n) {\n d2[ci * n + cj] = d1[i!];\n } else {\n d3[ci * n + (cj - n)] = d1[i!];\n }\n\n [ci, cj] = iter.coords;\n }\n\n if (!left.equals(identity)) {\n throw new Error('matrix is not invertible');\n }\n\n return right;\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log\n * @description Returns the natural logarithm (log_e, also ln) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log } from 'vectorious/core/log';\n * \n * log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport const log = (x: NDArray | ArrayLike): NDArray => array(x).log();\n\n/**\n * @function log\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log10: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log10\n * @description Returns the base 10 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log10 } from 'vectorious/core/log10';\n * \n * log10([10, 100, 1000]); // => array([1, 2, 3])\n */\nexport const log10 = (x: NDArray | ArrayLike): NDArray => array(x).log10();\n\n/**\n * @function log10\n * @memberof NDArray.prototype\n * @description Returns the base 10 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log1p: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log1p\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log1p } from 'vectorious/core/log1p';\n * \n * log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport const log1p = (x: NDArray | ArrayLike): NDArray => array(x).log1p();\n\n/**\n * @function log1p\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log2: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log2\n * @description Returns the base 2 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log2 } from 'vectorious/core/log2';\n * \n * log2([1, 2, 4]); // => array([0, 1, 2])\n */\nexport const log2 = (x: NDArray | ArrayLike): NDArray => array(x).log2();\n\n/**\n * @function log2\n * @memberof NDArray.prototype\n * @description Returns the base 2 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 4]).log2(); // => array([0, 1, 2])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu\n * @description\n * Performs full LU decomposition on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu } from 'vectorious/core/lu';\n * \n * lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu = (x: NDArray | ArrayLike): [NDArray, NDArray, Int32Array] =>\n array(x).lu();\n\n/**\n * @function lu\n * @memberof NDArray.prototype\n * @description\n * Performs full LU decomposition on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function (this: NDArray): [NDArray, NDArray, Int32Array] {\n const [LU, ipiv] = this.copy().lu_factor();\n const L = LU.copy();\n const U = LU.copy();\n const { data: d1 } = L;\n const { data: d2 } = U;\n\n const iter = new NDIter(LU);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d2[i!] = 0;\n } else {\n d1[i!] = ci === cj ? 1 : 0;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return [L, U, ipiv];\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu_factor\n * @description\n * Performs LU factorization on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu_factor } from 'vectorious/core/lu_factor';\n * \n * lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu_factor = (x: NDArray | ArrayLike): [NDArray, Int32Array] =>\n array(x).lu_factor();\n\n/**\n * @function lu_factor\n * @memberof NDArray.prototype\n * @description\n * Performs LU factorization on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function(this: NDArray): [NDArray, Int32Array] {\n const { data: d1, shape: [n], dtype } = this;\n const ipiv: Int32Array = new Int32Array(n);\n\n try {\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n } catch (err) {\n let max: number;\n let abs: number;\n let diag: number;\n let p: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (k = 0; k < n; k += 1) {\n p = k;\n max = Math.abs(d1[k * n + k]);\n for (j = k + 1; j < n; j += 1) {\n abs = Math.abs(d1[j * n + k]);\n if (max < abs) {\n max = abs;\n p = j;\n }\n }\n\n ipiv[k] = p + 1;\n\n if (p !== k) {\n this.swap(k, p);\n }\n\n diag = d1[k * n + k];\n for (i = k + 1; i < n; i += 1) {\n d1[i * n + k] /= diag;\n }\n\n for (i = k + 1; i < n; i += 1) {\n for (j = k + 1; j < n - 1; j += 2) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n d1[i * n + j + 1] -= d1[i * n + k] * d1[k * n + j + 1];\n }\n\n if (j === n - 1) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n }\n }\n }\n }\n\n return [this, ipiv];\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function map\n * @description Equivalent to `TypedArray.prototype.map`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { map } from 'vectorious/core/map';\n * \n * map([1, 2, 3], value => -value); // => array([-1, -2, -3])\n */\nexport const map = (\n x: NDArray | ArrayLike,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray => array(x).map(f);\n\n/**\n * @function map\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.map`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n const map = f.bind(this);\n\n const copy = this.copy();\n const { data: d2 } = copy;\n\n for (const i of iter) {\n d2[i!] = map(d1[i!], i!, d1);\n }\n\n return copy;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function max\n * @description\n * Gets the maximum value (largest) element of `x`.\n * Accelerated with BLAS `i?amax`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { max } from 'vectorious/core/max';\n * \n * max([1, 2, 3]); // => 3\n */\nexport const max = (x: NDArray | ArrayLike): number => array(x).max();\n\n/**\n * @function max\n * @memberof NDArray.prototype\n * @description\n * Gets the maximum value (smallest) element of current array.\n * Accelerated with BLAS `i?amax`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).max(); // => 3\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let max: number = Number.NEGATIVE_INFINITY;\n\n try {\n max = d1[blas.iamax(dtype, l1, d1, 1)];\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n const value = d1[i!];\n if (max < value) {\n max = value;\n }\n }\n }\n\n return max;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function mean\n * @description Gets the arithmetic mean of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { mean } from 'vectorious/core/mean';\n * \n * mean([1, 2, 3]); // => 2\n */\nexport const mean = (x: NDArray | ArrayLike): number => array(x).mean();\n\n/**\n * @function mean\n * @memberof NDArray.prototype\n * @description Gets the arithmetic mean of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).mean(); // => 2\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1 } = this;\n const iter = new NDIter(this);\n\n let mean: number = 0;\n for (const i of iter) {\n mean += d1[i!];\n }\n\n return mean / l1;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function min\n * @description Gets the minimum value (smallest) element of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { min } from 'vectorious/core/min';\n * \n * min([1, 2, 3]); // => 1\n */\nexport const min = (x: NDArray | ArrayLike): number => array(x).min();\n\n/**\n * @function min\n * @memberof NDArray.prototype\n * @description Gets the minimum value (smallest) element of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).min(); // 1\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n\n const iter = new NDIter(this);\n\n let min: number = Number.POSITIVE_INFINITY;\n for (const i of iter) {\n const value = d1[i!];\n if (min > value) {\n min = value;\n }\n }\n\n return min;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function matrix\n * @description Creates a matrix of `r` rows and `c` columns.\n * @param {Number} r\n * @param {Number} c\n * @returns {NDArray}\n * @example\n * import { matrix } from 'vectorious/core/matrix';\n * \n * matrix(2, 2); // => array([[0, 0], [0, 0]])\n */\nexport const matrix = (r: number, c: number): NDArray =>\n new NDArray(\n new Float64Array(r * c),\n { shape: [r, c] }\n );\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { matrix } from './matrix';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function multiply\n * @description\n * Multiplies two matrices `x` and `y` of matching dimensions.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { multiply } from 'vectorious/core/multiply';\n * \n * multiply([[1, 2]], [[1], [2]]); // => array([[5]])\n */\nexport const multiply = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).multiply(array(y));\n\n/**\n * @function multiply\n * @memberof NDArray.prototype\n * @description\n * Multiplies current matrix with `x`.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { shape: [r1, c1], data: d1, dtype } = this;\n const { shape: [r2, c2], data: d2 } = x;\n\n if (c1 !== r2) {\n throw new Error('sizes do not match');\n }\n\n const y = matrix(r1, c2);\n const { data: d3 } = y;\n\n try {\n blas.gemm(dtype, blas.NoTrans, blas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);\n } catch (err) {\n const iter = new NDIter(y);\n\n let k;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n let sum = 0;\n for (k = 0; k < c1; k += 1) {\n sum += d1[ci * c1 + k] * d2[k * c2 + cj];\n }\n\n d3[i!] = sum;\n [ci, cj] = iter.coords;\n }\n }\n\n return y;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as blas from '../blas';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function norm\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { norm } from 'vectorious/core/norm';\n * \n * norm([1, 2, 3]); // => 3.7416574954986572\n */\nexport const norm = (x: NDArray | ArrayLike): number => array(x).norm();\n\n/**\n * @function norm\n * @memberof NDArray.prototype\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).norm(); // => 3.7416574954986572\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let result: number = 0;\n\n try {\n result = blas.nrm2(dtype, l1, d1, 1);\n } catch (err) {\n result = f(this.dot(this));\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function normalize\n * @description Normalizes `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { normalize } from 'vectorious/core/normalize';\n * \n * normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport const normalize = (x: NDArray | ArrayLike): NDArray =>\n array(x).normalize();\n\n/**\n * @function normalize\n * @memberof NDArray.prototype\n * @description Normalizes current vector.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport default function(this: NDArray): NDArray {\n return this.scale(1 / this.norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { pow: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function pow\n * @description Returns each element of `x` to the exponent power, that is, element^exponent.\n * @param {NDArray} x\n * @param {Number} exponent\n * @returns {NDArray}\n * @example\n * import { pow } from 'vectorious/core/pow';\n * \n * pow([1, 2, 3], 2); // => array([1, 4, 9])\n */\nexport const pow = (x: NDArray | ArrayLike, exponent: number): NDArray =>\n array(x).pow(exponent);\n\n/**\n * @function pow\n * @memberof NDArray.prototype\n * @description Returns each element of current array to the exponent power, that is, element^exponent.\n * @param {Number} exponent\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])\n */\nexport default function(this: NDArray, exponent: number): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!], exponent);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function prod\n * @description Product of all elements of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { prod } from 'vectorious/core/prod';\n * \n * prod([1, 2, 3]); // => 6\n */\nexport const prod = (x: NDArray | ArrayLike): number => array(x).prod();\n\n/**\n * @function prod\n * @memberof NDArray.prototype\n * @description Product of all elements of current array\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).prod(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let prod: number = 1;\n for (const i of iter) {\n prod *= d1[i!];\n }\n\n return prod;\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function product\n * @description Hadamard product of `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { product } from 'vectorious/core/product';\n * \n * product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])\n */\nexport const product = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).product(array(y));\n\n/**\n * @function product\n * @memberof NDArray.prototype\n * @description Hadamard product of current matrix and `x`\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i!] *= d2[j!];\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function project\n * @description Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { project } from 'vectorious/core/project';\n * \n * project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport const project = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).project(array(y));\n\n/**\n * @function project\n * @memberof NDArray.prototype\n * @description Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n return x.scale(this.dot(x) / x.dot(x));\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function push\n * @description Pushes a new `value` into `x`.\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { push } from 'vectorious/core/push';\n * \n * push([1, 2, 3], 4); // => array([1, 2, 3, 4])\n */\nexport const push = (x: NDArray | ArrayLike, value: number): NDArray =>\n array(x).push(value);\n\n/**\n * @function push\n * @memberof NDArray.prototype\n * @description Pushes a new `value` into current vector.\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])\n */\nexport default function(this: NDArray, value: number): NDArray {\n if (this.shape.length !== 1) {\n throw new Error('push operation not permitted for multidimensional arrays');\n }\n\n const { data: d1, length: l1 } = this;\n const l2: number = l1 + 1;\n const d2: TypedArray = new (get_type(this.dtype))(l2);\n\n d2.set(d1);\n d2[l1] = value;\n\n this.data = d2;\n this.length = l2;\n this.shape = [l2];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function rank\n * @description Finds the rank of `x` using gaussian elimination.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { rank } from 'vectorious/core/rank';\n * \n * rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1\n */\nexport const rank = (x: NDArray | ArrayLike, tolerance: number = 1e-6): number => array(x).rank(tolerance);\n\n/**\n * @function rank\n * @memberof NDArray.prototype\n * @description Finds the rank of current matrix using gaussian elimination.\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1\n * @todo Switch to SVD algorithm\n */\nexport default function(this: NDArray, tolerance: number = 1e-6): number {\n const { data: d1 } = this.copy().gauss();\n\n const iter = new NDIter(this);\n\n let rk: number = 0;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (rk <= ci && cj >= ci && d1[i!] > tolerance) {\n rk += 1;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return rk;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reciprocal\n * @description Gets the element-wise reciprocal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { reciprocal } from 'vectorious/core/reciprocal';\n * \n * reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport const reciprocal = (x: NDArray | ArrayLike): NDArray =>\n array(x).reciprocal();\n\n/**\n * @function reciprocal\n * @memberof NDArray.prototype\n * @description Gets the element-wise reciprocal of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = 1 / d1[i!];\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reduce\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {NDArray} x\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { reduce } from 'vectorious/core/reduce';\n * \n * reduce([1, 2, 3], (a, b) => a + b, 0); // => 6\n */\nexport const reduce = (\n x: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number => array(x).reduce(f, initialValue);\n\n/**\n * @function reduce\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6\n */\nexport default function(\n this: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number {\n const { data: d1, length: l1 } = this;\n if (l1 === 0 && typeof initialValue === 'undefined') {\n throw new Error('Reduce of empty array with no initial value.');\n }\n\n const iter = new NDIter(this);\n const reduce = f.bind(this);\n\n let value: number;\n\n if (typeof initialValue === 'undefined') {\n value = d1[0];\n iter.next();\n } else {\n value = initialValue;\n }\n\n for (const i of iter) {\n value = reduce(value, d1[i!], i!, d1);\n }\n\n return value;\n};\n", "import { get_strides } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reshape\n * @description Reshapes `x`\n * @param {NDArray} x\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { reshape } from 'vectorious/core/reshape';\n * \n * reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])\n */\nexport const reshape = (x: NDArray | ArrayLike, ...shape: number[]): NDArray =>\n array(x).reshape(...shape);\n\n/**\n * @function reshape\n * @memberof NDArray.prototype\n * @description Reshapes current array\n * @param {Number[]} ...shape\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])\n */\nexport default function(this: NDArray, ...shape: number[]): NDArray {\n const { length } = this;\n if (shape.reduce((sum: number, dim: number) => sum * dim, 1) !== length) {\n throw new Error(`shape ${shape} does not match length ${length}`);\n }\n\n this.shape = shape;\n this.strides = get_strides(shape);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { round: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function round\n * @description Returns the value of each element of `x` rounded to the nearest integer.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { round } from 'vectorious/core/round';\n * \n * round([1.2, 2.8, 3.5]); // => array([1, 3, 4])\n */\nexport const round = (x: NDArray | ArrayLike): NDArray => array(x).round();\n\n/**\n * @function round\n * @memberof NDArray.prototype\n * @description Returns the value of each element of current array rounded to the nearest integer.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function row_add\n * @description Adds a multiple of one row multiplied by `scalar` to another inside `x`.\n * @param {NDArray} x\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { row_add } from 'vectorious/core/row_add';\n * \n * row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])\n */\nexport const row_add = (\n x: NDArray | ArrayLike,\n dest: number,\n source: number,\n scalar: number = 1\n): NDArray =>\n array(x).row_add(dest, source, scalar);\n\n/**\n * @function row_add\n * @memberof NDArray.prototype\n * @description Adds a multiple of one row multiplied by `scalar` to another inside current matrix.\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])\n */\nexport default function(this: NDArray, dest: number, source: number, scalar: number = 1): NDArray {\n this.check(dest, 0);\n this.check(source, 0);\n\n const [, c] = this.shape;\n const { data: d1 } = this;\n\n let j: number;\n for (j = 0; j < c; j += 1) {\n d1[dest * c + j] += d1[source * c + j] * scalar;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function scale\n * @description\n * Multiplies all elements of `x` with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {NDArray} x\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { scale } from 'vectorious/core/scale';\n * \n * scale([1, 2, 3], 2); // => array([2, 4, 6])\n */\nexport const scale = (x: NDArray | ArrayLike, scalar: number): NDArray =>\n array(x).scale(scalar);\n\n/**\n * @function scale\n * @memberof NDArray.prototype\n * @description\n * Multiplies all elements of current array with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])\n */\nexport default function(this: NDArray, scalar: number): NDArray {\n const { data: d1, length: l1, dtype } = this;\n\n try {\n blas.scal(dtype, l1, scalar, d1, 1);\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] *= scalar;\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function set\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { set } from 'vectorious/core/set';\n * \n * set([1, 2, 3], 1, 0); // => array([1, 0, 3])\n */\nexport const set = (x: NDArray, ...args: number[]): void => {\n x.set(...args);\n};\n\n/**\n * @function set\n * @memberof NDArray.prototype\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])\n */\nexport default function(this: NDArray, ...args: number[]): void {\n const indices: number[] = args.slice(0, -1);\n const value: number = args[args.length - 1];\n\n this.check(...indices);\n\n const { shape: s1 } = this;\n let index: number = indices[indices.length - 1];\n\n let i: number;\n for (i = 0; i < indices.length - 1; i += 1) {\n index += indices[i] * s1[i + 1];\n }\n\n this.data[index] = value;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sign: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sign\n * @description\n * Returns the sign of each element of `x`, indicating\n * whether it is positive, negative or zero.\n * @param {Number} x\n * @returns {NDArray}\n * @example\n * import { sign } from 'vectorious/core/sign';\n * \n * sign([1, 2, 3]); // => array([1, 1, 1])\n */\nexport const sign = (x: NDArray | ArrayLike): NDArray => array(x).sign();\n\n/**\n * @function sign\n * @memberof NDArray.prototype\n * @description\n * Returns the sign of each element of current array, indicating\n * whether it is positive, negative or zero.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sign(); // <=> array([1, 1, 1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sin\n * @description Returns the sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sin } from 'vectorious/core/sin';\n * \n * sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])\n */\nexport const sin = (x: NDArray | ArrayLike): NDArray => array(x).sin();\n\n/**\n * @function sin\n * @memberof NDArray.prototype\n * @description Returns the sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sinh\n * @description Returns the hyperbolic sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sinh } from 'vectorious/core/sinh';\n * \n * sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport const sinh = (x: NDArray | ArrayLike): NDArray => array(x).sinh();\n\n/**\n * @function sinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { get_strides } from '../util';\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function slice\n * @description Slices `x` in the corresponding dimension\n * @param {NDArray} x\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {NDArray}\n * @example\n * import { slice } from 'vectorious/core/slice';\n * \n * slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])\n */\nexport const slice = (\n x: NDArray | ArrayLike,\n begin?: number,\n end?: number,\n step?: number\n): NDArray =>\n array(x).slice(begin, end, step);\n\n/**\n * @function slice\n * @memberof NDArray.prototype\n * @description Slices the current array in the corresponding dimension\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])\n */\nexport default function(\n this: NDArray,\n begin: number = 0,\n end: number = this.shape[0],\n step: number = 1\n): NDArray {\n const { shape: s1 } = this;\n const nd = s1.length;\n\n if (begin < 0 || end < 0) {\n return this.slice(begin < 0 ? nd + begin : begin, end < 0 ? nd + end : end);\n }\n\n if (step === 0) {\n throw new Error('step argument cannot be 0');\n }\n\n const s2: number[] = [Math.ceil((end - begin) / step), ...s1.slice(1)];\n const l2: number = s2.reduce((sum: number, dim: number) => sum * dim, 1);\n const st2: number[] = get_strides(s2);\n\n this.shape = s2;\n this.length = l2;\n this.strides = st2;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function solve\n * @description\n * Solves the equation AX = B (where A is `x` and B is `y`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { solve } from 'vectorious/core/solve';\n * \n * solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport const solve = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).solve(array(y));\n\n/**\n * @function solve\n * @memberof NDArray.prototype\n * @description\n * Solves the equation AX = B (where A is current matrix and B is `x`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1, dtype } = this;\n const { data: d2, shape: [n, nrhs] } = x;\n\n try {\n const ipiv: Int32Array = new Int32Array(n);\n lapack.gesv(dtype, n, nrhs, d1, n, ipiv, d2, nrhs);\n } catch (err) {\n const [LU, ipiv] = this.lu_factor();\n const { data: d1 } = LU;\n const { data: d2 } = x;\n\n let i: number;\n let j: number;\n let k: number;\n\n for (i = 0; i < ipiv.length; i += 1) {\n if (i !== ipiv[i] - 1) {\n x.swap(i, ipiv[i] - 1);\n }\n }\n\n for (k = 0; k < nrhs; k += 1) {\n for (i = 0; i < n; i += 1) {\n for (j = 0; j < i; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n }\n\n for (i = n - 1; i >= 0; i -= 1) {\n for (j = i + 1; j < n; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n\n d2[i * nrhs + k] /= d1[i * n + i];\n }\n }\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sqrt\n * @description Returns the positive square root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sqrt } from 'vectorious/core/sqrt';\n * \n * sqrt([1, 4, 9]); // => array([1, 2, 3])\n */\nexport const sqrt = (x: NDArray | ArrayLike): NDArray => array(x).sqrt();\n\n/**\n * @function sqrt\n * @memberof NDArray.prototype\n * @description Returns the positive square root of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 4, 9]); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function square\n * @description Asserts if `x` is square.\n * @param {NDArray} x\n * @throws {Error} matrix is not square\n * @example\n * import { square } from 'vectorious/core/square';\n * \n * square([1, 2, 3]); // Error: matrix is not square\n */\nexport const square = (x: NDArray | ArrayLike): void => {\n array(x).square();\n};\n\n/**\n * @function square\n * @memberof NDArray.prototype\n * @description Asserts if current matrix is square.\n * @throws {Error} matrix is not square\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).square(); // Error: matrix is not square\n */\nexport default function(this: NDArray): void {\n const { length } = this.shape;\n const [r, c] = this.shape;\n\n if (length !== 2 || r !== c) {\n throw new Error('matrix is not square');\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function subtract\n * @description\n * Subtracts `y` from `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { subtract } from 'vectorious/core/subtract';\n * \n * subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])\n */\nexport const subtract = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).subtract(array(y));\n\n/**\n * @function subtract\n * @memberof NDArray.prototype\n * @description\n * Subtracts `x` from the current array.\n * Accelerated with BLAS `?axpy`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])\n */\nexport default function (this: NDArray, x: NDArray): NDArray {\n return this.add(x, -1);\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function sum\n * @description Sum of `x`\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { sum } from 'vectorious/core/sum';\n * \n * sum([1, 2, 3]); // => 6\n */\nexport const sum = (x: NDArray | ArrayLike): number => array(x).sum();\n\n/**\n * @function sum\n * @memberof NDArray.prototype\n * @description Sum of array elements\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sum(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let sum: number = 0;\n for (const i of iter) {\n sum += d1[i!];\n }\n\n return sum;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function swap\n * @description Swaps two rows `i` and `j` in `x`.\n * @param {NDArray} x\n * @param {Number} i\n * @param {Number} j\n * @returns {NDArray}\n * @example\n * import { swap } from 'vectorious/core/swap';\n * \n * swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])\n */\nexport const swap = (x: NDArray | ArrayLike, i: number, j: number): NDArray =>\n array(x).swap(i, j);\n\n/**\n * @function swap\n * @memberof NDArray.prototype\n * @description Swaps two rows `i` and `j` in current matrix\n * @param {Number} i\n * @param {Number} j\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])\n */\nexport default function(this: NDArray, i: number, j: number): NDArray {\n this.check(i, 0);\n this.check(j, 0);\n\n const { data: d1 } = this;\n const [, c] = this.shape;\n const d2: TypedArray = d1.slice(i * c, (i + 1) * c);\n\n d1.copyWithin(i * c, j * c, (j + 1) * c);\n d1.set(d2, j * c);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tan\n * @description Returns the tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tan } from 'vectorious/core/tan';\n * \n * tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport const tan = (x: NDArray | ArrayLike): NDArray => array(x).tan();\n\n/**\n * @function tan\n * @memberof NDArray.prototype\n * @description Returns the tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tanh\n * @description Returns the hyperbolic tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tanh } from 'vectorious/core/tanh';\n * \n * tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport const tanh = (x: NDArray | ArrayLike): NDArray => array(x).tanh();\n\n/**\n * @function tanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toArray\n * @description Converts `x` into a JavaScript array.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { toArray } from 'vectorious/core/toArray';\n * \n * toArray([1, 2, 3]); // => [1, 2, 3]\n */\nexport const toArray = (x: NDArray | ArrayLike): any => array(x).toArray();\n\n/**\n * @function toArray\n * @memberof NDArray.prototype\n * @description Converts current vector into a JavaScript array.\n * @param {Number} index\n * @param {Number} dim\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toArray(); // => [1, 2, 3]\n */\nexport default function(this: NDArray, index: number = 0, dim = 0): any {\n const { data: d1, shape: s1, strides: st1 } = this;\n const { length: ndim } = s1;\n\n if (dim >= ndim) {\n return d1[index];\n }\n\n const n = s1[dim];\n const stride = st1[dim];\n const list = [];\n\n for (let i = 0; i < n; i++) {\n const item = this.toArray(index, dim + 1);\n if (item === null) {\n return null;\n }\n\n list[i] = item;\n index += stride;\n }\n\n return list;\n};\n", "import { inspect } from 'util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toString\n * @description Converts `x` into a readable formatted string.\n * @param {NDArray} x\n * @returns {String}\n * @example\n * import { toString } from 'vectorious/core/toString';\n * \n * toString([1, 2, 3]); // => '1,2,3'\n */\nexport const toString = (x: NDArray | ArrayLike): string => array(x).toString();\n\n/**\n * @function toString\n * @memberof NDArray.prototype\n * @description Converts current vector into a readable formatted string.\n * @returns {String}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toString(); // => '1,2,3'\n */\nexport default function (this: NDArray): string {\n return `array(${inspect(this.toArray(), { depth: 10, breakLength: 40 })}, dtype=${this.dtype})`;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function trace\n * @description Gets the trace of `x` (the sum of all diagonal elements).\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { trace } from 'vectorious/core/trace';\n * \n * trace([[1, 2], [3, 4]]); // => 5\n */\nexport const trace = (x: NDArray | ArrayLike): number => array(x).trace();\n\n/**\n * @function trace\n * @memberof NDArray.prototype\n * @description Gets the trace of the matrix (the sum of all diagonal elements).\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).trace(); // => 5\n */\nexport default function(this: NDArray): number {\n const [r, c] = this.shape;\n const { data: d1 } = this;\n const n: number = Math.min(r, c);\n\n let result: number = 0;\n\n let j: number;\n for (j = 0; j < n; j += 1) {\n result += d1[j * c + j];\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function transpose\n * @description Transposes `x` (mirror across the diagonal).\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { transpose } from 'vectorious/core/transpose';\n * \n * transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport const transpose = (x: NDArray | ArrayLike): NDArray =>\n array(x).transpose();\n\n/**\n * @function transpose\n * @memberof NDArray.prototype\n * @description Transposes current matrix (mirror across the diagonal).\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport default function(this: NDArray): NDArray {\n if (this.shape.length < 2) {\n return this;\n }\n\n let tmp = this.shape[0];\n this.shape[0] = this.shape[1];\n this.shape[1] = tmp;\n\n tmp = this.strides[0];\n this.strides[0] = this.strides[1];\n this.strides[1] = tmp;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { trunc: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function trunc\n * @description\n * Returns the integer part of each element of `x`,\n * removing any fractional digits.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { trunc } from 'vectorious/core/trunc';\n * \n * trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])\n */\nexport const trunc = (x: NDArray | ArrayLike): NDArray => array(x).trunc();\n\n/**\n * @function trunc\n * @memberof NDArray.prototype\n * @description\n * Returns the integer part of each element of current array,\n * removing any fractional digits.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function magic\n * @description Creates a magic square matrix of size `n`\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { magic } from 'vectorious/core/magic';\n * \n * magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])\n */\nexport const magic = (n: number): NDArray => {\n if (n < 0) {\n throw new Error('invalid n');\n }\n\n const d1: TypedArray = new Float64Array(n * n);\n const magic = new NDArray(d1, { shape: [n, n] });\n const iter = new NDIter(magic);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n const a = n - ci - 1;\n const b = n - cj - 1;\n\n d1[i!] = ((cj + a * 2 + 1) % n) * n + ((b + a * 2 + 1) % n) + 1;\n [ci, cj] = iter.coords;\n }\n\n return magic;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function ones\n * @description Creates an array containing ones (`1`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { ones } from 'vectorious/core/ones';\n * \n * ones(3); // => array([1, 1, 1])\n */\nexport const ones = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(1);\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function random\n * @description Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { random } from 'vectorious/core/random';\n * \n * random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])\n */\nexport const random = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).map(() => Math.random());\n", "import { TypedArray, TypedArrayConstructor } from '../types';\n\nimport { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function range\n * @description\n * Creates an array containing a range (can be either ascending or descending)\n * of numbers specified by the arguments provided (e.g. `NDArray.range(0, .5, 2)`\n * gives an array containing all numbers in the interval `[0, 2)` separated by\n * steps of `0.5`)\n * @param {Number} start\n * @param {Number} step\n * @param {Number} stop\n * @returns {NDArray}\n * @example\n * import { range } from 'vectorious/core/range';\n * \n * range(1, 2, 9); // => array([1, 3, 5, 7])\n */\nexport const range = (...args: number[]): NDArray => {\n const type: TypedArrayConstructor = Float32Array;\n let backwards: boolean = false;\n let start: number;\n let step: number;\n let end: number;\n\n switch (args.length) {\n case 2:\n end = args.pop() as number;\n step = 1;\n start = args.pop() as number;\n break;\n case 3:\n end = args.pop() as number;\n step = args.pop() as number;\n start = args.pop() as number;\n break;\n default:\n throw new Error('invalid range');\n }\n\n if (end - start < 0) {\n const copy: number = end;\n end = start;\n start = copy;\n backwards = true;\n }\n\n if (step > end - start) {\n throw new Error('invalid range');\n }\n\n const data: TypedArray = new type(Math.ceil((end - start) / step));\n\n let i: number = start;\n let j: number = 0;\n\n if (backwards) {\n for (; i < end; i += step, j += 1) {\n data[j] = end - i + start;\n }\n } else {\n for (; i < end; i += step, j += 1) {\n data[j] = i;\n }\n }\n\n return new NDArray(data);\n};\n", "import {\n DType,\n INDArray,\n TypedArray,\n} from '../types';\nimport {\n flatten,\n get_dtype,\n get_length,\n get_shape,\n get_strides,\n get_type,\n is_typed_array,\n} from '../util';\nimport {\n NDIter,\n} from '../iterator';\n\nimport { default as abs } from './abs';\nimport { default as acos } from './acos';\nimport { default as acosh } from './acosh';\nimport { default as add } from './add';\nimport { default as angle } from './angle';\nimport { default as asin } from './asin';\nimport { default as asinh } from './asinh';\nimport { default as atan } from './atan';\nimport { default as atanh } from './atanh';\nimport { default as augment } from './augment';\nimport { default as binOp } from './binOp';\nimport { default as cbrt } from './cbrt';\nimport { default as ceil } from './ceil';\nimport { default as check } from './check';\nimport { default as combine } from './combine';\nimport { default as copy } from './copy';\nimport { default as cos } from './cos';\nimport { default as cosh } from './cosh';\nimport { default as cross } from './cross';\nimport { default as det } from './det';\nimport { default as diagonal } from './diagonal';\nimport { default as dot } from './dot';\nimport { default as eig } from './eig';\nimport { default as equals } from './equals';\nimport { default as equidimensional } from './equidimensional';\nimport { default as equilateral } from './equilateral';\nimport { default as exp } from './exp';\nimport { default as expm1 } from './expm1';\nimport { default as fill } from './fill';\nimport { default as floor } from './floor';\nimport { default as forEach } from './forEach';\nimport { default as fround } from './fround';\nimport { default as gauss } from './gauss';\nimport { default as get } from './get';\nimport { default as inv } from './inv';\nimport { default as log } from './log';\nimport { default as log10 } from './log10';\nimport { default as log1p } from './log1p';\nimport { default as log2 } from './log2';\nimport { default as lu } from './lu';\nimport { default as lu_factor } from './lu_factor';\nimport { default as map } from './map';\nimport { default as max } from './max';\nimport { default as mean } from './mean';\nimport { default as min } from './min';\nimport { default as multiply } from './multiply';\nimport { default as norm } from './norm';\nimport { default as normalize } from './normalize';\nimport { default as pow } from './pow';\nimport { default as prod } from './prod';\nimport { default as product } from './product';\nimport { default as project } from './project';\nimport { default as push } from './push';\nimport { default as rank } from './rank';\nimport { default as reciprocal } from './reciprocal';\nimport { default as reduce } from './reduce';\nimport { default as reshape } from './reshape';\nimport { default as round } from './round';\nimport { default as row_add } from './row_add';\nimport { default as scale } from './scale';\nimport { default as set } from './set';\nimport { default as sign } from './sign';\nimport { default as sin } from './sin';\nimport { default as sinh } from './sinh';\nimport { default as slice } from './slice';\nimport { default as solve } from './solve';\nimport { default as sqrt } from './sqrt';\nimport { default as square } from './square';\nimport { default as subtract } from './subtract';\nimport { default as sum } from './sum';\nimport { default as swap } from './swap';\nimport { default as tan } from './tan';\nimport { default as tanh } from './tanh';\nimport { default as toArray } from './toArray';\nimport { default as toString } from './toString';\nimport { default as trace } from './trace';\nimport { default as transpose } from './transpose';\nimport { default as trunc } from './trunc';\n\nconst inspectSymbol: unique symbol = Symbol.for('nodejs.util.inspect.custom');\n\n/**\n * @class NDArray\n * @description Constructs or copies an NDArray instance.\n * @param data\n * @param {Object} [options]\n * @param {Number[]} [options.shape]\n * @param {Number} [options.length]\n * @param {Number[]} [options.strides]\n * @param {string} [options.dtype]\n * @example\n * import { NDArray } from 'vectorious';\n *\n * new NDArray() // => array([], dtype=float64)\n * new NDArray([]) // => array([], dtype=float64)\n * new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)\n * new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)\n * new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)\n * new NDArray([1, 2, 3, 4], {\n * shape: [2, 2],\n * dtype: 'uint32'\n * }) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)\n */\nexport class NDArray implements INDArray {\n /**\n * @name data\n * @memberof NDArray.prototype\n * @type TypedArray\n * @default new Float64Array(0)\n */\n public data: TypedArray = new Float64Array(0);\n \n /**\n * @name dtype\n * @memberof NDArray.prototype\n * @type String\n * @default 'float64'\n */\n public dtype: DType = 'float64';\n\n /**\n * @name length\n * @memberof NDArray.prototype\n * @type Number\n * @default 0\n */\n public length: number = 0;\n\n /**\n * @name shape\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public shape: number[] = [0];\n\n /**\n * @name strides\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public strides: number[] = [0];\n\n public [inspectSymbol]: () => string = toString;\n public abs = abs;\n public acos = acos;\n public acosh = acosh;\n public add = add;\n public angle = angle;\n public asin = asin;\n public asinh = asinh;\n public atan = atan;\n public atanh = atanh;\n public augment = augment;\n public binOp = binOp;\n public cbrt = cbrt;\n public ceil = ceil;\n public check = check;\n public combine = combine;\n public copy = copy;\n public cos = cos;\n public cosh = cosh;\n public cross = cross;\n public det = det;\n public diagonal = diagonal;\n public dot = dot;\n public eig = eig;\n public equals = equals;\n public equidimensional = equidimensional;\n public equilateral = equilateral;\n public exp = exp;\n public expm1 = expm1;\n public fill = fill;\n public floor = floor;\n public forEach = forEach;\n public fround = fround;\n public gauss = gauss;\n public get = get;\n public inv = inv;\n public log = log;\n public log10 = log10;\n public log1p = log1p;\n public log2 = log2;\n public lu = lu;\n public lu_factor = lu_factor;\n public map = map;\n public max = max;\n public mean = mean;\n public min = min;\n public multiply = multiply;\n public norm = norm;\n public normalize = normalize;\n public pow = pow;\n public prod = prod;\n public product = product;\n public project = project;\n public push = push;\n public rank = rank;\n public reciprocal = reciprocal;\n public reduce = reduce;\n public reshape = reshape;\n public round = round;\n public row_add = row_add;\n public scale = scale;\n public set = set;\n public sign = sign;\n public sin = sin;\n public sinh = sinh;\n public slice = slice;\n public solve = solve;\n public sqrt = sqrt;\n public square = square;\n public subtract = subtract;\n public sum = sum;\n public swap = swap;\n public tan = tan;\n public tanh = tanh;\n public toArray = toArray;\n public toString = toString;\n public trace = trace;\n public transpose = transpose;\n public trunc = trunc;\n\n public constructor(\n data?: any,\n options?: {\n shape?: number[];\n length?: number;\n strides?: number[];\n dtype?: DType;\n }\n ) {\n if (!data) {\n return;\n }\n\n if (data instanceof NDArray) {\n return data;\n }\n\n if (data instanceof NDIter) {\n if (!options || !options.dtype) {\n throw new Error('dtype is missing');\n }\n\n if (data.shape) {\n options.shape = data.shape;\n }\n\n const length = data.length;\n data = new (get_type(options.dtype))(length);\n }\n\n const {\n shape = get_shape(data),\n length = get_length(shape),\n strides = get_strides(shape),\n dtype = get_dtype(data),\n } = options || {};\n\n this.data = is_typed_array(data) ? data : new (get_type(dtype))(flatten(data));\n this.shape = shape;\n this.length = length;\n this.dtype = dtype;\n this.strides = strides;\n }\n\n /**\n * @name x\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 0\n * @type Number\n */\n public get x(): number {\n return this.get(0);\n }\n\n public set x(value: number) {\n this.set(0, value);\n }\n\n /**\n * @name y\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 1\n * @type Number\n */\n public get y(): number {\n return this.get(1);\n }\n\n public set y(value: number) {\n this.set(1, value);\n }\n\n /**\n * @name z\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 2\n * @type Number\n */\n public get z(): number {\n return this.get(2);\n }\n\n public set z(value: number) {\n this.set(2, value);\n }\n\n /**\n * @name w\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 3\n * @type Number\n */\n public get w(): number {\n return this.get(3);\n }\n\n public set w(value: number) {\n this.set(3, value);\n }\n\n /**\n * @name T\n * @memberof NDArray.prototype\n * @description Short for this.copy().transpose()\n * @type NDArray\n */\n public get T() {\n return this.transpose();\n }\n}\n\nexport { abs } from './abs';\nexport { acos } from './acos';\nexport { acosh } from './acosh';\nexport { add } from './add';\nexport { angle } from './angle';\nexport { array } from './array';\nexport { asin } from './asin';\nexport { asinh } from './asinh';\nexport { atan } from './atan';\nexport { atanh } from './atanh';\nexport { augment } from './augment';\nexport { binOp } from './binOp';\nexport { cbrt } from './cbrt';\nexport { ceil } from './ceil';\nexport { check } from './check';\nexport { combine } from './combine';\nexport { copy } from './copy';\nexport { cos } from './cos';\nexport { cosh } from './cosh';\nexport { cross } from './cross';\nexport { det } from './det';\nexport { diagonal } from './diagonal';\nexport { dot } from './dot';\nexport { eig } from './eig';\nexport { equals } from './equals';\nexport { equidimensional } from './equidimensional';\nexport { equilateral } from './equilateral';\nexport { exp } from './exp';\nexport { expm1 } from './expm1';\nexport { eye } from './eye';\nexport { fill } from './fill';\nexport { floor } from './floor';\nexport { forEach } from './forEach';\nexport { fround } from './fround';\nexport { gauss } from './gauss';\nexport { get } from './get';\nexport { inv } from './inv';\nexport { log } from './log';\nexport { log10 } from './log10';\nexport { log1p } from './log1p';\nexport { log2 } from './log2';\nexport { lu } from './lu';\nexport { lu_factor } from './lu_factor';\nexport { magic } from './magic';\nexport { map } from './map';\nexport { matrix } from './matrix';\nexport { max } from './max';\nexport { mean } from './mean';\nexport { min } from './min';\nexport { multiply } from './multiply';\nexport { norm } from './norm';\nexport { normalize } from './normalize';\nexport { ones } from './ones';\nexport { pow } from './pow';\nexport { prod } from './prod';\nexport { product } from './product';\nexport { project } from './project';\nexport { push } from './push';\nexport { random } from './random';\nexport { range } from './range';\nexport { rank } from './rank';\nexport { reciprocal } from './reciprocal';\nexport { reduce } from './reduce';\nexport { reshape } from './reshape';\nexport { round } from './round';\nexport { row_add } from './row_add';\nexport { scale } from './scale';\nexport { set } from './set';\nexport { sign } from './sign';\nexport { sin } from './sin';\nexport { sinh } from './sinh';\nexport { slice } from './slice';\nexport { solve } from './solve';\nexport { sqrt } from './sqrt';\nexport { square } from './square';\nexport { subtract } from './subtract';\nexport { sum } from './sum';\nexport { swap } from './swap';\nexport { tan } from './tan';\nexport { tanh } from './tanh';\nexport { toArray } from './toArray';\nexport { toString } from './toString';\nexport { trace } from './trace';\nexport { transpose } from './transpose';\nexport { trunc } from './trunc';\nexport { zeros } from './zeros';\n\ntry {\n (window as any).v = NDArray;\n} catch (error) {}\n"], - "mappings": "4kBAAA,krCCMO,GAAM,GAAsC,AAAC,GAClD,EAAM,OACJ,CAAC,EAAY,IAAqB,EAAI,OAAO,MAAM,QAAQ,GAAQ,EAAQ,GAAQ,GACnF,IAGS,EAA0C,AAAC,GACtD,YAAY,OAAO,IAAU,CAAE,aAAiB,WAErC,EAA0C,AAAC,GACtD,EAAM,OAAO,CAAC,EAAW,IAAsB,EAAI,EAAG,GAE3C,EAAsC,AAAC,GAAyB,MAAM,QAAQ,IAAU,EAAe,GAChH,CAAC,EAAM,QAAQ,OAAO,EAAU,EAAM,KACtC,GAES,EAA6C,AAAC,GACzD,CACE,GAAG,EACA,MAAM,GACN,IAAI,CAAC,EAAW,IAAsB,EACpC,MAAM,EAAI,GACV,OAAO,CAAC,EAAW,IAAsB,EAAI,EAAG,IAErD,GAGS,EAA0C,AAAC,GAA6B,CACnF,GAAM,CACJ,YAAa,CACX,OAAO,gBACL,IACF,GAAS,GAEb,OAAQ,OACD,YAAa,MAAO,WACpB,aAAc,MAAO,YACrB,aAAc,MAAO,YACrB,cAAe,MAAO,aACtB,aAAc,MAAO,YACrB,cAAe,MAAO,aACtB,oBAAqB,MAAO,aA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,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAI,CACb,MAAO,MAAK,cApOT,IAzHP,AAkKU,MAsRV,GAAI,CACF,AAAC,OAAe,EAAI,QACb,EAAP", + "sourcesContent": ["/**\n * @module Globals\n */\nexport * from './core';\nexport * from './iterator';\n", "import {\n DType,\n TypedArray,\n TypedArrayConstructor,\n} from './types';\n\nexport const flatten: (array: any[]) => number[] = (array: any[]): number[] =>\n array.reduce(\n (acc: any[], next: any): any[] => acc.concat(Array.isArray(next) ? flatten(next) : next),\n []\n );\n\nexport const is_typed_array: (array: any) => boolean = (array: any): boolean =>\n ArrayBuffer.isView(array) && !(array instanceof DataView);\n\nexport const get_length: (shape: number[]) => number = (shape: number[]): number =>\n shape.reduce((a: number, b: number): number => a * b, 1);\n\nexport const get_shape: (array: any) => number[] = (array: any): number[] => Array.isArray(array) || is_typed_array(array)\n ? [array.length].concat(get_shape(array[0]))\n : [];\n\nexport const get_strides: (shape: number[]) => number[] = (shape: number[]): number[] =>\n [\n ...shape\n .slice(1)\n .map((_: number, i: number): number => shape\n .slice(i + 1)\n .reduce((a: number, b: number): number => a * b, 1)\n ),\n 1,\n];\n\nexport const get_dtype: (array: TypedArray) => DType = (array: TypedArray): DType => {\n const {\n constructor: {\n name = 'Float32Array',\n } = {},\n } = array || {};\n\n switch (name) {\n case 'Int8Array': return 'int8';\n case 'Uint8Array': return 'uint8';\n case 'Int16Array': return 'int16';\n case 'Uint16Array': return 'uint16';\n case 'Int32Array': return 'int32';\n case 'Uint32Array': return 'uint32';\n case 'Uint8ClampedArray': return 'uint8c';\n case 'Float32Array': return 'float32';\n case 'Float64Array': return 'float64';\n default: return 'float64';\n }\n};\n\nexport const get_type: (dtype: DType) => TypedArrayConstructor = (dtype: DType): TypedArrayConstructor => {\n switch (dtype) {\n case 'int8': return Int8Array;\n case 'uint8': return Uint8Array;\n case 'int16': return Int16Array;\n case 'uint16': return Uint16Array;\n case 'int32': return Int32Array;\n case 'uint32': return Uint32Array;\n case 'uint8c': return Uint8ClampedArray;\n case 'float32': return Float32Array;\n case 'float64': return Float64Array;\n default: return Float64Array;\n }\n};", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function array\n * @description `array(...args)` is an alias for `new v(...args)`\n * @param {} ...args\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const array = (...args: any[]): NDArray => new NDArray(...args);\n", "import { NDArray } from '../';\nimport { array } from '../core/array';\n\nexport const V_MAXDIMS = 32;\n\n/**\n * @class NDIter\n * @description Constructs an NDIter instance.\n * @param {NDArray} x\n */\nexport class NDIter implements Iterator {\n /**\n * @name x\n * @memberof NDIter.prototype\n * @type NDArray\n */\n public x: NDArray;\n\n /**\n * @name shape\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name shapem1\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public shapem1: number[];\n\n /**\n * @name strides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public strides: number[];\n\n /**\n * @name backstrides\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public backstrides: number[];\n\n /**\n * @name length\n * @memberof NDIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name nd\n * @memberof NDIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name ndm1\n * @memberof NDIter.prototype\n * @type Number\n */\n public ndm1: number;\n\n /**\n * @name index\n * @memberof NDIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name coords\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public coords: number[];\n\n /**\n * @name pos\n * @memberof NDIter.prototype\n * @type Number\n */\n public pos: number;\n\n /**\n * @name factors\n * @memberof NDIter.prototype\n * @type Number[]\n */\n public factors: number[];\n\n /**\n * @name contiguous\n * @memberof NDIter.prototype\n * @type Boolean\n */\n public contiguous: boolean;\n\n constructor(x: NDArray | ArrayLike) {\n this.x = array(x);\n const {\n shape,\n strides,\n length,\n } = this.x;\n\n this.length = length;\n this.lengthm1 = length - 1;\n this.nd = shape.length;\n this.ndm1 = this.nd - 1;\n\n this.shape = Array(V_MAXDIMS).fill(0);\n this.strides = Array(V_MAXDIMS).fill(0);\n this.shapem1 = Array(V_MAXDIMS).fill(0);\n this.coords = Array(V_MAXDIMS).fill(0);\n this.backstrides = Array(V_MAXDIMS).fill(0);\n this.factors = Array(V_MAXDIMS).fill(0);\n\n if (this.nd !== 0) {\n this.factors[this.nd - 1] = 1;\n }\n\n this.contiguous = true;\n\n let stride = 1;\n let i;\n for (i = 0; i < this.nd; i += 1) {\n this.shape[i] = shape[i];\n this.shapem1[i] = shape[i] - 1;\n this.strides[i] = strides[i];\n this.backstrides[i] = strides[i] * this.shapem1[i];\n this.coords[i] = 0;\n\n // Check if C-contiguous\n if (shape[this.ndm1 - i] !== 1) {\n if (strides[i] !== stride) {\n this.contiguous = false;\n }\n\n stride *= shape[this.ndm1 - i];\n }\n\n if (i > 0) {\n this.factors[this.ndm1 - i] = this.factors[this.nd - i] * shape[this.nd - i];\n }\n }\n\n this.index = 0;\n this.pos = 0;\n }\n\n /**\n * @function done\n * @memberof NDIter.prototype\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDIter.prototype\n * @description Returns the current element of the iterator\n * @returns {Object} current\n * @returns {Number} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.current(); // { value: 1, done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next1d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 1 dimensional.\n */\n next1d() {\n const {\n strides,\n } = this;\n\n this.pos += strides[0];\n this.coords[0] += 1;\n }\n\n /**\n * @function nextcontiguous\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming its data is contiguous.\n */\n nextcontiguous() {\n this.pos += 1;\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator, assuming it is 2 dimensional.\n */\n next2d() {\n const {\n strides,\n shapem1,\n backstrides,\n } = this;\n\n if (this.coords[1] < shapem1[1]) {\n this.coords[1] += 1;\n this.pos += strides[1];\n } else {\n this.coords[1] = 0;\n this.coords[0] += 1;\n this.pos += strides[0] - backstrides[1];\n }\n }\n\n /**\n * @function next2d\n * @memberof NDIter.prototype\n * @description Steps to the next position in the iterator\n */\n nextnd() {\n const {\n ndm1,\n shapem1,\n strides,\n backstrides,\n } = this;\n\n let i;\n for (i = ndm1; i >= 0; i -= 1) {\n if (this.coords[i] < shapem1[i]) {\n this.coords[i] += 1;\n this.pos += strides[i];\n break;\n }\n\n this.coords[i] = 0;\n this.pos -= backstrides[i];\n }\n }\n\n /**\n * @function next\n * @memberof NDIter.prototype\n * @description\n * Steps to the next position in the iterator.\n * Returns the current index of the iterator, or undefined if done.\n * @returns {Object}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDIter } from 'vectorious/iterator';\n * \n * const iter = new NDIter(array([1, 2, 3]));\n * iter.next(); // { value: 2, done: false }\n * iter.next(); // { value: 3, done: false }\n * iter.next(); // { done: true }\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n ndm1,\n contiguous,\n } = this;\n\n if (ndm1 === 0) {\n this.next1d();\n } else if (contiguous) {\n this.nextcontiguous();\n } else if (ndm1 === 1) {\n this.next2d();\n } else {\n this.nextnd();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n\n/**\n * @class NDMultiIter\n * @description Constructs an NDMultiIter instance.\n * @param {NDArray[]} ...args\n */\nexport class NDMultiIter implements Iterator {\n /**\n * @name iters\n * @memberof NDMultiIter.prototype\n * @type NDIter[]\n */\n public iters: NDIter[];\n\n /**\n * @name shape\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public shape: number[];\n\n /**\n * @name nd\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public nd: number;\n\n /**\n * @name length\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public length: number;\n\n /**\n * @name lengthm1\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public lengthm1: number;\n\n /**\n * @name numiter\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public numiter: number;\n\n /**\n * @name index\n * @memberof NDMultiIter.prototype\n * @type Number\n */\n public index: number;\n\n /**\n * @name pos\n * @memberof NDMultiIter.prototype\n * @type Number[]\n */\n public pos: number[];\n\n constructor(...args: (NDArray | ArrayLike)[]) {\n this.iters = args.map(arg => new NDIter(arg));\n this.numiter = args.length;\n\n let i;\n let nd;\n for (i = 0, nd = 0; i < this.numiter; i += 1) {\n nd = Math.max(nd, this.iters[i].x.shape.length);\n }\n\n this.nd = nd;\n this.shape = Array(nd).fill(0);\n\n let it;\n let j;\n let k;\n let tmp;\n for (i = 0; i < nd; i += 1) {\n this.shape[i] = 1;\n for (j = 0; j < this.numiter; j += 1) {\n it = this.iters[j];\n k = i + it.x.shape.length - nd;\n if (k >= 0) {\n tmp = it.x.shape[k];\n if (tmp == 1) {\n continue;\n }\n if (this.shape[i] == 1) {\n this.shape[i] = tmp;\n\n } else if (this.shape[i] !== tmp) {\n throw new Error('shape mismatch');\n }\n }\n }\n }\n\n tmp = this.shape.reduce((acc, dim) => acc * dim, 1);\n\n this.length = tmp;\n this.lengthm1 = tmp - 1;\n\n for (i = 0; i < this.numiter; i += 1) {\n it = this.iters[i];\n it.nd = this.nd;\n it.ndm1 = this.nd - 1;\n it.length = tmp;\n it.lengthm1 = tmp - 1;\n\n nd = it.x.shape.length;\n if (nd !== 0) {\n it.factors[this.nd - 1] = 1;\n }\n\n for (j = 0; j < this.nd; j += 1) {\n it.shape[j] = this.shape[j];\n it.shapem1[j] = this.shape[j] - 1;\n k = j + nd - this.nd;\n\n if ((k < 0) || it.x.shape[k] !== this.shape[j]) {\n it.contiguous = false;\n it.strides[j] = 0;\n } else {\n it.strides[j] = it.x.strides[k];\n }\n\n it.backstrides[j] = it.strides[j] * it.shapem1[j];\n\n if (j > 0) {\n it.factors[this.nd - j - 1] = it.factors[this.nd - j] * this.shape[this.nd - j]\n }\n }\n }\n\n this.index = 0;\n this.pos = Array(this.numiter).fill(0);\n }\n\n /**\n * @function done\n * @memberof NDMultiIter\n * @description Returns true if the iterator is done, false otherwise\n * @returns {Boolean}\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.done(); // false\n */\n done() {\n return this.index > this.lengthm1;\n }\n\n /**\n * @function current\n * @memberof NDMultiIter\n * @description Returns the current indices of the iterators\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.current(); // { value: [0, 0], done: false }\n */\n current(): IteratorResult {\n const done = this.done();\n return {\n value: done ? undefined : this.pos,\n done,\n }\n }\n\n /**\n * @function next\n * @memberof NDMultiIter\n * @description\n * Steps to the next position in the iterator.\n * Returns the current indices of the iterators, or undefined if done.\n * @returns {Object} current\n * @returns {Number[]} [current.value]\n * @returns {Boolean} current.done\n * @example\n * import { array } from 'vectorious/core/array';\n * import { NDMultiIter } from 'vectorious/iterator';\n * \n * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));\n * iter.next(); // { value: [0, 0], done: false }\n * iter.next(); // { value: [1, 1], done: false }\n * iter.next(); // { value: [2, 2], done: false },\n * iter.next(); // { value: undefined, done: true },\n */\n next() {\n const current = this.current();\n\n this.index += 1;\n\n const {\n numiter,\n } = this;\n\n let it;\n let i;\n for (i = 0; i < numiter; i += 1) {\n it = this.iters[i];\n this.pos[i] = it.pos;\n it.next();\n }\n\n return current;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { abs: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function abs\n * @description Returns the absolute value of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { abs } from 'vectorious/core/abs';\n * \n * abs([-1, -2, -3]) // => array([1, 2, 3])\n */\nexport const abs = (x: NDArray | ArrayLike): NDArray => array(x).abs();\n\n/**\n * @function abs\n * @memberof NDArray.prototype\n * @description Returns the absolute value of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, -2, -3]).abs() // <=> array([1, 2, 3])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acos\n * @description Returns the arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acos } from 'vectorious/core/acos';\n * \n * acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport const acos = (x: NDArray | ArrayLike): NDArray => array(x).acos();\n\n/**\n * @function acos\n * @memberof NDArray.prototype\n * @description Returns the arccosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])\n */\nexport default function (this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { acosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function acosh\n * @description Returns the hyperbolic arccosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { acosh } from 'vectorious/core/acosh';\n * \n * acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport const acosh = (x: NDArray | ArrayLike): NDArray => array(x).acosh();\n\n/**\n * @function acosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arccosine of each element of current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nblas: any;\ntry {\n nblas = require('nblas');\n} catch (err) {}\n\nexport const NoTrans = nblas && nblas.NoTrans;\nexport const Trans = nblas && nblas.Trans;\n\nexport function axpy(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.daxpy(n, alpha, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.saxpy(n, alpha, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function dot(dtype: DType, n: number, x: TypedArray, inc_x: number, y: TypedArray, inc_y: number) {\n if (x.length / inc_x !== n || y.length / inc_y !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.ddot(n, x, inc_x, y, inc_y);\n case 'float32':\n return nblas.sdot(n, x, inc_x, y, inc_y);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function iamax(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.idamax(n, x, inc_x);\n case 'float32':\n return nblas.isamax(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gemm(dtype: DType, transx: number, transy: number, m: number, n: number, k: number, alpha: number, x: TypedArray, ldx: number, y: TypedArray, ldy: number, beta: number, z: TypedArray, ldz: number) {\n const { length: l1 } = x;\n const { length: l2 } = y;\n const { length: l3 } = z;\n\n if ((transx === nblas.NoTrans && l1 !== ldx * m) || (transx === nblas.Trans && l1 !== ldx * k)) {\n throw new Error('lengths do not match');\n }\n\n if ((transy === nblas.NoTrans && l2 !== ldy * k) || (transy === nblas.Trans && l2 !== ldy * n)) {\n throw new Error('lengths do not match');\n }\n\n if (l3 !== ldz * m) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n case 'float32':\n return nblas.sgemm(transx, transy, m, n, k, alpha, x, ldx, y, ldy, beta, z, ldz);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function nrm2(dtype: DType, n: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dnrm2(n, x, inc_x);\n case 'float32':\n return nblas.snrm2(n, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function scal(dtype: DType, n: number, alpha: number, x: TypedArray, inc_x: number) {\n if (x.length / inc_x !== n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nblas.dscal(n, alpha, x, inc_x);\n case 'float32':\n return nblas.sscal(n, alpha, x, inc_x);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function add\n * @description\n * Adds `y` multiplied by `alpha` to `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { add } from 'vectorious/core/add';\n * \n * add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])\n */\nexport const add = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, alpha: number = 1): NDArray =>\n array(x).add(array(y), alpha);\n\n/**\n * @function add\n * @memberof NDArray.prototype\n * @description\n * Adds `x` multiplied by `alpha` to the current array.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])\n */\nexport default function (this: NDArray, x: NDArray | ArrayLike, alpha: number = 1): NDArray {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = array(x);\n\n try {\n blas.axpy(dtype, l1, alpha, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n d1[i] += alpha * d2[j];\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\nconst { acos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function angle\n * @description Determines the angle between the `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {number}\n * @example\n * import { angle } from 'vectorious/core/angle';\n * \n * angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287\n */\nexport const angle = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).angle(array(y));\n\n/**\n * @function angle\n * @memberof NDArray.prototype\n * @description Determines the angle between the current vector and `x`.\n * @param {NDArray} x\n * @returns {number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): number {\n return f(this.dot(array(x)) / this.norm() / array(x).norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asin\n * @description Returns the arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asin } from 'vectorious/core/asin';\n * \n * asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport const asin = (x: NDArray | ArrayLike): NDArray => array(x).asin();\n\n/**\n * @function asin\n * @memberof NDArray.prototype\n * @description Returns the arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { asinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function asinh\n * @description Returns the hyperbolic arcsine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { asinh } from 'vectorious/core/asinh';\n * \n * asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport const asinh = (x: NDArray | ArrayLike): NDArray => array(x).asinh();\n\n/**\n * @function asinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arcsine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atan\n * @description Returns the arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atan } from 'vectorious/core/atan';\n * \n * atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport const atan = (x: NDArray | ArrayLike): NDArray => array(x).atan();\n\n/**\n * @function atan\n * @memberof NDArray.prototype\n * @description Returns the arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { atanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function atanh\n * @description Returns the hyperbolic arctangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { atanh } from 'vectorious/core/atanh';\n * \n * atanh([0, -0.5]); // => array([0, -0.5493061542510986])\n */\nexport const atanh = (x: NDArray | ArrayLike): NDArray => array(x).atanh();\n\n/**\n * @function atanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic arctangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function zeros\n * @description Creates an array containing zeros (`0`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { zeros } from 'vectorious/core/zeros';\n * \n * zeros(3); // => array([0, 0, 0])\n */\nexport const zeros = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(0);\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\n\n/**\n * @static\n * @memberof module:Globals\n * @function augment\n * @description Augments `x` and `y`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { augment } from 'vectorious/core/augment';\n * \n * augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])\n */\nexport const augment = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).augment(array(y));\n\n/**\n * @function augment\n * @memberof NDArray.prototype\n * @description Augments `x` with current matrix.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])\n */\nexport default function(this: NDArray, x: NDArray | ArrayLike): NDArray {\n const [r1, c1] = this.shape;\n const [r2, c2] = array(x).shape;\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n if (r2 === 0 || c2 === 0) {\n return this;\n }\n\n if (r1 !== r2) {\n throw new Error('rows do not match');\n }\n\n const y = zeros(r1, c1 + c2);\n const { data: d3 } = y;\n\n let i: number;\n let j: number;\n for (i = 0; i < r1; i += 1) {\n for (j = 0; j < c1; j += 1) {\n d3[i * (c1 + c2) + j] = d1[i * c1 + j];\n }\n }\n\n for (i = 0; i < r2; i += 1) {\n for (j = 0; j < c2; j += 1) {\n d3[i * (c1 + c2) + (j + c1)] = d2[i * c2 + j];\n }\n }\n\n return y;\n};\n", "\nimport { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function binOp\n * @description Perform binary operation `f` on `y` in `x`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { binOp } from 'vectorious/core/binOp';\n * \n * binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport const binOp = (\n x: NDArray | ArrayLike,\n y: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray => array(x).binOp(array(y), f);\n\n/**\n * @function binOp\n * @memberof NDArray.prototype\n * @description Perform binary operation `f` on `x` in the current array.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])\n */\nexport default function(\n this: NDArray,\n x: NDArray | ArrayLike,\n f: (\n a: number,\n b: number,\n index: number\n ) => number\n): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = array(x);\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i] = f(d1[i], d2[j], i);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cbrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cbrt\n * @description Returns the cube root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport const cbrt = (x: NDArray | ArrayLike): NDArray => array(x).cbrt();\n\n/**\n * @function cbrt\n * @memberof NDArray.prototype\n * @description Returns the cube root of each element of current array.\n * @returns {this}\n * @example\n * import { cbrt } from 'vectorious/core/cbrt';\n * \n * cbrt([1, 8, 27]); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { ceil: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function ceil\n * @description Returns smallest integer greater than or equal to of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { ceil } from 'vectorious/core/ceil';\n * \n * ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])\n */\nexport const ceil = (x: NDArray | ArrayLike): NDArray => array(x).ceil();\n\n/**\n * @function ceil\n * @memberof NDArray.prototype\n * @description Returns smallest integer greater than or equal to of each element of current array.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function check\n * @description Asserts if indices `i, j, ..., n` are within the bounds of `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { check } from 'vectorious/core/check';\n * \n * check([0.5, 1.5, 2.5], 3); // Error: index out of bounds\n */\nexport const check = (x: NDArray | ArrayLike, ...indices: number[]): void => {\n array(x).check(...indices);\n};\n\n/**\n * @function check\n * @memberof NDArray.prototype\n * @description Asserts if indices `i, j, ..., n` are within the bounds of current array\n * @param {Number[]} ...indices\n * @throws {Error} index out of bounds\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds\n */\nexport default function(this: NDArray, ...indices: number[]): void {\n const { shape: s1, length: l1 } = this;\n\n if (indices.length === 1) {\n const [i] = indices;\n if (i < 0 || i > l1 - 1 || !Number.isFinite(i)) {\n throw new Error('index out of bounds');\n }\n } else if (!s1.every((dim: number, i: number) =>\n dim > indices[i]\n && Number.isFinite(indices[i])\n && indices[i] >= 0\n )) {\n throw new Error('index out of bounds');\n }\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function combine\n * @description Combines the vector `x` with `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { combine } from 'vectorious/core/combine';\n * \n * combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport const combine = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).combine(array(y));\n\n/**\n * @function combine\n * @memberof NDArray.prototype\n * @description Combines the current vector with `x`\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n if (this.shape.length !== 1 && x.shape.length !== 1) {\n throw new Error('combine operation not permitted for multidimensional arrays');\n }\n\n const { length: l1, data: d1 } = this;\n const { length: l2, data: d2 } = x;\n\n if (l2 === 0) {\n return this;\n }\n\n if (l1 === 0) {\n this.data = new (get_type(x.dtype))(d2);\n this.length = l2;\n this.dtype = x.dtype;\n\n return this;\n }\n\n const l3: number = l1 + l2;\n const d3: TypedArray = new (get_type(this.dtype))(l3);\n\n d3.set(d1);\n d3.set(d2, l1);\n\n this.data = d3;\n this.length = l3;\n this.shape = [l3];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { NDMultiIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function copy\n * @description Makes a copy of `x`\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { copy } from 'vectorious/core/copy';\n * \n * copy([1, 2, 3]); // => array([1, 2, 3])\n */\nexport const copy = (x: NDArray | ArrayLike): NDArray => array(x).copy();\n\n/**\n * @function copy\n * @memberof NDArray.prototype\n * @description Makes a copy of the class and underlying data\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).copy(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const x = zeros(...this.shape);\n\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d2[j] = d1[i];\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cos: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cos\n * @description Returns the cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cos } from 'vectorious/core/cos';\n * \n * cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])\n */\nexport const cos = (x: NDArray | ArrayLike): NDArray => array(x).cos();\n\n/**\n * @function cos\n * @memberof NDArray.prototype\n * @description Returns the cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { cosh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function cosh\n * @description Returns the hyperbolic cosine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { cosh } from 'vectorious/core/cosh';\n * \n * cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport const cosh = (x: NDArray | ArrayLike): NDArray => array(x).cosh();\n\n/**\n * @function cosh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic cosine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function cross\n * @description\n * Computes the cross product of the `x` and the vector `y`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { cross } from 'vectorious/core/cross';\n * \n * cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])\n */\nexport const cross = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).cross(array(y));\n\n/**\n * @function cross\n * @memberof NDArray.prototype\n * @description\n * Computes the cross product of the current vector and the vector `x`\n * This operation can only calculated for vectors with three components.\n * Otherwise it throws an exception.\n * @param {NDArray} x\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== 3 || l2 !== 3) {\n throw new Error('vectors must have three components');\n }\n\n const c1: number = this.y * x.z - this.z * x.y;\n const c2: number = this.z * x.x - this.x * x.z;\n const c3: number = this.x * x.y - this.y * x.x;\n\n this.x = c1;\n this.y = c2;\n this.z = c3;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function det\n * @description Gets the determinant of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { det } from 'vectorious/core/det';\n * \n * det([[0, 1], [2, 3]]); // => -2\n */\nexport const det = (x: NDArray | ArrayLike): number => array(x).det();\n\n/**\n * @function det\n * @memberof NDArray.prototype\n * @description Gets the determinant of current matrix using LU factorization.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[0, 1], [2, 3]]).det(); // => -2\n */\nexport default function(this: NDArray): number {\n this.square();\n\n const [n] = this.shape;\n const [LU, ipiv] = this.copy().lu_factor();\n const { data: d1 } = LU;\n\n let product: number = 1;\n let sign: number = 1;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n product *= d1[i * n + i];\n if (i !== ipiv[i] - 1) {\n sign *= -1;\n }\n }\n\n return sign * product;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function diagonal\n * @description Gets the diagonal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { diagonal } from 'vectorious/core/diagonal';\n * \n * diagonal([[1, 2], [3, 4]]); // => array([1, 4])\n */\nexport const diagonal = (x: NDArray | ArrayLike): NDArray =>\n array(x).diagonal();\n\n/**\n * @function diagonal\n * @memberof NDArray.prototype\n * @description Gets the diagonal of current matrix.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).diagonal(); // => array([1, 4])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { length: l1 } = this;\n const [r, c] = this.shape;\n const l2: number = Math.min(r, c);\n\n return this.reshape(l1).slice(0, l1, l2 + 1);\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function dot\n * @description\n * Performs dot multiplication with `x` and `y`.\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {Number}\n * @example\n * import { dot } from 'vectorious/core/dot';\n * \n * dot([1, 2, 3], [4, 5, 6]); // => 32\n */\nexport const dot = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): number =>\n array(x).dot(array(y));\n\n/**\n * @function dot\n * @memberof NDArray.prototype\n * @description\n * Performs dot multiplication with `x` and current array\n * Accelerated with BLAS `?dot`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).dot([4, 5, 6]); // => 32\n */\nexport default function(this: NDArray, x: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n const { data: d2 } = x;\n\n let result: number = 0;\n try {\n result = blas.dot(dtype, l1, d2, 1, d1, 1);\n } catch (err) {\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n result += d1[i] * d2[j];\n }\n }\n\n return result;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function eye\n * @description Creates an identity matrix of size `n` and type `type`.\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { eye } from 'vectorious/core/eye';\n * \n * eye(2); // => array([[1, 0], [0, 1]])\n */\nexport const eye = (n: number): NDArray => {\n const x = new NDArray(new Float64Array(n * n), { shape: [n, n] });\n const { data: d1 } = x;\n\n let i: number;\n for (i = 0; i < n; i += 1) {\n d1[i * n + i] = 1;\n }\n\n return x;\n};\n", "import { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { zeros } from './zeros';\nimport { eye } from './eye';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\n/**\n * @ignore\n * \u250C \u2510 \u250C \u2510\u250C \u2510\n * \u2502Skl\u2502 \u2502c \u2212s\u2502\u2502Skl\u2502\n * \u2502 \u2502 := \u2502 \u2502\u2502 \u2502\n * \u2502Sij\u2502 \u2502s c\u2502\u2502Sij\u2502\n * \u2514 \u2518 \u2514 \u2518\u2514 \u2518\n */\nconst rotate:\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number) => void =\n (x: NDArray, c: number, s: number, k: number, l: number, i: number, j: number): void => {\n const [n] = x.shape;\n const { data: d1 } = x;\n const temp: number = d1[k * n + l];\n const tau: number = 1 / (c + s);\n\n d1[k * n + l] = temp - s * (d1[i * n + j] + tau * temp);\n d1[i * n + j] += s * (temp - tau * d1[i * n + j]);\n };\n\n/**\n * @static\n * @memberof module:Globals\n * @function eig\n * @description\n * Gets eigenvalues and eigenvectors of `x` using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { eig } from 'vectorious/core/eig';\n * \n * eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport const eig = (x: NDArray | ArrayLike): [NDArray, NDArray] => array(x).eig();\n\n/**\n * @function eig\n * @memberof NDArray.prototype\n * @description\n * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method.\n * Accelerated with LAPACK `?geev`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]\n */\nexport default function(this: NDArray): [NDArray, NDArray] {\n this.square();\n\n const [n] = this.shape;\n\n try {\n if (!['float32', 'float64'].includes(this.dtype)) {\n this.dtype = 'float32';\n this.data = get_type(this.dtype).from(this.data);\n }\n\n const jobvl: typeof nlapack.NDArrayEigenvector = nlapack.NoEigenvector;\n const jobvr: typeof nlapack.NDArrayEigenvector = nlapack.Eigenvector;\n\n const wr = zeros(n);\n const wi = zeros(n);\n\n const vl = zeros(n, n);\n const vr = zeros(n, n);\n\n const { data: d1 } = this;\n const { data: d2 } = wr;\n const { data: d3 } = wi;\n const { data: d4 } = vl;\n const { data: d5 } = vr;\n if (this.dtype === 'float64') {\n nlapack.dgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n if (this.dtype === 'float32') {\n nlapack.sgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);\n }\n\n return [wr, vr];\n } catch (err) {\n const { data: d1 } = this;\n const p = eye(n);\n\n let max = 0;\n let i = 0;\n let j = 0;\n let k = 0;\n let l = 0;\n\n do {\n // Find maximum off-diagonal element\n for (i = 0; i < n; i += 1) {\n for (j = i + 1; j < n; j += 1) {\n if (Math.abs(d1[i * n + j]) >= max) {\n max = Math.abs(d1[i * n + j]);\n k = i;\n l = j;\n }\n }\n }\n\n // Find c and s\n let t;\n if (Math.abs(d1[k * n + l]) < Math.abs(d1[l * n + l]) * 1e-36) {\n t = d1[k * n + l] / d1[l * n + l];\n } else {\n const phi = d1[l * n + l] / 2 * d1[k * n + l];\n t = 1 / (Math.abs(phi) + Math.sqrt(phi * phi + 1));\n }\n\n const c = 1 / Math.sqrt(t * t + 1);\n const s = t * c;\n\n const e = d1[k * n + l];\n d1[k * n + l] = 0;\n d1[k * n + k] -= t * e;\n d1[l * n + l] += t * e;\n\n // Rotate rows and columns k and l\n for (i = 0; i < k; i += 1) {\n rotate(this, c, s, i, k, i, l);\n }\n\n for (i = k + 1; i < l; i += 1) {\n rotate(this, c, s, k, i, i, l);\n }\n\n for (i = l + 1; i < n; i += 1) {\n rotate(this, c, s, k, i, l, i);\n }\n\n // Rotate eigenvectors\n for (i = 0; i < n; i += 1) {\n rotate(p, c, s, i, k, i, l);\n }\n } while (max >= 1e-9);\n\n return [this.diagonal(), p];\n }\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function equals\n * @description Checks if `x` and `y` are equal.\n * @param {NDArray} x\n * @param {NDArray} y\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * equals([1, 2, 3], [1, 2, 3]); // => true\n */\nexport const equals = (x: NDArray | ArrayLike, y: NDArray | ArrayLike, tolerance: number = 1e-6): boolean =>\n array(x).equals(array(y), tolerance);\n\n/**\n * @function equals\n * @memberof NDArray.prototype\n * @description Checks if current array and `x` are equal.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Boolean}\n * @example\n * import { equals } from 'vectorious/core/equals';\n * \n * array([1, 2, 3]).equals([1, 2, 3]); // => true\n */\nexport default function(this: NDArray, x: NDArray, tolerance: number = 1e-6): boolean {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n\n for (const [i, j] of iter) {\n if (Math.abs(d1[i] - d2[j]) > tolerance) {\n return false;\n }\n }\n\n return true;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equidimensional\n * @description Asserts if `x` and `y` have the same shape\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} shapes x and y do not match\n * @example\n * import { equidimensional } from 'vectorious/core/equidimensional';\n * \n * equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport const equidimensional = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equidimensional(array(y));\n};\n\n/**\n * @deprecated\n * @function equidimensional\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same shape\n * @param {NDArray} x\n * @throws {Error} shapes x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { shape: s1 } = this;\n const { shape: s2 } = x;\n\n if (!s1.every((dim: number, i: number) => dim === s2[i])) {\n throw new Error(`shapes ${s1} and ${s2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @deprecated\n * @static\n * @memberof module:Globals\n * @function equilateral\n * @description Asserts if `x` and `y` have the same length\n * @param {NDArray} x\n * @param {NDArray} y\n * @throws {Error} lengths x and y do not match\n * @example\n * import { equilateral } from 'vectorious/core/equilateral';\n * \n * equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport const equilateral = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): void => {\n array(x).equilateral(array(y));\n};\n\n/**\n * @deprecated\n * @function equilateral\n * @memberof NDArray.prototype\n * @description Asserts if current array and `x` have the same length\n * @param {NDArray} x\n * @throws {Error} lengths x and y do not match\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match\n */\nexport default function(this: NDArray, x: NDArray): void {\n const { length: l1 } = this;\n const { length: l2 } = x;\n\n if (l1 !== l2) {\n throw new Error(`lengths ${l1} and ${l2} do not match`);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { exp: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function exp\n * @description\n * Returns e^x of each element of `x`, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { exp } from 'vectorious/core/exp';\n * \n * exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport const exp = (x: NDArray | ArrayLike): NDArray => array(x).exp();\n\n/**\n * @function exp\n * @memberof NDArray.prototype\n * @description\n * Returns e^x of each element of current array, where x is the argument,\n * and e is Euler's constant (2.718\u2026), the base of the natural logarithm.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { expm1: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function expm1\n * @description Returns subtracting 1 from exp(x) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { expm1 } from 'vectorious/core/expm1';\n * \n * expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport const expm1 = (x: NDArray | ArrayLike): NDArray => array(x).expm1();\n\n/**\n * @function expm1\n * @memberof NDArray.prototype\n * @description Returns subtracting 1 from exp(x) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function fill\n * @description Fills `x` with a scalar value\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { fill } from 'vectorious/core/fill';\n * \n * fill([1, 2, 3], 0); // => array([0, 0, 0])\n */\nexport const fill = (\n x: NDArray | ArrayLike,\n value: number | ((index: number) => number) = 0\n): NDArray =>\n array(x).fill(value);\n\n/**\n * @function fill\n * @memberof NDArray.prototype\n * @description Fills the current array with a scalar value\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])\n */\nexport default function(this: NDArray, value: number | ((index: number) => number) = 0): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = value instanceof Function ? value(iter.pos) : value;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { floor: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function floor\n * @description Returns the largest integer less than or equal to a number of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { floor } from 'vectorious/core/floor';\n * \n * floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])\n */\nexport const floor = (x: NDArray | ArrayLike): NDArray => array(x).floor();\n\n/**\n * @function floor\n * @memberof NDArray.prototype\n * @description Returns the largest integer less than or equal to a number of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function forEach\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {NDArray} x\n * @param {Function} f\n * @example\n * import { forEach } from 'vectorious/core/forEach';\n * \n * forEach([1, 2, 3], console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport const forEach = (\n x: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void => {\n x.forEach(f);\n};\n\n/**\n * @function forEach\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.forEach`.\n * @param {Function} f\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).forEach(console.log);\n * // 1 0 [ 1, 2, 3 ]\n * // 2 1 [ 1, 2, 3 ]\n * // 3 2 [ 1, 2, 3 ]\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => void\n): void {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n f.call(this, d1[i!], i!, d1);\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { fround: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function fround\n * @description Returns the nearest single precision float representation of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { fround } from 'vectorious/core/fround';\n * \n * fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])\n */\nexport const fround = (x: NDArray | ArrayLike): NDArray => array(x).fround();\n\n/**\n * @function fround\n * @memberof NDArray.prototype\n * @description Returns the nearest single precision float representation of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import {\n TypedArray,\n DType,\n} from './types';\n\nlet nlapack: any;\ntry {\n nlapack = require('nlapack');\n} catch (err) {}\n\nexport function getrf(dtype: DType, m: number, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== m * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetrf(m, n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetrf(m, n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function getri(dtype: DType, n: number, x: TypedArray, ldx: number, ipiv: Int32Array) {\n if (x.length !== n * n) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgetri(n, x, ldx, ipiv);\n case 'float32':\n return nlapack.sgetri(n, x, ldx, ipiv);\n default:\n throw new Error('wrong dtype');\n }\n}\n\nexport function gesv(dtype: DType, n: number, nrhs: number, x: TypedArray, ldx: number, ipiv: Int32Array, y: TypedArray, ldy: number) {\n if (x.length !== ldx * n || y.length !== ldy * nrhs) {\n throw new Error('lengths do not match');\n }\n\n switch (dtype) {\n case 'float64':\n return nlapack.dgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n case 'float32':\n return nlapack.sgesv(n, nrhs, x, ldx, ipiv, y, ldy);\n default:\n throw new Error('wrong dtype');\n }\n}\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n// import { diagonal } from './diagonal';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function gauss\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { gauss } from 'vectorious/core/gauss';\n * \n * gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])\n */\nexport const gauss = (x: NDArray | ArrayLike): NDArray => array(x).gauss();\n\n/**\n * @function gauss\n * @memberof NDArray.prototype\n * @description\n * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])\n */\nexport default function(this: NDArray): NDArray {\n const { shape: [r, c], data: d1, dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(Math.min(r, c));\n\n lapack.getrf(dtype, r, c, d1, c, ipiv);\n\n const iter = new NDIter(this);\n\n // Zero out lower triangular part of matrix\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d1[i!] = 0;\n }\n\n [ci, cj] = iter.coords;\n }\n } catch (err) {\n let lead: number = 0;\n let leadValue: number;\n let pivot: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (i = 0; i < r; i += 1) {\n if (c <= lead) {\n return this;\n }\n\n j = i;\n while (d1[j * c + lead] === 0) {\n j += 1;\n if (r === j) {\n j = i;\n lead += 1;\n\n if (c === lead) {\n return this;\n }\n }\n }\n\n if (i !== j) {\n this.swap(i, j);\n }\n\n pivot = d1[i * c + lead];\n if (pivot !== 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n\n for (j = 0; j < r; j += 1) {\n leadValue = d1[j * c + lead];\n if (j !== i) {\n for (k = 0; k < c; k += 1) {\n d1[j * c + k] -= d1[i * c + k] * leadValue;\n }\n }\n }\n\n lead += 1;\n }\n\n for (i = 0; i < r; i += 1) {\n pivot = 0;\n for (j = 0; j < c; j += 1) {\n if (pivot === 0) {\n pivot = d1[i * c + j];\n }\n }\n\n if (pivot === 0) {\n for (k = 0; k < c; k += 1) {\n d1[i * c + k] /= pivot;\n }\n }\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function get\n * @description Gets the element at `i, j, ..., n` from `x`\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { get } from 'vectorious/core/get';\n * \n * get([1, 2, 3], 2); // 3\n */\nexport const get = (x: NDArray | ArrayLike, ...indices: number[]): number =>\n array(x).get(...indices);\n\n/**\n * @function get\n * @memberof NDArray.prototype\n * @description Gets the element at `i, j, ..., n` from current vector.\n * @param {Number[]} ...indices\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).get(2); // 3\n */\nexport default function(this: NDArray, ...indices: number[]): number {\n this.check(...indices);\n\n const { data: d1, shape: s1 } = this;\n const { length: ndim } = s1;\n let index: number = indices[ndim - 1];\n\n let i: number;\n let j: number;\n for (i = 0; i < ndim - 1; i += 1) {\n let p: number = 1;\n for (j = i + 1; j < ndim; j += 1) {\n p *= s1[j];\n }\n\n index += indices[i] * p;\n }\n\n return d1[index];\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { eye } from './eye';\nimport { augment } from './augment';\nimport { zeros } from './zeros';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function inv\n * @description\n * Determines the inverse of `x`.\n * Accelerated with LAPACK `?getrf` and `?getri`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { inv } from 'vectorious/core/inv';\n * \n * inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport const inv = (x: NDArray | ArrayLike): NDArray => array(x).inv();\n\n/**\n * @function inv\n * @memberof NDArray.prototype\n * @description\n * Determines the inverse of current matrix using Gaussian elimination.\n * Accelerated with LAPACK `?getri`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])\n */\nexport default function(this: NDArray): NDArray {\n this.square();\n\n const { shape: [n], dtype } = this;\n\n try {\n const { data: d1 } = this;\n const ipiv = new Int32Array(n);\n\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n lapack.getri(dtype, n, d1, n, ipiv);\n\n return this;\n } catch (err) {\n const identity = eye(n);\n const rref = augment(this, identity).gauss();\n const left = zeros(n, n);\n const right = zeros(n, n);\n\n const { data: d1 } = rref;\n const { data: d2 } = left;\n const { data: d3 } = right;\n\n const iter = new NDIter(rref);\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < n) {\n d2[ci * n + cj] = d1[i!];\n } else {\n d3[ci * n + (cj - n)] = d1[i!];\n }\n\n [ci, cj] = iter.coords;\n }\n\n if (!left.equals(identity)) {\n throw new Error('matrix is not invertible');\n }\n\n return right;\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log\n * @description Returns the natural logarithm (log_e, also ln) of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log } from 'vectorious/core/log';\n * \n * log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport const log = (x: NDArray | ArrayLike): NDArray => array(x).log();\n\n/**\n * @function log\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log10: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log10\n * @description Returns the base 10 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log10 } from 'vectorious/core/log10';\n * \n * log10([10, 100, 1000]); // => array([1, 2, 3])\n */\nexport const log10 = (x: NDArray | ArrayLike): NDArray => array(x).log10();\n\n/**\n * @function log10\n * @memberof NDArray.prototype\n * @description Returns the base 10 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log1p: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log1p\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log1p } from 'vectorious/core/log1p';\n * \n * log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport const log1p = (x: NDArray | ArrayLike): NDArray => array(x).log1p();\n\n/**\n * @function log1p\n * @memberof NDArray.prototype\n * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { log2: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function log2\n * @description Returns the base 2 logarithm of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { log2 } from 'vectorious/core/log2';\n * \n * log2([1, 2, 4]); // => array([0, 1, 2])\n */\nexport const log2 = (x: NDArray | ArrayLike): NDArray => array(x).log2();\n\n/**\n * @function log2\n * @memberof NDArray.prototype\n * @description Returns the base 2 logarithm of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 4]).log2(); // => array([0, 1, 2])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu\n * @description\n * Performs full LU decomposition on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu } from 'vectorious/core/lu';\n * \n * lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu = (x: NDArray | ArrayLike): [NDArray, NDArray, Int32Array] =>\n array(x).lu();\n\n/**\n * @function lu\n * @memberof NDArray.prototype\n * @description\n * Performs full LU decomposition on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function (this: NDArray): [NDArray, NDArray, Int32Array] {\n const [LU, ipiv] = this.copy().lu_factor();\n const L = LU.copy();\n const U = LU.copy();\n const { data: d1 } = L;\n const { data: d2 } = U;\n\n const iter = new NDIter(LU);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (cj < ci) {\n d2[i!] = 0;\n } else {\n d1[i!] = ci === cj ? 1 : 0;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return [L, U, ipiv];\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function lu_factor\n * @description\n * Performs LU factorization on `x`.\n * Accelerated with LAPACK `?getrf`.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { lu_factor } from 'vectorious/core/lu_factor';\n * \n * lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport const lu_factor = (x: NDArray | ArrayLike): [NDArray, Int32Array] =>\n array(x).lu_factor();\n\n/**\n * @function lu_factor\n * @memberof NDArray.prototype\n * @description\n * Performs LU factorization on current matrix.\n * Accelerated with LAPACK `?getrf`.\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]\n */\nexport default function(this: NDArray): [NDArray, Int32Array] {\n const { data: d1, shape: [n], dtype } = this;\n const ipiv: Int32Array = new Int32Array(n);\n\n try {\n lapack.getrf(dtype, n, n, d1, n, ipiv);\n } catch (err) {\n let max: number;\n let abs: number;\n let diag: number;\n let p: number;\n\n let i: number;\n let j: number;\n let k: number;\n for (k = 0; k < n; k += 1) {\n p = k;\n max = Math.abs(d1[k * n + k]);\n for (j = k + 1; j < n; j += 1) {\n abs = Math.abs(d1[j * n + k]);\n if (max < abs) {\n max = abs;\n p = j;\n }\n }\n\n ipiv[k] = p + 1;\n\n if (p !== k) {\n this.swap(k, p);\n }\n\n diag = d1[k * n + k];\n for (i = k + 1; i < n; i += 1) {\n d1[i * n + k] /= diag;\n }\n\n for (i = k + 1; i < n; i += 1) {\n for (j = k + 1; j < n - 1; j += 2) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n d1[i * n + j + 1] -= d1[i * n + k] * d1[k * n + j + 1];\n }\n\n if (j === n - 1) {\n d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];\n }\n }\n }\n }\n\n return [this, ipiv];\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function map\n * @description Equivalent to `TypedArray.prototype.map`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { map } from 'vectorious/core/map';\n * \n * map([1, 2, 3], value => -value); // => array([-1, -2, -3])\n */\nexport const map = (\n x: NDArray | ArrayLike,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray => array(x).map(f);\n\n/**\n * @function map\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.map`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])\n */\nexport default function(\n this: NDArray,\n f: (value: number, i: number, src: TypedArray) => number\n): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n const map = f.bind(this);\n\n const copy = this.copy();\n const { data: d2 } = copy;\n\n for (const i of iter) {\n d2[i!] = map(d1[i!], i!, d1);\n }\n\n return copy;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function max\n * @description\n * Gets the maximum value (largest) element of `x`.\n * Accelerated with BLAS `i?amax`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { max } from 'vectorious/core/max';\n * \n * max([1, 2, 3]); // => 3\n */\nexport const max = (x: NDArray | ArrayLike): number => array(x).max();\n\n/**\n * @function max\n * @memberof NDArray.prototype\n * @description\n * Gets the maximum value (smallest) element of current array.\n * Accelerated with BLAS `i?amax`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).max(); // => 3\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let max: number = Number.NEGATIVE_INFINITY;\n\n try {\n max = d1[blas.iamax(dtype, l1, d1, 1)];\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n const value = d1[i!];\n if (max < value) {\n max = value;\n }\n }\n }\n\n return max;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function mean\n * @description Gets the arithmetic mean of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { mean } from 'vectorious/core/mean';\n * \n * mean([1, 2, 3]); // => 2\n */\nexport const mean = (x: NDArray | ArrayLike): number => array(x).mean();\n\n/**\n * @function mean\n * @memberof NDArray.prototype\n * @description Gets the arithmetic mean of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).mean(); // => 2\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1 } = this;\n const iter = new NDIter(this);\n\n let mean: number = 0;\n for (const i of iter) {\n mean += d1[i!];\n }\n\n return mean / l1;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function min\n * @description Gets the minimum value (smallest) element of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { min } from 'vectorious/core/min';\n * \n * min([1, 2, 3]); // => 1\n */\nexport const min = (x: NDArray | ArrayLike): number => array(x).min();\n\n/**\n * @function min\n * @memberof NDArray.prototype\n * @description Gets the minimum value (smallest) element of current array.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).min(); // 1\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n\n const iter = new NDIter(this);\n\n let min: number = Number.POSITIVE_INFINITY;\n for (const i of iter) {\n const value = d1[i!];\n if (min > value) {\n min = value;\n }\n }\n\n return min;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function matrix\n * @description Creates a matrix of `r` rows and `c` columns.\n * @param {Number} r\n * @param {Number} c\n * @returns {NDArray}\n * @example\n * import { matrix } from 'vectorious/core/matrix';\n * \n * matrix(2, 2); // => array([[0, 0], [0, 0]])\n */\nexport const matrix = (r: number, c: number): NDArray =>\n new NDArray(\n new Float64Array(r * c),\n { shape: [r, c] }\n );\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\nimport { matrix } from './matrix';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function multiply\n * @description\n * Multiplies two matrices `x` and `y` of matching dimensions.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { multiply } from 'vectorious/core/multiply';\n * \n * multiply([[1, 2]], [[1], [2]]); // => array([[5]])\n */\nexport const multiply = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).multiply(array(y));\n\n/**\n * @function multiply\n * @memberof NDArray.prototype\n * @description\n * Multiplies current matrix with `x`.\n * Accelerated with BLAS `?gemm`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { shape: [r1, c1], data: d1, dtype } = this;\n const { shape: [r2, c2], data: d2 } = x;\n\n if (c1 !== r2) {\n throw new Error('sizes do not match');\n }\n\n const y = matrix(r1, c2);\n const { data: d3 } = y;\n\n try {\n blas.gemm(dtype, blas.NoTrans, blas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);\n } catch (err) {\n const iter = new NDIter(y);\n\n let k;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n let sum = 0;\n for (k = 0; k < c1; k += 1) {\n sum += d1[ci * c1 + k] * d2[k * c2 + cj];\n }\n\n d3[i!] = sum;\n [ci, cj] = iter.coords;\n }\n }\n\n return y;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as blas from '../blas';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function norm\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { norm } from 'vectorious/core/norm';\n * \n * norm([1, 2, 3]); // => 3.7416574954986572\n */\nexport const norm = (x: NDArray | ArrayLike): number => array(x).norm();\n\n/**\n * @function norm\n * @memberof NDArray.prototype\n * @description\n * Calculates the norm of current array (also called L2 norm or Euclidean length).\n * Accelerated with BLAS `?nrm2`.\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).norm(); // => 3.7416574954986572\n */\nexport default function(this: NDArray): number {\n const { data: d1, length: l1, dtype } = this;\n let result: number = 0;\n\n try {\n result = blas.nrm2(dtype, l1, d1, 1);\n } catch (err) {\n result = f(this.dot(this));\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function normalize\n * @description Normalizes `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { normalize } from 'vectorious/core/normalize';\n * \n * normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport const normalize = (x: NDArray | ArrayLike): NDArray =>\n array(x).normalize();\n\n/**\n * @function normalize\n * @memberof NDArray.prototype\n * @description Normalizes current vector.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])\n */\nexport default function(this: NDArray): NDArray {\n return this.scale(1 / this.norm());\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { pow: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function pow\n * @description Returns each element of `x` to the exponent power, that is, element^exponent.\n * @param {NDArray} x\n * @param {Number} exponent\n * @returns {NDArray}\n * @example\n * import { pow } from 'vectorious/core/pow';\n * \n * pow([1, 2, 3], 2); // => array([1, 4, 9])\n */\nexport const pow = (x: NDArray | ArrayLike, exponent: number): NDArray =>\n array(x).pow(exponent);\n\n/**\n * @function pow\n * @memberof NDArray.prototype\n * @description Returns each element of current array to the exponent power, that is, element^exponent.\n * @param {Number} exponent\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])\n */\nexport default function(this: NDArray, exponent: number): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!], exponent);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function prod\n * @description Product of all elements of `x`.\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { prod } from 'vectorious/core/prod';\n * \n * prod([1, 2, 3]); // => 6\n */\nexport const prod = (x: NDArray | ArrayLike): number => array(x).prod();\n\n/**\n * @function prod\n * @memberof NDArray.prototype\n * @description Product of all elements of current array\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).prod(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let prod: number = 1;\n for (const i of iter) {\n prod *= d1[i!];\n }\n\n return prod;\n};\n", "import { NDArray } from './';\nimport { NDMultiIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function product\n * @description Hadamard product of `x` and `y`\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { product } from 'vectorious/core/product';\n * \n * product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])\n */\nexport const product = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).product(array(y));\n\n/**\n * @function product\n * @memberof NDArray.prototype\n * @description Hadamard product of current matrix and `x`\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1 } = this;\n const { data: d2 } = x;\n\n const iter = new NDMultiIter(this, x);\n for (const [i, j] of iter) {\n d1[i!] *= d2[j!];\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function project\n * @description Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { project } from 'vectorious/core/project';\n * \n * project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport const project = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).project(array(y));\n\n/**\n * @function project\n * @memberof NDArray.prototype\n * @description Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`.\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n return x.scale(this.dot(x) / x.dot(x));\n};\n", "import { TypedArray } from '../types';\nimport { get_type } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function push\n * @description Pushes a new `value` into `x`.\n * @param {NDArray} x\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { push } from 'vectorious/core/push';\n * \n * push([1, 2, 3], 4); // => array([1, 2, 3, 4])\n */\nexport const push = (x: NDArray | ArrayLike, value: number): NDArray =>\n array(x).push(value);\n\n/**\n * @function push\n * @memberof NDArray.prototype\n * @description Pushes a new `value` into current vector.\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])\n */\nexport default function(this: NDArray, value: number): NDArray {\n if (this.shape.length !== 1) {\n throw new Error('push operation not permitted for multidimensional arrays');\n }\n\n const { data: d1, length: l1 } = this;\n const l2: number = l1 + 1;\n const d2: TypedArray = new (get_type(this.dtype))(l2);\n\n d2.set(d1);\n d2[l1] = value;\n\n this.data = d2;\n this.length = l2;\n this.shape = [l2];\n\n return this;\n};\n", "import { NDArray } from './';\nimport { NDIter } from '../iterator';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function rank\n * @description Finds the rank of `x` using gaussian elimination.\n * @param {NDArray} x\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { rank } from 'vectorious/core/rank';\n * \n * rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1\n */\nexport const rank = (x: NDArray | ArrayLike, tolerance: number = 1e-6): number => array(x).rank(tolerance);\n\n/**\n * @function rank\n * @memberof NDArray.prototype\n * @description Finds the rank of current matrix using gaussian elimination.\n * @param {Number} tolerance\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1\n * @todo Switch to SVD algorithm\n */\nexport default function(this: NDArray, tolerance: number = 1e-6): number {\n const { data: d1 } = this.copy().gauss();\n\n const iter = new NDIter(this);\n\n let rk: number = 0;\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n if (rk <= ci && cj >= ci && d1[i!] > tolerance) {\n rk += 1;\n }\n\n [ci, cj] = iter.coords;\n }\n\n return rk;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reciprocal\n * @description Gets the element-wise reciprocal of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { reciprocal } from 'vectorious/core/reciprocal';\n * \n * reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport const reciprocal = (x: NDArray | ArrayLike): NDArray =>\n array(x).reciprocal();\n\n/**\n * @function reciprocal\n * @memberof NDArray.prototype\n * @description Gets the element-wise reciprocal of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = 1 / d1[i!];\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reduce\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {NDArray} x\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { reduce } from 'vectorious/core/reduce';\n * \n * reduce([1, 2, 3], (a, b) => a + b, 0); // => 6\n */\nexport const reduce = (\n x: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number => array(x).reduce(f, initialValue);\n\n/**\n * @function reduce\n * @memberof NDArray.prototype\n * @description Equivalent to `TypedArray.prototype.reduce`.\n * @param {Function} f\n * @param {Number} initialValue\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6\n */\nexport default function(\n this: NDArray,\n f: (acc: number, value: number, i: number, src: TypedArray) => number,\n initialValue?: number\n): number {\n const { data: d1, length: l1 } = this;\n if (l1 === 0 && typeof initialValue === 'undefined') {\n throw new Error('Reduce of empty array with no initial value.');\n }\n\n const iter = new NDIter(this);\n const reduce = f.bind(this);\n\n let value: number;\n\n if (typeof initialValue === 'undefined') {\n value = d1[0];\n iter.next();\n } else {\n value = initialValue;\n }\n\n for (const i of iter) {\n value = reduce(value, d1[i!], i!, d1);\n }\n\n return value;\n};\n", "import { get_strides } from '../util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function reshape\n * @description Reshapes `x`\n * @param {NDArray} x\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { reshape } from 'vectorious/core/reshape';\n * \n * reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])\n */\nexport const reshape = (x: NDArray | ArrayLike, ...shape: number[]): NDArray =>\n array(x).reshape(...shape);\n\n/**\n * @function reshape\n * @memberof NDArray.prototype\n * @description Reshapes current array\n * @param {Number[]} ...shape\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])\n */\nexport default function(this: NDArray, ...shape: number[]): NDArray {\n const { length } = this;\n if (shape.reduce((sum: number, dim: number) => sum * dim, 1) !== length) {\n throw new Error(`shape ${shape} does not match length ${length}`);\n }\n\n this.shape = shape;\n this.strides = get_strides(shape);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { round: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function round\n * @description Returns the value of each element of `x` rounded to the nearest integer.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { round } from 'vectorious/core/round';\n * \n * round([1.2, 2.8, 3.5]); // => array([1, 3, 4])\n */\nexport const round = (x: NDArray | ArrayLike): NDArray => array(x).round();\n\n/**\n * @function round\n * @memberof NDArray.prototype\n * @description Returns the value of each element of current array rounded to the nearest integer.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function row_add\n * @description Adds a multiple of one row multiplied by `scalar` to another inside `x`.\n * @param {NDArray} x\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { row_add } from 'vectorious/core/row_add';\n * \n * row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])\n */\nexport const row_add = (\n x: NDArray | ArrayLike,\n dest: number,\n source: number,\n scalar: number = 1\n): NDArray =>\n array(x).row_add(dest, source, scalar);\n\n/**\n * @function row_add\n * @memberof NDArray.prototype\n * @description Adds a multiple of one row multiplied by `scalar` to another inside current matrix.\n * @param {Number} dest\n * @param {Number} source\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])\n */\nexport default function(this: NDArray, dest: number, source: number, scalar: number = 1): NDArray {\n this.check(dest, 0);\n this.check(source, 0);\n\n const [, c] = this.shape;\n const { data: d1 } = this;\n\n let j: number;\n for (j = 0; j < c; j += 1) {\n d1[dest * c + j] += d1[source * c + j] * scalar;\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\nimport * as blas from '../blas';\n\n/**\n * @static\n * @memberof module:Globals\n * @function scale\n * @description\n * Multiplies all elements of `x` with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {NDArray} x\n * @param {Number} scalar\n * @returns {NDArray}\n * @example\n * import { scale } from 'vectorious/core/scale';\n * \n * scale([1, 2, 3], 2); // => array([2, 4, 6])\n */\nexport const scale = (x: NDArray | ArrayLike, scalar: number): NDArray =>\n array(x).scale(scalar);\n\n/**\n * @function scale\n * @memberof NDArray.prototype\n * @description\n * Multiplies all elements of current array with a specified `scalar`.\n * Accelerated with BLAS `?scal`.\n * @param {Number} scalar\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])\n */\nexport default function(this: NDArray, scalar: number): NDArray {\n const { data: d1, length: l1, dtype } = this;\n\n try {\n blas.scal(dtype, l1, scalar, d1, 1);\n } catch (err) {\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] *= scalar;\n }\n }\n\n return this;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function set\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {NDArray} x\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {NDArray}\n * @example\n * import { set } from 'vectorious/core/set';\n * \n * set([1, 2, 3], 1, 0); // => array([1, 0, 3])\n */\nexport const set = (x: NDArray, ...args: number[]): void => {\n x.set(...args);\n};\n\n/**\n * @function set\n * @memberof NDArray.prototype\n * @description Sets the element at `i, j, ..., n` to `value`.\n * @param {Number[]} ...indices\n * @param {Number} value\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])\n */\nexport default function(this: NDArray, ...args: number[]): void {\n const indices: number[] = args.slice(0, -1);\n const value: number = args[args.length - 1];\n\n this.check(...indices);\n\n const { shape: s1 } = this;\n let index: number = indices[indices.length - 1];\n\n let i: number;\n for (i = 0; i < indices.length - 1; i += 1) {\n index += indices[i] * s1[i + 1];\n }\n\n this.data[index] = value;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sign: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sign\n * @description\n * Returns the sign of each element of `x`, indicating\n * whether it is positive, negative or zero.\n * @param {Number} x\n * @returns {NDArray}\n * @example\n * import { sign } from 'vectorious/core/sign';\n * \n * sign([1, 2, 3]); // => array([1, 1, 1])\n */\nexport const sign = (x: NDArray | ArrayLike): NDArray => array(x).sign();\n\n/**\n * @function sign\n * @memberof NDArray.prototype\n * @description\n * Returns the sign of each element of current array, indicating\n * whether it is positive, negative or zero.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sign(); // <=> array([1, 1, 1])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sin: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sin\n * @description Returns the sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sin } from 'vectorious/core/sin';\n * \n * sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])\n */\nexport const sin = (x: NDArray | ArrayLike): NDArray => array(x).sin();\n\n/**\n * @function sin\n * @memberof NDArray.prototype\n * @description Returns the sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sinh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sinh\n * @description Returns the hyperbolic sine of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sinh } from 'vectorious/core/sinh';\n * \n * sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport const sinh = (x: NDArray | ArrayLike): NDArray => array(x).sinh();\n\n/**\n * @function sinh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic sine of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\nimport { get_length, get_strides } from '../util';\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function slice\n * @description Slices `x` in the corresponding dimension\n * @param {NDArray} x\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {NDArray}\n * @example\n * import { slice } from 'vectorious/core/slice';\n * \n * slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])\n */\nexport const slice = (\n x: NDArray | ArrayLike,\n begin?: number,\n end?: number,\n step?: number\n): NDArray =>\n array(x).slice(begin, end, step);\n\n/**\n * @function slice\n * @memberof NDArray.prototype\n * @description Slices the current array along the leading dimension\n * @param {Number} begin\n * @param {Number} end\n * @param {Number} step\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])\n */\nexport default function(\n this: NDArray,\n begin: number = 0,\n end: number = this.shape[0],\n step: number = 1\n): NDArray {\n const { data: d1, shape: s1 } = this;\n const nd = s1.length;\n\n if (begin < 0 || end < 0) {\n return this.slice(begin < 0 ? s1[s1.length - 1] + begin : begin, end < 0 ? s1[s1.length - 1] + end : end);\n }\n\n if (begin > end) {\n return this.slice(end, begin, step);\n }\n\n if (step <= 0) {\n throw new Error('step argument has to be a positive integer');\n }\n\n const s2: number[] = [Math.ceil((end - begin) / Math.abs(step)), ...s1.slice(1)];\n const l2: number = get_length(s2);\n const st2: number[] = get_strides(s2);\n const d2: TypedArray = nd > 1\n ? d1.subarray(begin * s2[s2.length - 1], end * s2[s2.length - 1])\n : d1.subarray(begin, end);\n\n st2[0] *= step;\n\n return new NDArray(d2, {\n shape: s2,\n length: l2,\n strides: st2,\n });\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport * as lapack from '../lapack';\n\n/**\n * @static\n * @memberof module:Globals\n * @function solve\n * @description\n * Solves the equation AX = B (where A is `x` and B is `y`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @param {NDArray} y\n * @returns {NDArray}\n * @example\n * import { solve } from 'vectorious/core/solve';\n * \n * solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport const solve = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).solve(array(y));\n\n/**\n * @function solve\n * @memberof NDArray.prototype\n * @description\n * Solves the equation AX = B (where A is current matrix and B is `x`).\n * Accelerated with LAPACK `?gesv`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])\n */\nexport default function(this: NDArray, x: NDArray): NDArray {\n const { data: d1, dtype } = this;\n const { data: d2, shape: [n, nrhs] } = x;\n\n try {\n const ipiv: Int32Array = new Int32Array(n);\n lapack.gesv(dtype, n, nrhs, d1, n, ipiv, d2, nrhs);\n } catch (err) {\n const [LU, ipiv] = this.lu_factor();\n const { data: d1 } = LU;\n const { data: d2 } = x;\n\n let i: number;\n let j: number;\n let k: number;\n\n for (i = 0; i < ipiv.length; i += 1) {\n if (i !== ipiv[i] - 1) {\n x.swap(i, ipiv[i] - 1);\n }\n }\n\n for (k = 0; k < nrhs; k += 1) {\n for (i = 0; i < n; i += 1) {\n for (j = 0; j < i; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n }\n\n for (i = n - 1; i >= 0; i -= 1) {\n for (j = i + 1; j < n; j += 1) {\n d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];\n }\n\n d2[i * nrhs + k] /= d1[i * n + i];\n }\n }\n }\n\n return x;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { sqrt: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function sqrt\n * @description Returns the positive square root of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { sqrt } from 'vectorious/core/sqrt';\n * \n * sqrt([1, 4, 9]); // => array([1, 2, 3])\n */\nexport const sqrt = (x: NDArray | ArrayLike): NDArray => array(x).sqrt();\n\n/**\n * @function sqrt\n * @memberof NDArray.prototype\n * @description Returns the positive square root of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 4, 9]); // <=> array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function square\n * @description Asserts if `x` is square.\n * @param {NDArray} x\n * @throws {Error} matrix is not square\n * @example\n * import { square } from 'vectorious/core/square';\n * \n * square([1, 2, 3]); // Error: matrix is not square\n */\nexport const square = (x: NDArray | ArrayLike): void => {\n array(x).square();\n};\n\n/**\n * @function square\n * @memberof NDArray.prototype\n * @description Asserts if current matrix is square.\n * @throws {Error} matrix is not square\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).square(); // Error: matrix is not square\n */\nexport default function(this: NDArray): void {\n const { length } = this.shape;\n const [r, c] = this.shape;\n\n if (length !== 2 || r !== c) {\n throw new Error('matrix is not square');\n }\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function subtract\n * @description\n * Subtracts `y` from `x`.\n * Accelerated with BLAS `?axpy`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { subtract } from 'vectorious/core/subtract';\n * \n * subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])\n */\nexport const subtract = (x: NDArray | ArrayLike, y: NDArray | ArrayLike): NDArray =>\n array(x).subtract(array(y));\n\n/**\n * @function subtract\n * @memberof NDArray.prototype\n * @description\n * Subtracts `x` from the current array.\n * Accelerated with BLAS `?axpy`.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])\n */\nexport default function (this: NDArray, x: NDArray): NDArray {\n return this.add(x, -1);\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function sum\n * @description Sum of `x`\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { sum } from 'vectorious/core/sum';\n * \n * sum([1, 2, 3]); // => 6\n */\nexport const sum = (x: NDArray | ArrayLike): number => array(x).sum();\n\n/**\n * @function sum\n * @memberof NDArray.prototype\n * @description Sum of array elements\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).sum(); // => 6\n */\nexport default function(this: NDArray): number {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n let sum: number = 0;\n for (const i of iter) {\n sum += d1[i!];\n }\n\n return sum;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function swap\n * @description Swaps two rows `i` and `j` in `x`.\n * @param {NDArray} x\n * @param {Number} i\n * @param {Number} j\n * @returns {NDArray}\n * @example\n * import { swap } from 'vectorious/core/swap';\n * \n * swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])\n */\nexport const swap = (x: NDArray | ArrayLike, i: number, j: number): NDArray =>\n array(x).swap(i, j);\n\n/**\n * @function swap\n * @memberof NDArray.prototype\n * @description Swaps two rows `i` and `j` in current matrix\n * @param {Number} i\n * @param {Number} j\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])\n */\nexport default function(this: NDArray, i: number, j: number): NDArray {\n this.check(i, 0);\n this.check(j, 0);\n\n const { data: d1 } = this;\n const [, c] = this.shape;\n const d2: TypedArray = d1.slice(i * c, (i + 1) * c);\n\n d1.copyWithin(i * c, j * c, (j + 1) * c);\n d1.set(d2, j * c);\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tan: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tan\n * @description Returns the tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tan } from 'vectorious/core/tan';\n * \n * tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport const tan = (x: NDArray | ArrayLike): NDArray => array(x).tan();\n\n/**\n * @function tan\n * @memberof NDArray.prototype\n * @description Returns the tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { tanh: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function tanh\n * @description Returns the hyperbolic tangent of each element of `x`.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { tanh } from 'vectorious/core/tanh';\n * \n * tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport const tanh = (x: NDArray | ArrayLike): NDArray => array(x).tanh();\n\n/**\n * @function tanh\n * @memberof NDArray.prototype\n * @description Returns the hyperbolic tangent of each element of current array.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toArray\n * @description Converts `x` into a JavaScript array.\n * @param {NDArray} x\n * @returns {Array}\n * @example\n * import { toArray } from 'vectorious/core/toArray';\n * \n * toArray([1, 2, 3]); // => [1, 2, 3]\n */\nexport const toArray = (x: NDArray | ArrayLike): any => array(x).toArray();\n\n/**\n * @function toArray\n * @memberof NDArray.prototype\n * @description Converts current vector into a JavaScript array.\n * @param {Number} index\n * @param {Number} dim\n * @returns {Array}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toArray(); // => [1, 2, 3]\n */\nexport default function(this: NDArray, index: number = 0, dim = 0): any {\n const { data: d1, shape: s1, strides: st1 } = this;\n const { length: ndim } = s1;\n\n if (dim >= ndim) {\n return d1[index];\n }\n\n const n = s1[dim];\n const stride = st1[dim];\n const list = [];\n\n for (let i = 0; i < n; i++) {\n const item = this.toArray(index, dim + 1);\n if (item === null) {\n return null;\n }\n\n list[i] = item;\n index += stride;\n }\n\n return list;\n};\n", "import { inspect } from 'util';\n\nimport { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function toString\n * @description Converts `x` into a readable formatted string.\n * @param {NDArray} x\n * @returns {String}\n * @example\n * import { toString } from 'vectorious/core/toString';\n * \n * toString([1, 2, 3]); // => '1,2,3'\n */\nexport const toString = (x: NDArray | ArrayLike): string => array(x).toString();\n\n/**\n * @function toString\n * @memberof NDArray.prototype\n * @description Converts current vector into a readable formatted string.\n * @returns {String}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).toString(); // => '1,2,3'\n */\nexport default function (this: NDArray): string {\n return `array(${inspect(this.toArray(), { depth: 10, breakLength: 40 })}, dtype=${this.dtype})`;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function trace\n * @description Gets the trace of `x` (the sum of all diagonal elements).\n * @param {NDArray} x\n * @returns {Number}\n * @example\n * import { trace } from 'vectorious/core/trace';\n * \n * trace([[1, 2], [3, 4]]); // => 5\n */\nexport const trace = (x: NDArray | ArrayLike): number => array(x).trace();\n\n/**\n * @function trace\n * @memberof NDArray.prototype\n * @description Gets the trace of the matrix (the sum of all diagonal elements).\n * @returns {Number}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1, 2, 3]).trace(); // => 5\n */\nexport default function(this: NDArray): number {\n const [r, c] = this.shape;\n const { data: d1 } = this;\n const n: number = Math.min(r, c);\n\n let result: number = 0;\n\n let j: number;\n for (j = 0; j < n; j += 1) {\n result += d1[j * c + j];\n }\n\n return result;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\n\n/**\n * @static\n * @memberof module:Globals\n * @function transpose\n * @description Transposes `x` (mirror across the diagonal).\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { transpose } from 'vectorious/core/transpose';\n * \n * transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport const transpose = (x: NDArray | ArrayLike): NDArray =>\n array(x).transpose();\n\n/**\n * @function transpose\n * @memberof NDArray.prototype\n * @description Transposes current matrix (mirror across the diagonal).\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])\n */\nexport default function(this: NDArray): NDArray {\n if (this.shape.length < 2) {\n return this;\n }\n\n let tmp = this.shape[0];\n this.shape[0] = this.shape[1];\n this.shape[1] = tmp;\n\n tmp = this.strides[0];\n this.strides[0] = this.strides[1];\n this.strides[1] = tmp;\n\n return this;\n};\n", "import { NDArray } from './';\nimport { array } from './array';\nimport { NDIter } from '../iterator';\n\nconst { trunc: f } = Math;\n\n/**\n * @static\n * @memberof module:Globals\n * @function trunc\n * @description\n * Returns the integer part of each element of `x`,\n * removing any fractional digits.\n * @param {NDArray} x\n * @returns {NDArray}\n * @example\n * import { trunc } from 'vectorious/core/trunc';\n * \n * trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])\n */\nexport const trunc = (x: NDArray | ArrayLike): NDArray => array(x).trunc();\n\n/**\n * @function trunc\n * @memberof NDArray.prototype\n * @description\n * Returns the integer part of each element of current array,\n * removing any fractional digits.\n * @returns {this}\n * @example\n * import { array } from 'vectorious/core/array';\n * \n * array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])\n */\nexport default function(this: NDArray): NDArray {\n const { data: d1 } = this;\n const iter = new NDIter(this);\n\n for (const i of iter) {\n d1[i!] = f(d1[i!]);\n }\n\n return this;\n};\n", "import { TypedArray } from '../types';\n\nimport { NDArray } from './';\nimport { NDIter } from '../iterator';\n\n/**\n * @static\n * @memberof module:Globals\n * @function magic\n * @description Creates a magic square matrix of size `n`\n * @param {Number} n\n * @returns {NDArray}\n * @example\n * import { magic } from 'vectorious/core/magic';\n * \n * magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])\n */\nexport const magic = (n: number): NDArray => {\n if (n < 0) {\n throw new Error('invalid n');\n }\n\n const d1: TypedArray = new Float64Array(n * n);\n const magic = new NDArray(d1, { shape: [n, n] });\n const iter = new NDIter(magic);\n\n let [ci, cj] = iter.coords;\n for (const i of iter) {\n const a = n - ci - 1;\n const b = n - cj - 1;\n\n d1[i!] = ((cj + a * 2 + 1) % n) * n + ((b + a * 2 + 1) % n) + 1;\n [ci, cj] = iter.coords;\n }\n\n return magic;\n};\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function ones\n * @description Creates an array containing ones (`1`) of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { ones } from 'vectorious/core/ones';\n * \n * ones(3); // => array([1, 1, 1])\n */\nexport const ones = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).fill(1);\n", "import { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function random\n * @description Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape`\n * @param {Number[]} ...shape\n * @returns {NDArray}\n * @example\n * import { random } from 'vectorious/core/random';\n * \n * random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])\n */\nexport const random = (...shape: number[]): NDArray =>\n new NDArray(\n new Float64Array(shape.reduce((sum: number, dim: number) => sum * dim, 1)),\n { shape }\n ).map(() => Math.random());\n", "import { TypedArray, TypedArrayConstructor } from '../types';\n\nimport { NDArray } from './';\n\n/**\n * @static\n * @memberof module:Globals\n * @function range\n * @description\n * Creates an array containing a range (can be either ascending or descending)\n * of numbers specified by the arguments provided (e.g. `NDArray.range(0, .5, 2)`\n * gives an array containing all numbers in the interval `[0, 2)` separated by\n * steps of `0.5`)\n * @param {Number} start\n * @param {Number} step\n * @param {Number} stop\n * @returns {NDArray}\n * @example\n * import { range } from 'vectorious/core/range';\n * \n * range(1, 2, 9); // => array([1, 3, 5, 7])\n */\nexport const range = (...args: number[]): NDArray => {\n const type: TypedArrayConstructor = Float32Array;\n let backwards: boolean = false;\n let start: number;\n let step: number;\n let end: number;\n\n switch (args.length) {\n case 2:\n end = args.pop() as number;\n step = 1;\n start = args.pop() as number;\n break;\n case 3:\n end = args.pop() as number;\n step = args.pop() as number;\n start = args.pop() as number;\n break;\n default:\n throw new Error('invalid range');\n }\n\n if (end - start < 0) {\n const copy: number = end;\n end = start;\n start = copy;\n backwards = true;\n }\n\n if (step > end - start) {\n throw new Error('invalid range');\n }\n\n const data: TypedArray = new type(Math.ceil((end - start) / step));\n\n let i: number = start;\n let j: number = 0;\n\n if (backwards) {\n for (; i < end; i += step, j += 1) {\n data[j] = end - i + start;\n }\n } else {\n for (; i < end; i += step, j += 1) {\n data[j] = i;\n }\n }\n\n return new NDArray(data);\n};\n", "import {\n DType,\n INDArray,\n TypedArray,\n} from '../types';\nimport {\n flatten,\n get_dtype,\n get_length,\n get_shape,\n get_strides,\n get_type,\n is_typed_array,\n} from '../util';\nimport {\n NDIter,\n} from '../iterator';\n\nimport { default as abs } from './abs';\nimport { default as acos } from './acos';\nimport { default as acosh } from './acosh';\nimport { default as add } from './add';\nimport { default as angle } from './angle';\nimport { default as asin } from './asin';\nimport { default as asinh } from './asinh';\nimport { default as atan } from './atan';\nimport { default as atanh } from './atanh';\nimport { default as augment } from './augment';\nimport { default as binOp } from './binOp';\nimport { default as cbrt } from './cbrt';\nimport { default as ceil } from './ceil';\nimport { default as check } from './check';\nimport { default as combine } from './combine';\nimport { default as copy } from './copy';\nimport { default as cos } from './cos';\nimport { default as cosh } from './cosh';\nimport { default as cross } from './cross';\nimport { default as det } from './det';\nimport { default as diagonal } from './diagonal';\nimport { default as dot } from './dot';\nimport { default as eig } from './eig';\nimport { default as equals } from './equals';\nimport { default as equidimensional } from './equidimensional';\nimport { default as equilateral } from './equilateral';\nimport { default as exp } from './exp';\nimport { default as expm1 } from './expm1';\nimport { default as fill } from './fill';\nimport { default as floor } from './floor';\nimport { default as forEach } from './forEach';\nimport { default as fround } from './fround';\nimport { default as gauss } from './gauss';\nimport { default as get } from './get';\nimport { default as inv } from './inv';\nimport { default as log } from './log';\nimport { default as log10 } from './log10';\nimport { default as log1p } from './log1p';\nimport { default as log2 } from './log2';\nimport { default as lu } from './lu';\nimport { default as lu_factor } from './lu_factor';\nimport { default as map } from './map';\nimport { default as max } from './max';\nimport { default as mean } from './mean';\nimport { default as min } from './min';\nimport { default as multiply } from './multiply';\nimport { default as norm } from './norm';\nimport { default as normalize } from './normalize';\nimport { default as pow } from './pow';\nimport { default as prod } from './prod';\nimport { default as product } from './product';\nimport { default as project } from './project';\nimport { default as push } from './push';\nimport { default as rank } from './rank';\nimport { default as reciprocal } from './reciprocal';\nimport { default as reduce } from './reduce';\nimport { default as reshape } from './reshape';\nimport { default as round } from './round';\nimport { default as row_add } from './row_add';\nimport { default as scale } from './scale';\nimport { default as set } from './set';\nimport { default as sign } from './sign';\nimport { default as sin } from './sin';\nimport { default as sinh } from './sinh';\nimport { default as slice } from './slice';\nimport { default as solve } from './solve';\nimport { default as sqrt } from './sqrt';\nimport { default as square } from './square';\nimport { default as subtract } from './subtract';\nimport { default as sum } from './sum';\nimport { default as swap } from './swap';\nimport { default as tan } from './tan';\nimport { default as tanh } from './tanh';\nimport { default as toArray } from './toArray';\nimport { default as toString } from './toString';\nimport { default as trace } from './trace';\nimport { default as transpose } from './transpose';\nimport { default as trunc } from './trunc';\n\nconst inspectSymbol: unique symbol = Symbol.for('nodejs.util.inspect.custom');\n\n/**\n * @class NDArray\n * @description Constructs or copies an NDArray instance.\n * @param data\n * @param {Object} [options]\n * @param {Number[]} [options.shape]\n * @param {Number} [options.length]\n * @param {Number[]} [options.strides]\n * @param {string} [options.dtype]\n * @example\n * import { NDArray } from 'vectorious';\n *\n * new NDArray() // => array([], dtype=float64)\n * new NDArray([]) // => array([], dtype=float64)\n * new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)\n * new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)\n * new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)\n * new NDArray([1, 2, 3, 4], {\n * shape: [2, 2],\n * dtype: 'uint32'\n * }) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)\n */\nexport class NDArray implements INDArray {\n /**\n * @name data\n * @memberof NDArray.prototype\n * @type TypedArray\n * @default new Float64Array(0)\n */\n public data: TypedArray = new Float64Array(0);\n \n /**\n * @name dtype\n * @memberof NDArray.prototype\n * @type String\n * @default 'float64'\n */\n public dtype: DType = 'float64';\n\n /**\n * @name length\n * @memberof NDArray.prototype\n * @type Number\n * @default 0\n */\n public length: number = 0;\n\n /**\n * @name shape\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public shape: number[] = [0];\n\n /**\n * @name strides\n * @memberof NDArray.prototype\n * @type Number[]\n * @default [0]\n */\n public strides: number[] = [0];\n\n public [inspectSymbol]: () => string = toString;\n public abs = abs;\n public acos = acos;\n public acosh = acosh;\n public add = add;\n public angle = angle;\n public asin = asin;\n public asinh = asinh;\n public atan = atan;\n public atanh = atanh;\n public augment = augment;\n public binOp = binOp;\n public cbrt = cbrt;\n public ceil = ceil;\n public check = check;\n public combine = combine;\n public copy = copy;\n public cos = cos;\n public cosh = cosh;\n public cross = cross;\n public det = det;\n public diagonal = diagonal;\n public dot = dot;\n public eig = eig;\n public equals = equals;\n public equidimensional = equidimensional;\n public equilateral = equilateral;\n public exp = exp;\n public expm1 = expm1;\n public fill = fill;\n public floor = floor;\n public forEach = forEach;\n public fround = fround;\n public gauss = gauss;\n public get = get;\n public inv = inv;\n public log = log;\n public log10 = log10;\n public log1p = log1p;\n public log2 = log2;\n public lu = lu;\n public lu_factor = lu_factor;\n public map = map;\n public max = max;\n public mean = mean;\n public min = min;\n public multiply = multiply;\n public norm = norm;\n public normalize = normalize;\n public pow = pow;\n public prod = prod;\n public product = product;\n public project = project;\n public push = push;\n public rank = rank;\n public reciprocal = reciprocal;\n public reduce = reduce;\n public reshape = reshape;\n public round = round;\n public row_add = row_add;\n public scale = scale;\n public set = set;\n public sign = sign;\n public sin = sin;\n public sinh = sinh;\n public slice = slice;\n public solve = solve;\n public sqrt = sqrt;\n public square = square;\n public subtract = subtract;\n public sum = sum;\n public swap = swap;\n public tan = tan;\n public tanh = tanh;\n public toArray = toArray;\n public toString = toString;\n public trace = trace;\n public transpose = transpose;\n public trunc = trunc;\n\n public constructor(\n data?: any,\n options?: {\n shape?: number[];\n length?: number;\n strides?: number[];\n dtype?: DType;\n }\n ) {\n if (!data) {\n return;\n }\n\n if (data instanceof NDArray) {\n return data;\n }\n\n if (data instanceof NDIter) {\n if (!options || !options.dtype) {\n throw new Error('dtype is missing');\n }\n\n if (data.shape) {\n options.shape = data.shape;\n }\n\n const length = data.length;\n data = new (get_type(options.dtype))(length);\n }\n\n const {\n shape = get_shape(data),\n length = get_length(shape),\n strides = get_strides(shape),\n dtype = get_dtype(data),\n } = options || {};\n\n this.data = is_typed_array(data) ? data : new (get_type(dtype))(flatten(data));\n this.shape = shape;\n this.length = length;\n this.dtype = dtype;\n this.strides = strides;\n }\n\n /**\n * @name x\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 0\n * @type Number\n */\n public get x(): number {\n return this.get(0);\n }\n\n public set x(value: number) {\n this.set(0, value);\n }\n\n /**\n * @name y\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 1\n * @type Number\n */\n public get y(): number {\n return this.get(1);\n }\n\n public set y(value: number) {\n this.set(1, value);\n }\n\n /**\n * @name z\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 2\n * @type Number\n */\n public get z(): number {\n return this.get(2);\n }\n\n public set z(value: number) {\n this.set(2, value);\n }\n\n /**\n * @name w\n * @memberof NDArray.prototype\n * @description Gets or sets the value at index 3\n * @type Number\n */\n public get w(): number {\n return this.get(3);\n }\n\n public set w(value: number) {\n this.set(3, value);\n }\n\n /**\n * @name T\n * @memberof NDArray.prototype\n * @description Short for `this.transpose()`\n * @type NDArray\n */\n public get T() {\n return this.transpose();\n }\n}\n\nexport { abs } from './abs';\nexport { acos } from './acos';\nexport { acosh } from './acosh';\nexport { add } from './add';\nexport { angle } from './angle';\nexport { array } from './array';\nexport { asin } from './asin';\nexport { asinh } from './asinh';\nexport { atan } from './atan';\nexport { atanh } from './atanh';\nexport { augment } from './augment';\nexport { binOp } from './binOp';\nexport { cbrt } from './cbrt';\nexport { ceil } from './ceil';\nexport { check } from './check';\nexport { combine } from './combine';\nexport { copy } from './copy';\nexport { cos } from './cos';\nexport { cosh } from './cosh';\nexport { cross } from './cross';\nexport { det } from './det';\nexport { diagonal } from './diagonal';\nexport { dot } from './dot';\nexport { eig } from './eig';\nexport { equals } from './equals';\nexport { equidimensional } from './equidimensional';\nexport { equilateral } from './equilateral';\nexport { exp } from './exp';\nexport { expm1 } from './expm1';\nexport { eye } from './eye';\nexport { fill } from './fill';\nexport { floor } from './floor';\nexport { forEach } from './forEach';\nexport { fround } from './fround';\nexport { gauss } from './gauss';\nexport { get } from './get';\nexport { inv } from './inv';\nexport { log } from './log';\nexport { log10 } from './log10';\nexport { log1p } from './log1p';\nexport { log2 } from './log2';\nexport { lu } from './lu';\nexport { lu_factor } from './lu_factor';\nexport { magic } from './magic';\nexport { map } from './map';\nexport { matrix } from './matrix';\nexport { max } from './max';\nexport { mean } from './mean';\nexport { min } from './min';\nexport { multiply } from './multiply';\nexport { norm } from './norm';\nexport { normalize } from './normalize';\nexport { ones } from './ones';\nexport { pow } from './pow';\nexport { prod } from './prod';\nexport { product } from './product';\nexport { project } from './project';\nexport { push } from './push';\nexport { random } from './random';\nexport { range } from './range';\nexport { rank } from './rank';\nexport { reciprocal } from './reciprocal';\nexport { reduce } from './reduce';\nexport { reshape } from './reshape';\nexport { round } from './round';\nexport { row_add } from './row_add';\nexport { scale } from './scale';\nexport { set } from './set';\nexport { sign } from './sign';\nexport { sin } from './sin';\nexport { sinh } from './sinh';\nexport { slice } from './slice';\nexport { solve } from './solve';\nexport { sqrt } from './sqrt';\nexport { square } from './square';\nexport { subtract } from './subtract';\nexport { sum } from './sum';\nexport { swap } from './swap';\nexport { tan } from './tan';\nexport { tanh } from './tanh';\nexport { toArray } from './toArray';\nexport { toString } from './toString';\nexport { trace } from './trace';\nexport { transpose } from './transpose';\nexport { trunc } from './trunc';\nexport { zeros } from './zeros';\n\ntry {\n (window as any).v = NDArray;\n} catch (error) {}\n"], + "mappings": "4kBAAA,krCCMO,GAAM,GAAsC,AAAC,GAClD,EAAM,OACJ,CAAC,EAAY,IAAqB,EAAI,OAAO,MAAM,QAAQ,GAAQ,EAAQ,GAAQ,GACnF,IAGS,EAA0C,AAAC,GACtD,YAAY,OAAO,IAAU,CAAE,aAAiB,WAErC,EAA0C,AAAC,GACtD,EAAM,OAAO,CAAC,EAAW,IAAsB,EAAI,EAAG,GAE3C,EAAsC,AAAC,GAAyB,MAAM,QAAQ,IAAU,EAAe,GAChH,CAAC,EAAM,QAAQ,OAAO,EAAU,EAAM,KACtC,GAES,EAA6C,AAAC,GACzD,CACE,GAAG,EACA,MAAM,GACN,IAAI,CAAC,EAAW,IAAsB,EACpC,MAAM,EAAI,GACV,OAAO,CAAC,EAAW,IAAsB,EAAI,EAAG,IAErD,GAGS,EAA0C,AAAC,GAA6B,CACnF,GAAM,CACJ,YAAa,CACX,OAAO,gBACL,IACF,GAAS,GAEb,OAAQ,OACD,YAAa,MAAO,WACpB,aAAc,MAAO,YACrB,aAAc,MAA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ACpB,EAAO,GAAK,GAAS,EAAQ,QAAQ,GAGvC,GAAM,CACJ,QAAQ,EAAU,GAClB,SAAS,EAAW,GACpB,UAAU,EAAY,GACtB,QAAQ,EAAU,IAChB,GAAW,GAEf,KAAK,KAAO,EAAe,GAAQ,EAAO,GAAK,GAAS,IAAQ,EAAQ,IACxE,KAAK,MAAQ,EACb,KAAK,OAAS,EACd,KAAK,MAAQ,EACb,KAAK,QAAU,KASN,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAY,CACrB,MAAO,MAAK,IAAI,MAGP,GAAE,EAAe,CAC1B,KAAK,IAAI,EAAG,MASH,IAAI,CACb,MAAO,MAAK,cApOT,IAzHP,AAkKU,MAsRV,GAAI,CACF,AAAC,OAAe,EAAI,QACb,EAAP", "names": [] } diff --git a/docs/vectorious/6.0.4/NDArray.html b/docs/vectorious/6.0.4/NDArray.html new file mode 100644 index 00000000..324fa37d --- /dev/null +++ b/docs/vectorious/6.0.4/NDArray.html @@ -0,0 +1,12042 @@ + + + + + Vectorious: NDArray + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

Class

+

NDArray

+ + + + + +
+ + +
+ + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+ +

new NDArray(data, optionsopt) +

+ + + + + +
+ +

Constructs or copies an NDArray instance.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + data + + + + + + + + + + + + + + + + +
    + +
  • + + + +
  • + + options + + + + + + + + Object + + + + + + + + + <optional>
    + + + + + +
    + + + + +
    + +

    Properties

    + + +
      + + +
    • + + shape + + + + + + + + Array.<Number> + + + + + + + + + <optional>
      + + + + + +
      + + + + +
      + +
    • + + + +
    • + + length + + + + + + + + Number + + + + + + + + + <optional>
      + + + + + +
      + + + + +
      + +
    • + + + +
    • + + strides + + + + + + + + Array.<Number> + + + + + + + + + <optional>
      + + + + + +
      + + + + +
      + +
    • + + + +
    • + + dtype + + + + + + + + string + + + + + + + + + <optional>
      + + + + + +
      + + + + +
      + +
    • + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { NDArray } from 'vectorious';
+
+new NDArray() // => array([], dtype=float64)
+new NDArray([]) // => array([], dtype=float64)
+new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)
+new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)
+new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)
+new NDArray([1, 2, 3, 4], {
+  shape: [2, 2],
+  dtype: 'uint32'
+}) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)
+ + + + + + + + + + + + + + +

Source

+ + + + + +
+ + + + + + + + + + + + + +

Members

+ + + + +
+
+ +
+

dataTypedArray

+ + + + + + +

Type

+
    +
  • + + + + + TypedArray + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

Default Value

+
    +
  • + new Float64Array(0) +
  • +
+ + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

dtypeString

+ + + + + + +

Type

+
    +
  • + + + + + String + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

Default Value

+
    +
  • + 'float64' +
  • +
+ + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

lengthNumber

+ + + + + + +

Type

+
    +
  • + + + + + Number + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

Default Value

+
    +
  • + 0 +
  • +
+ + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

shapeArray.<Number>

+ + + + + + +

Type

+
    +
  • + + + + + Array.<Number> + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

Default Value

+
    +
  • + [0] +
  • +
+ + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

stridesArray.<Number>

+ + + + + + +

Type

+
    +
  • + + + + + Array.<Number> + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +

Default Value

+
    +
  • + [0] +
  • +
+ + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

TNDArray

+ + + + +
+

Short for this.transpose()

+
+ + + +

Type

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

wNumber

+ + + + +
+

Gets or sets the value at index 3

+
+ + + +

Type

+
    +
  • + + + + + Number + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

xNumber

+ + + + +
+

Gets or sets the value at index 0

+
+ + + +

Type

+
    +
  • + + + + + Number + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

yNumber

+ + + + +
+

Gets or sets the value at index 1

+
+ + + +

Type

+
    +
  • + + + + + Number + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + +
+
+ +
+

zNumber

+ + + + +
+

Gets or sets the value at index 2

+
+ + + +

Type

+
    +
  • + + + + + Number + + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +

Source

+ + + +
+ + + + +

Methods

+ + + + + +
+ + + + + + + + + +
+ +
+ +

abs() → {this} +

+ + + + + +
+ +

Returns the absolute value of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([-1, -2, -3]).abs() // <=> array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

acos() → {this} +

+ + + + + +
+ +

Returns the arccosine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

acosh(x) → {this} +

+ + + + + +
+ +

Returns the hyperbolic arccosine of each element of current array.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

add(x) → {NDArray} +

+ + + + + +
+ +

Adds x multiplied by alpha to the current array. +Accelerated with BLAS ?axpy.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

angle(x) → {number} +

+ + + + + +
+ +

Determines the angle between the current vector and x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

asin() → {this} +

+ + + + + +
+ +

Returns the arcsine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

asinh() → {this} +

+ + + + + +
+ +

Returns the hyperbolic arcsine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

atan() → {this} +

+ + + + + +
+ +

Returns the arctangent of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

atanh() → {this} +

+ + + + + +
+ +

Returns the hyperbolic arctangent of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

augment(x) → {this} +

+ + + + + +
+ +

Augments x with current matrix.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

binOp(x) → {this} +

+ + + + + +
+ +

Perform binary operation f on x in the current array.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

cbrt() → {this} +

+ + + + + +
+ +

Returns the cube root of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { cbrt } from 'vectorious/core/cbrt';
+
+cbrt([1, 8, 27]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

ceil() → {NDArray} +

+ + + + + +
+ +

Returns smallest integer greater than or equal to of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

check() +

+ + + + + +
+ +

Asserts if indices i, j, ..., n are within the bounds of current array

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

index out of bounds

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

combine(x) → {this} +

+ + + + + +
+ +

Combines the current vector with x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

copy() → {NDArray} +

+ + + + + +
+ +

Makes a copy of the class and underlying data

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).copy(); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

cos() → {this} +

+ + + + + +
+ +

Returns the cosine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

cosh() → {this} +

+ + + + + +
+ +

Returns the hyperbolic cosine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

cross(x) → {this} +

+ + + + + +
+ +

Computes the cross product of the current vector and the vector x +This operation can only calculated for vectors with three components. +Otherwise it throws an exception.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

det() → {Number} +

+ + + + + +
+ +

Gets the determinant of current matrix using LU factorization.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[0, 1], [2, 3]]).det(); // => -2
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

diagonal() → {this} +

+ + + + + +
+ +

Gets the diagonal of current matrix.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).diagonal(); // => array([1, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

dot(x) → {Number} +

+ + + + + +
+ +

Performs dot multiplication with x and current array +Accelerated with BLAS ?dot.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).dot([4, 5, 6]); // => 32
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

eig() → {Array.<NDArray>} +

+ + + + + +
+ +

Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method. +Accelerated with LAPACK ?geev.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<NDArray> + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

equals(x, tolerance) → {Boolean} +

+ + + + + +
+ +

Checks if current array and x are equal.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + tolerance + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Boolean + + +
  • + +
+ + + + +

Example

+ +
import { equals } from 'vectorious/core/equals';
+
+array([1, 2, 3]).equals([1, 2, 3]); // => true
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

equidimensional(x) +

+ + + + + +
+ +

Asserts if current array and x have the same shape

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + +

Deprecated

+ +
  • Yes
+ + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

shapes x and y do not match

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

equilateral(x) +

+ + + + + +
+ +

Asserts if current array and x have the same length

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + +

Deprecated

+ +
  • Yes
+ + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

lengths x and y do not match

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

exp() → {this} +

+ + + + + +
+ +

Returns e^x of each element of current array, where x is the argument, +and e is Euler's constant (2.718…), the base of the natural logarithm.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

expm1() → {this} +

+ + + + + +
+ +

Returns subtracting 1 from exp(x) of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

fill(value) → {this} +

+ + + + + +
+ +

Fills the current array with a scalar value

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

floor() → {this} +

+ + + + + +
+ +

Returns the largest integer less than or equal to a number of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

forEach(f) +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.forEach.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + f + + + + + + + + function + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).forEach(console.log);
+// 1 0 [ 1, 2, 3 ]
+// 2 1 [ 1, 2, 3 ]
+// 3 2 [ 1, 2, 3 ]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

fround() → {this} +

+ + + + + +
+ +

Returns the nearest single precision float representation of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

gauss() → {NDArray} +

+ + + + + +
+ +

Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

get() → {Number} +

+ + + + + +
+ +

Gets the element at i, j, ..., n from current vector.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).get(2); // 3
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

inv() → {this} +

+ + + + + +
+ +

Determines the inverse of current matrix using Gaussian elimination. +Accelerated with LAPACK ?getri.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

log() → {this} +

+ + + + + +
+ +

Returns the natural logarithm (log_e, also ln) of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

log1p() → {this} +

+ + + + + +
+ +

Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

log2() → {this} +

+ + + + + +
+ +

Returns the base 2 logarithm of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 4]).log2(); // => array([0, 1, 2])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

log10() → {this} +

+ + + + + +
+ +

Returns the base 10 logarithm of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

lu() → {Array.<(NDArray|Int32Array)>} +

+ + + + + +
+ +

Performs full LU decomposition on current matrix. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<(NDArray|Int32Array)> + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

lu_factor() → {Array.<(NDArray|Int32Array)>} +

+ + + + + +
+ +

Performs LU factorization on current matrix. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<(NDArray|Int32Array)> + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

map() → {this} +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.map.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

max() → {Number} +

+ + + + + +
+ +

Gets the maximum value (smallest) element of current array. +Accelerated with BLAS i?amax.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).max(); // => 3
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

mean() → {Number} +

+ + + + + +
+ +

Gets the arithmetic mean of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).mean(); // => 2
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

min() → {Number} +

+ + + + + +
+ +

Gets the minimum value (smallest) element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).min(); // 1
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

multiply(x) → {NDArray} +

+ + + + + +
+ +

Multiplies current matrix with x. +Accelerated with BLAS ?gemm.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

norm() → {Number} +

+ + + + + +
+ +

Calculates the norm of current array (also called L2 norm or Euclidean length). +Accelerated with BLAS ?nrm2.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).norm(); // => 3.7416574954986572
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

normalize() → {this} +

+ + + + + +
+ +

Normalizes current vector.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

pow(exponent) → {this} +

+ + + + + +
+ +

Returns each element of current array to the exponent power, that is, element^exponent.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + exponent + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

prod() → {Number} +

+ + + + + +
+ +

Product of all elements of current array

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).prod(); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

product() → {NDArray} +

+ + + + + +
+ +

Hadamard product of current matrix and x

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

project() → {NDArray} +

+ + + + + +
+ +

Projects the current vector onto x using the projection formula (y * (x * y / y * y)).

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

push(value) → {this} +

+ + + + + +
+ +

Pushes a new value into current vector.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

rank(tolerance) → {Number} +

+ + + + + +
+ +

Finds the rank of current matrix using gaussian elimination.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + tolerance + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

To Do

+
    +
  • Switch to SVD algorithm
  • +
+ +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

reciprocal() → {this} +

+ + + + + +
+ +

Gets the element-wise reciprocal of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

reduce(f, initialValue) → {Number} +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.reduce.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + f + + + + + + + + function + + + + + + + + + +
    + +
  • + + + +
  • + + initialValue + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

reshape() → {this} +

+ + + + + +
+ +

Reshapes current array

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...shape + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

round() → {this} +

+ + + + + +
+ +

Returns the value of each element of current array rounded to the nearest integer.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

row_add(dest, source, scalar) → {this} +

+ + + + + +
+ +

Adds a multiple of one row multiplied by scalar to another inside current matrix.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + dest + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + source + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + scalar + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

scale(scalar) → {this} +

+ + + + + +
+ +

Multiplies all elements of current array with a specified scalar. +Accelerated with BLAS ?scal.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + scalar + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

set(value) → {this} +

+ + + + + +
+ +

Sets the element at i, j, ..., n to value.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

sign() → {this} +

+ + + + + +
+ +

Returns the sign of each element of current array, indicating +whether it is positive, negative or zero.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).sign(); // <=> array([1, 1, 1])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

sin() → {this} +

+ + + + + +
+ +

Returns the sine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

sinh() → {this} +

+ + + + + +
+ +

Returns the hyperbolic sine of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

slice(begin, end, step) → {this} +

+ + + + + +
+ +

Slices the current array along the leading dimension

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + begin + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + end + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + step + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

solve(x) → {NDArray} +

+ + + + + +
+ +

Solves the equation AX = B (where A is current matrix and B is x). +Accelerated with LAPACK ?gesv.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

sqrt() → {this} +

+ + + + + +
+ +

Returns the positive square root of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 4, 9]); // <=> array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

square() +

+ + + + + +
+ +

Asserts if current matrix is square.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).square(); // Error: matrix is not square
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

matrix is not square

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

subtract() → {this} +

+ + + + + +
+ +

Subtracts x from the current array. +Accelerated with BLAS ?axpy.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

sum() → {Number} +

+ + + + + +
+ +

Sum of array elements

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).sum(); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

swap(i, j) → {this} +

+ + + + + +
+ +

Swaps two rows i and j in current matrix

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + i + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + j + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

tan() → {this} +

+ + + + + +
+ +

Returns the tangent of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

tanh() → {this} +

+ + + + + +
+ +

Returns the hyperbolic tangent of each element of current array.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

toArray(index, dim) → {Array} +

+ + + + + +
+ +

Converts current vector into a JavaScript array.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + index + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + dim + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).toArray(); // => [1, 2, 3]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

toString() → {String} +

+ + + + + +
+ +

Converts current vector into a readable formatted string.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + String + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).toString(); // => '1,2,3'
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

trace() → {Number} +

+ + + + + +
+ +

Gets the trace of the matrix (the sum of all diagonal elements).

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]).trace(); // => 5
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

transpose() → {this} +

+ + + + + +
+ +

Transposes current matrix (mirror across the diagonal).

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

trunc() → {this} +

+ + + + + +
+ +

Returns the integer part of each element of current array, +removing any fractional digits.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + this + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + \ No newline at end of file diff --git a/docs/vectorious/6.0.4/NDIter.html b/docs/vectorious/6.0.4/NDIter.html new file mode 100644 index 00000000..abcf0fe1 --- /dev/null +++ b/docs/vectorious/6.0.4/NDIter.html @@ -0,0 +1,1088 @@ + + + + + Vectorious: NDIter + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

Class

+

NDIter

+ + + + + +
+ + +
+ + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+ +

new NDIter(x) +

+ + + + + +
+ +

Constructs an NDIter instance.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + + +
+ + + + + + + + + + + + + + + +

Methods

+ + + + + +
+ + + + + + + + + +
+ +
+ +

current() → {Object|Number|Boolean} +

+ + + + + +
+ +

Returns the current element of the iterator

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Object + + +

    current

    + +
  • + +
  • + + Number + + +

    [current.value]

    + +
  • + +
  • + + Boolean + + +

    current.done

    + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDIter } from 'vectorious/iterator';
+
+const iter = new NDIter(array([1, 2, 3]));
+iter.current(); // { value: 1, done: false }
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

done() → {Boolean} +

+ + + + + +
+ +

Returns true if the iterator is done, false otherwise

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Boolean + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDIter } from 'vectorious/iterator';
+
+const iter = new NDIter(array([1, 2, 3]));
+iter.done(); // false
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

next() → {Object} +

+ + + + + +
+ +

Steps to the next position in the iterator. +Returns the current index of the iterator, or undefined if done.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Object + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDIter } from 'vectorious/iterator';
+
+const iter = new NDIter(array([1, 2, 3]));
+iter.next(); // { value: 2, done: false }
+iter.next(); // { value: 3, done: false }
+iter.next(); // { done: true }
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

next1d() +

+ + + + + +
+ +

Steps to the next position in the iterator, assuming it is 1 dimensional.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

next2d() +

+ + + + + +
+ +

Steps to the next position in the iterator, assuming it is 2 dimensional.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

next2d() +

+ + + + + +
+ +

Steps to the next position in the iterator

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ +
+ +

nextcontiguous() +

+ + + + + +
+ +

Steps to the next position in the iterator, assuming its data is contiguous.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + \ No newline at end of file diff --git a/docs/vectorious/6.0.4/NDMultiIter.html b/docs/vectorious/6.0.4/NDMultiIter.html new file mode 100644 index 00000000..5a948581 --- /dev/null +++ b/docs/vectorious/6.0.4/NDMultiIter.html @@ -0,0 +1,701 @@ + + + + + Vectorious: NDMultiIter + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

Class

+

NDMultiIter

+ + + + + +
+ + +
+ + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+ +

new NDMultiIter() +

+ + + + + +
+ +

Constructs an NDMultiIter instance.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...args + + + + + + + + Array.<NDArray> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Source

+ + + + + +
+ + + + + + + + + + + + + + + +

Methods

+ + + + + +
+ + + + + + + + + +
+ static +
+ +

current() → {Object|Array.<Number>|Boolean} +

+ + + + + +
+ +

Returns the current indices of the iterators

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Object + + +

    current

    + +
  • + +
  • + + Array.<Number> + + +

    [current.value]

    + +
  • + +
  • + + Boolean + + +

    current.done

    + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDMultiIter } from 'vectorious/iterator';
+
+const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+iter.current(); // { value: [0, 0], done: false }
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

done() → {Boolean} +

+ + + + + +
+ +

Returns true if the iterator is done, false otherwise

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Boolean + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDMultiIter } from 'vectorious/iterator';
+
+const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+iter.done(); // false
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

next() → {Object|Array.<Number>|Boolean} +

+ + + + + +
+ +

Steps to the next position in the iterator. +Returns the current indices of the iterators, or undefined if done.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Object + + +

    current

    + +
  • + +
  • + + Array.<Number> + + +

    [current.value]

    + +
  • + +
  • + + Boolean + + +

    current.done

    + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+import { NDMultiIter } from 'vectorious/iterator';
+
+const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+iter.next(); // { value: [0, 0], done: false }
+iter.next(); // { value: [1, 1], done: false }
+iter.next(); // { value: [2, 2], done: false },
+iter.next(); // { value: undefined, done: true },
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + \ No newline at end of file diff --git a/docs/vectorious/6.0.4/core_abs.js.html b/docs/vectorious/6.0.4/core_abs.js.html new file mode 100644 index 00000000..54b5ed30 --- /dev/null +++ b/docs/vectorious/6.0.4/core_abs.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/abs.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/abs.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.abs = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { abs: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function abs
+ * @description Returns the absolute value of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { abs } from 'vectorious/core/abs';
+ *
+ * abs([-1, -2, -3]) // => array([1, 2, 3])
+ */
+const abs = (x) => array_1.array(x).abs();
+exports.abs = abs;
+/**
+ * @function abs
+ * @memberof NDArray.prototype
+ * @description Returns the absolute value of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([-1, -2, -3]).abs() // <=> array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_acos.js.html b/docs/vectorious/6.0.4/core_acos.js.html new file mode 100644 index 00000000..a09660ec --- /dev/null +++ b/docs/vectorious/6.0.4/core_acos.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/acos.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/acos.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.acos = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { acos: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function acos
+ * @description Returns the arccosine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { acos } from 'vectorious/core/acos';
+ *
+ * acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])
+ */
+const acos = (x) => array_1.array(x).acos();
+exports.acos = acos;
+/**
+ * @function acos
+ * @memberof NDArray.prototype
+ * @description Returns the arccosine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([-1, 0, 1]).acos(); // <=> array([3.141592653589793, 1.5707963267948966, 0])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_acosh.js.html b/docs/vectorious/6.0.4/core_acosh.js.html new file mode 100644 index 00000000..9ddcbe44 --- /dev/null +++ b/docs/vectorious/6.0.4/core_acosh.js.html @@ -0,0 +1,153 @@ + + + + + Vectorious: core/acosh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/acosh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.acosh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { acosh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function acosh
+ * @description Returns the hyperbolic arccosine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { acosh } from 'vectorious/core/acosh';
+ *
+ * acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])
+ */
+const acosh = (x) => array_1.array(x).acosh();
+exports.acosh = acosh;
+/**
+ * @function acosh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic arccosine of each element of current array.
+ * @param {NDArray} x
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).acosh(); // <=> array([0, 1.316957950592041, 1.7627471685409546])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_add.js.html b/docs/vectorious/6.0.4/core_add.js.html new file mode 100644 index 00000000..e420e167 --- /dev/null +++ b/docs/vectorious/6.0.4/core_add.js.html @@ -0,0 +1,183 @@ + + + + + Vectorious: core/add.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/add.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.add = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+const blas = __importStar(require("../blas"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function add
+ * @description
+ * Adds `y` multiplied by `alpha` to `x`.
+ * Accelerated with BLAS `?axpy`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { add } from 'vectorious/core/add';
+ *
+ * add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])
+ */
+const add = (x, y, alpha = 1) => array_1.array(x).add(array_1.array(y), alpha);
+exports.add = add;
+/**
+ * @function add
+ * @memberof NDArray.prototype
+ * @description
+ * Adds `x` multiplied by `alpha` to the current array.
+ * Accelerated with BLAS `?axpy`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).add([4, 5, 6]); // <=> array([5, 7, 9])
+ */
+function default_1(x, alpha = 1) {
+    const { data: d1, length: l1, dtype } = this;
+    const { data: d2 } = array_1.array(x);
+    try {
+        blas.axpy(dtype, l1, alpha, d2, 1, d1, 1);
+    }
+    catch (err) {
+        const iter = new iterator_1.NDMultiIter(this, x);
+        for (const [i, j] of iter) {
+            d1[i] += alpha * d2[j];
+        }
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_angle.js.html b/docs/vectorious/6.0.4/core_angle.js.html new file mode 100644 index 00000000..afffbd7e --- /dev/null +++ b/docs/vectorious/6.0.4/core_angle.js.html @@ -0,0 +1,148 @@ + + + + + Vectorious: core/angle.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/angle.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.angle = void 0;
+const array_1 = require("./array");
+const { acos: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function angle
+ * @description Determines the angle between the `x` and `y`
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {number}
+ * @example
+ * import { angle } from 'vectorious/core/angle';
+ *
+ * angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287
+ */
+const angle = (x, y) => array_1.array(x).angle(array_1.array(y));
+exports.angle = angle;
+/**
+ * @function angle
+ * @memberof NDArray.prototype
+ * @description Determines the angle between the current vector and `x`.
+ * @param {NDArray} x
+ * @returns {number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).angle([4, 5, 6]); // <=> 0.22572622788897287
+ */
+function default_1(x) {
+    return f(this.dot(array_1.array(x)) / this.norm() / array_1.array(x).norm());
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_array.js.html b/docs/vectorious/6.0.4/core_array.js.html new file mode 100644 index 00000000..6f57d7f3 --- /dev/null +++ b/docs/vectorious/6.0.4/core_array.js.html @@ -0,0 +1,130 @@ + + + + + Vectorious: core/array.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/array.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.array = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function array
+ * @description `array(...args)` is an alias for `new v(...args)`
+ * @param {} ...args
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]); // => array([1, 2, 3])
+ */
+const array = (...args) => new _1.NDArray(...args);
+exports.array = array;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_asin.js.html b/docs/vectorious/6.0.4/core_asin.js.html new file mode 100644 index 00000000..cf92f8de --- /dev/null +++ b/docs/vectorious/6.0.4/core_asin.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/asin.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/asin.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.asin = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { asin: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function asin
+ * @description Returns the arcsine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { asin } from 'vectorious/core/asin';
+ *
+ * asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])
+ */
+const asin = (x) => array_1.array(x).asin();
+exports.asin = asin;
+/**
+ * @function asin
+ * @memberof NDArray.prototype
+ * @description Returns the arcsine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([-1, 0, 1]).asin() // <=> array([-1.5707963705062866, 0, 1.5707963705062866])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_asinh.js.html b/docs/vectorious/6.0.4/core_asinh.js.html new file mode 100644 index 00000000..c9fb8ab3 --- /dev/null +++ b/docs/vectorious/6.0.4/core_asinh.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/asinh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/asinh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.asinh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { asinh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function asinh
+ * @description Returns the hyperbolic arcsine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { asinh } from 'vectorious/core/asinh';
+ *
+ * asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])
+ */
+const asinh = (x) => array_1.array(x).asinh();
+exports.asinh = asinh;
+/**
+ * @function asinh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic arcsine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0, 1, 2]).asinh() // <=> array([0, 0.8813735842704773, 1.4436354637145996])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_atan.js.html b/docs/vectorious/6.0.4/core_atan.js.html new file mode 100644 index 00000000..6786c2c0 --- /dev/null +++ b/docs/vectorious/6.0.4/core_atan.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/atan.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/atan.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.atan = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { atan: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function atan
+ * @description Returns the arctangent of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { atan } from 'vectorious/core/atan';
+ *
+ * atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])
+ */
+const atan = (x) => array_1.array(x).atan();
+exports.atan = atan;
+/**
+ * @function atan
+ * @memberof NDArray.prototype
+ * @description Returns the arctangent of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).atan() // <=> array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_atanh.js.html b/docs/vectorious/6.0.4/core_atanh.js.html new file mode 100644 index 00000000..56419425 --- /dev/null +++ b/docs/vectorious/6.0.4/core_atanh.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/atanh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/atanh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.atanh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { atanh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function atanh
+ * @description Returns the hyperbolic arctangent of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { atanh } from 'vectorious/core/atanh';
+ *
+ * atanh([0, -0.5]); // => array([0, -0.5493061542510986])
+ */
+const atanh = (x) => array_1.array(x).atanh();
+exports.atanh = atanh;
+/**
+ * @function atanh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic arctangent of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0, -0.5]).atanh(); // <=> array([0, -0.5493061542510986])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_augment.js.html b/docs/vectorious/6.0.4/core_augment.js.html new file mode 100644 index 00000000..ff1d7cf8 --- /dev/null +++ b/docs/vectorious/6.0.4/core_augment.js.html @@ -0,0 +1,172 @@ + + + + + Vectorious: core/augment.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/augment.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.augment = void 0;
+const array_1 = require("./array");
+const zeros_1 = require("./zeros");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function augment
+ * @description Augments `x` and `y`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { augment } from 'vectorious/core/augment';
+ *
+ * augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])
+ */
+const augment = (x, y) => array_1.array(x).augment(array_1.array(y));
+exports.augment = augment;
+/**
+ * @function augment
+ * @memberof NDArray.prototype
+ * @description Augments `x` with current matrix.
+ * @param {NDArray} x
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2], [3, 4]]).augment(array([[1], [2]])); // <=> array([[1, 2, 1], [3, 4, 2]])
+ */
+function default_1(x) {
+    const [r1, c1] = this.shape;
+    const [r2, c2] = array_1.array(x).shape;
+    const { data: d1 } = this;
+    const { data: d2 } = array_1.array(x);
+    if (r2 === 0 || c2 === 0) {
+        return this;
+    }
+    if (r1 !== r2) {
+        throw new Error('rows do not match');
+    }
+    const y = zeros_1.zeros(r1, c1 + c2);
+    const { data: d3 } = y;
+    let i;
+    let j;
+    for (i = 0; i < r1; i += 1) {
+        for (j = 0; j < c1; j += 1) {
+            d3[i * (c1 + c2) + j] = d1[i * c1 + j];
+        }
+    }
+    for (i = 0; i < r2; i += 1) {
+        for (j = 0; j < c2; j += 1) {
+            d3[i * (c1 + c2) + (j + c1)] = d2[i * c2 + j];
+        }
+    }
+    return y;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_binOp.js.html b/docs/vectorious/6.0.4/core_binOp.js.html new file mode 100644 index 00000000..7be7126c --- /dev/null +++ b/docs/vectorious/6.0.4/core_binOp.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/binOp.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/binOp.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.binOp = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function binOp
+ * @description Perform binary operation `f` on `y` in `x`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { binOp } from 'vectorious/core/binOp';
+ *
+ * binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])
+ */
+const binOp = (x, y, f) => array_1.array(x).binOp(array_1.array(y), f);
+exports.binOp = binOp;
+/**
+ * @function binOp
+ * @memberof NDArray.prototype
+ * @description Perform binary operation `f` on `x` in the current array.
+ * @param {NDArray} x
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).binOp([4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])
+ */
+function default_1(x, f) {
+    const { data: d1 } = this;
+    const { data: d2 } = array_1.array(x);
+    const iter = new iterator_1.NDMultiIter(this, x);
+    for (const [i, j] of iter) {
+        d1[i] = f(d1[i], d2[j], i);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_cbrt.js.html b/docs/vectorious/6.0.4/core_cbrt.js.html new file mode 100644 index 00000000..a222173d --- /dev/null +++ b/docs/vectorious/6.0.4/core_cbrt.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/cbrt.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/cbrt.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cbrt = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { cbrt: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function cbrt
+ * @description Returns the cube root of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { cbrt } from 'vectorious/core/cbrt';
+ *
+ * cbrt([1, 8, 27]); // => array([1, 2, 3])
+ */
+const cbrt = (x) => array_1.array(x).cbrt();
+exports.cbrt = cbrt;
+/**
+ * @function cbrt
+ * @memberof NDArray.prototype
+ * @description Returns the cube root of each element of current array.
+ * @returns {this}
+ * @example
+ * import { cbrt } from 'vectorious/core/cbrt';
+ *
+ * cbrt([1, 8, 27]); // => array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_ceil.js.html b/docs/vectorious/6.0.4/core_ceil.js.html new file mode 100644 index 00000000..f6dbe857 --- /dev/null +++ b/docs/vectorious/6.0.4/core_ceil.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/ceil.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/ceil.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ceil = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { ceil: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function ceil
+ * @description Returns smallest integer greater than or equal to of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { ceil } from 'vectorious/core/ceil';
+ *
+ * ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])
+ */
+const ceil = (x) => array_1.array(x).ceil();
+exports.ceil = ceil;
+/**
+ * @function ceil
+ * @memberof NDArray.prototype
+ * @description Returns smallest integer greater than or equal to of each element of current array.
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0.5, 1.5, 2.5]).ceil(); // <=> array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_check.js.html b/docs/vectorious/6.0.4/core_check.js.html new file mode 100644 index 00000000..6a30f414 --- /dev/null +++ b/docs/vectorious/6.0.4/core_check.js.html @@ -0,0 +1,160 @@ + + + + + Vectorious: core/check.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/check.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.check = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function check
+ * @description Asserts if indices `i, j, ..., n` are within the bounds of `x`
+ * @param {NDArray} x
+ * @param {Number[]} ...indices
+ * @throws {Error} index out of bounds
+ * @example
+ * import { check } from 'vectorious/core/check';
+ *
+ * check([0.5, 1.5, 2.5], 3); // Error: index out of bounds
+ */
+const check = (x, ...indices) => {
+    array_1.array(x).check(...indices);
+};
+exports.check = check;
+/**
+ * @function check
+ * @memberof NDArray.prototype
+ * @description Asserts if indices `i, j, ..., n` are within the bounds of current array
+ * @param {Number[]} ...indices
+ * @throws {Error} index out of bounds
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0.5, 1.5, 2.5]).check(3); // Error: index out of bounds
+ */
+function default_1(...indices) {
+    const { shape: s1, length: l1 } = this;
+    if (indices.length === 1) {
+        const [i] = indices;
+        if (i < 0 || i > l1 - 1 || !Number.isFinite(i)) {
+            throw new Error('index out of bounds');
+        }
+    }
+    else if (!s1.every((dim, i) => dim > indices[i]
+        && Number.isFinite(indices[i])
+        && indices[i] >= 0)) {
+        throw new Error('index out of bounds');
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_combine.js.html b/docs/vectorious/6.0.4/core_combine.js.html new file mode 100644 index 00000000..9f77e26f --- /dev/null +++ b/docs/vectorious/6.0.4/core_combine.js.html @@ -0,0 +1,169 @@ + + + + + Vectorious: core/combine.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/combine.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.combine = void 0;
+const util_1 = require("../util");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function combine
+ * @description Combines the vector `x` with `y`
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { combine } from 'vectorious/core/combine';
+ *
+ * combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])
+ */
+const combine = (x, y) => array_1.array(x).combine(array_1.array(y));
+exports.combine = combine;
+/**
+ * @function combine
+ * @memberof NDArray.prototype
+ * @description Combines the current vector with `x`
+ * @param {NDArray} x
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).combine([4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])
+ */
+function default_1(x) {
+    if (this.shape.length !== 1 && x.shape.length !== 1) {
+        throw new Error('combine operation not permitted for multidimensional arrays');
+    }
+    const { length: l1, data: d1 } = this;
+    const { length: l2, data: d2 } = x;
+    if (l2 === 0) {
+        return this;
+    }
+    if (l1 === 0) {
+        this.data = new (util_1.get_type(x.dtype))(d2);
+        this.length = l2;
+        this.dtype = x.dtype;
+        return this;
+    }
+    const l3 = l1 + l2;
+    const d3 = new (util_1.get_type(this.dtype))(l3);
+    d3.set(d1);
+    d3.set(d2, l1);
+    this.data = d3;
+    this.length = l3;
+    this.shape = [l3];
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_copy.js.html b/docs/vectorious/6.0.4/core_copy.js.html new file mode 100644 index 00000000..81f96a89 --- /dev/null +++ b/docs/vectorious/6.0.4/core_copy.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/copy.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/copy.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.copy = void 0;
+const array_1 = require("./array");
+const zeros_1 = require("./zeros");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function copy
+ * @description Makes a copy of `x`
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { copy } from 'vectorious/core/copy';
+ *
+ * copy([1, 2, 3]); // => array([1, 2, 3])
+ */
+const copy = (x) => array_1.array(x).copy();
+exports.copy = copy;
+/**
+ * @function copy
+ * @memberof NDArray.prototype
+ * @description Makes a copy of the class and underlying data
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).copy(); // => array([1, 2, 3])
+ */
+function default_1() {
+    const x = zeros_1.zeros(...this.shape);
+    const { data: d1 } = this;
+    const { data: d2 } = x;
+    const iter = new iterator_1.NDMultiIter(this, x);
+    for (const [i, j] of iter) {
+        d2[j] = d1[i];
+    }
+    return x;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_cos.js.html b/docs/vectorious/6.0.4/core_cos.js.html new file mode 100644 index 00000000..ab640090 --- /dev/null +++ b/docs/vectorious/6.0.4/core_cos.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/cos.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/cos.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cos = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { cos: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function cos
+ * @description Returns the cosine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { cos } from 'vectorious/core/cos';
+ *
+ * cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])
+ */
+const cos = (x) => array_1.array(x).cos();
+exports.cos = cos;
+/**
+ * @function cos
+ * @memberof NDArray.prototype
+ * @description Returns the cosine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0, Math.PI / 2, Math.PI]).cos(); // => array([1, 0, -1])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_cosh.js.html b/docs/vectorious/6.0.4/core_cosh.js.html new file mode 100644 index 00000000..2afb1492 --- /dev/null +++ b/docs/vectorious/6.0.4/core_cosh.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/cosh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/cosh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cosh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { cosh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function cosh
+ * @description Returns the hyperbolic cosine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { cosh } from 'vectorious/core/cosh';
+ *
+ * cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])
+ */
+const cosh = (x) => array_1.array(x).cosh();
+exports.cosh = cosh;
+/**
+ * @function cosh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic cosine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0, 1, 2]).cosh(); // => array([1, 1.5430806875228882, 3.762195587158203])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_cross.js.html b/docs/vectorious/6.0.4/core_cross.js.html new file mode 100644 index 00000000..e5cdc472 --- /dev/null +++ b/docs/vectorious/6.0.4/core_cross.js.html @@ -0,0 +1,164 @@ + + + + + Vectorious: core/cross.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/cross.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cross = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function cross
+ * @description
+ * Computes the cross product of the `x` and the vector `y`
+ * This operation can only calculated for vectors with three components.
+ * Otherwise it throws an exception.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { cross } from 'vectorious/core/cross';
+ *
+ * cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])
+ */
+const cross = (x, y) => array_1.array(x).cross(array_1.array(y));
+exports.cross = cross;
+/**
+ * @function cross
+ * @memberof NDArray.prototype
+ * @description
+ * Computes the cross product of the current vector and the vector `x`
+ * This operation can only calculated for vectors with three components.
+ * Otherwise it throws an exception.
+ * @param {NDArray} x
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).cross([4, 5, 6]); // <=> array([-3, 6, -3])
+ */
+function default_1(x) {
+    const { length: l1 } = this;
+    const { length: l2 } = x;
+    if (l1 !== 3 || l2 !== 3) {
+        throw new Error('vectors must have three components');
+    }
+    const c1 = this.y * x.z - this.z * x.y;
+    const c2 = this.z * x.x - this.x * x.z;
+    const c3 = this.x * x.y - this.y * x.x;
+    this.x = c1;
+    this.y = c2;
+    this.z = c3;
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_det.js.html b/docs/vectorious/6.0.4/core_det.js.html new file mode 100644 index 00000000..245952c2 --- /dev/null +++ b/docs/vectorious/6.0.4/core_det.js.html @@ -0,0 +1,158 @@ + + + + + Vectorious: core/det.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/det.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.det = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function det
+ * @description Gets the determinant of `x`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { det } from 'vectorious/core/det';
+ *
+ * det([[0, 1], [2, 3]]); // => -2
+ */
+const det = (x) => array_1.array(x).det();
+exports.det = det;
+/**
+ * @function det
+ * @memberof NDArray.prototype
+ * @description Gets the determinant of current matrix using LU factorization.
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[0, 1], [2, 3]]).det(); // => -2
+ */
+function default_1() {
+    this.square();
+    const [n] = this.shape;
+    const [LU, ipiv] = this.copy().lu_factor();
+    const { data: d1 } = LU;
+    let product = 1;
+    let sign = 1;
+    let i;
+    for (i = 0; i < n; i += 1) {
+        product *= d1[i * n + i];
+        if (i !== ipiv[i] - 1) {
+            sign *= -1;
+        }
+    }
+    return sign * product;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_diagonal.js.html b/docs/vectorious/6.0.4/core_diagonal.js.html new file mode 100644 index 00000000..259bcb8a --- /dev/null +++ b/docs/vectorious/6.0.4/core_diagonal.js.html @@ -0,0 +1,149 @@ + + + + + Vectorious: core/diagonal.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/diagonal.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.diagonal = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function diagonal
+ * @description Gets the diagonal of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { diagonal } from 'vectorious/core/diagonal';
+ *
+ * diagonal([[1, 2], [3, 4]]); // => array([1, 4])
+ */
+const diagonal = (x) => array_1.array(x).diagonal();
+exports.diagonal = diagonal;
+/**
+ * @function diagonal
+ * @memberof NDArray.prototype
+ * @description Gets the diagonal of current matrix.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).diagonal(); // => array([1, 4])
+ */
+function default_1() {
+    this.square();
+    const { length: l1 } = this;
+    const [r, c] = this.shape;
+    const l2 = Math.min(r, c);
+    return this.reshape(l1).slice(0, l1, l2 + 1);
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_dot.js.html b/docs/vectorious/6.0.4/core_dot.js.html new file mode 100644 index 00000000..e7a36fd6 --- /dev/null +++ b/docs/vectorious/6.0.4/core_dot.js.html @@ -0,0 +1,184 @@ + + + + + Vectorious: core/dot.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/dot.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.dot = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+const blas = __importStar(require("../blas"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function dot
+ * @description
+ * Performs dot multiplication with `x` and `y`.
+ * Accelerated with BLAS `?dot`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {Number}
+ * @example
+ * import { dot } from 'vectorious/core/dot';
+ *
+ * dot([1, 2, 3], [4, 5, 6]); // => 32
+ */
+const dot = (x, y) => array_1.array(x).dot(array_1.array(y));
+exports.dot = dot;
+/**
+ * @function dot
+ * @memberof NDArray.prototype
+ * @description
+ * Performs dot multiplication with `x` and current array
+ * Accelerated with BLAS `?dot`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).dot([4, 5, 6]); // => 32
+ */
+function default_1(x) {
+    const { data: d1, length: l1, dtype } = this;
+    const { data: d2 } = x;
+    let result = 0;
+    try {
+        result = blas.dot(dtype, l1, d2, 1, d1, 1);
+    }
+    catch (err) {
+        const iter = new iterator_1.NDMultiIter(this, x);
+        for (const [i, j] of iter) {
+            result += d1[i] * d2[j];
+        }
+    }
+    return result;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_eig.js.html b/docs/vectorious/6.0.4/core_eig.js.html new file mode 100644 index 00000000..f33742e2 --- /dev/null +++ b/docs/vectorious/6.0.4/core_eig.js.html @@ -0,0 +1,249 @@ + + + + + Vectorious: core/eig.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/eig.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.eig = void 0;
+const util_1 = require("../util");
+const array_1 = require("./array");
+const zeros_1 = require("./zeros");
+const eye_1 = require("./eye");
+let nlapack;
+try {
+    nlapack = require('nlapack');
+}
+catch (err) { }
+/**
+ * @ignore
+ *  ┌   ┐    ┌     ┐┌   ┐
+ *  │Skl│    │c  −s││Skl│
+ *  │   │ := │     ││   │
+ *  │Sij│    │s   c││Sij│
+ *  └   ┘    └     ┘└   ┘
+ */
+const rotate = (x, c, s, k, l, i, j) => {
+    const [n] = x.shape;
+    const { data: d1 } = x;
+    const temp = d1[k * n + l];
+    const tau = 1 / (c + s);
+    d1[k * n + l] = temp - s * (d1[i * n + j] + tau * temp);
+    d1[i * n + j] += s * (temp - tau * d1[i * n + j]);
+};
+/**
+ * @static
+ * @memberof module:Globals
+ * @function eig
+ * @description
+ * Gets eigenvalues and eigenvectors of `x` using the Jacobi method.
+ * Accelerated with LAPACK `?geev`.
+ * @param {NDArray} x
+ * @returns {Array<NDArray>}
+ * @example
+ * import { eig } from 'vectorious/core/eig';
+ *
+ * eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]
+ */
+const eig = (x) => array_1.array(x).eig();
+exports.eig = eig;
+/**
+ * @function eig
+ * @memberof NDArray.prototype
+ * @description
+ * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method.
+ * Accelerated with LAPACK `?geev`.
+ * @returns {Array<NDArray>}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 0, 0], [0, 2, 0], [0, 0, 3]]).eig(); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]
+ */
+function default_1() {
+    this.square();
+    const [n] = this.shape;
+    try {
+        if (!['float32', 'float64'].includes(this.dtype)) {
+            this.dtype = 'float32';
+            this.data = util_1.get_type(this.dtype).from(this.data);
+        }
+        const jobvl = nlapack.NoEigenvector;
+        const jobvr = nlapack.Eigenvector;
+        const wr = zeros_1.zeros(n);
+        const wi = zeros_1.zeros(n);
+        const vl = zeros_1.zeros(n, n);
+        const vr = zeros_1.zeros(n, n);
+        const { data: d1 } = this;
+        const { data: d2 } = wr;
+        const { data: d3 } = wi;
+        const { data: d4 } = vl;
+        const { data: d5 } = vr;
+        if (this.dtype === 'float64') {
+            nlapack.dgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);
+        }
+        if (this.dtype === 'float32') {
+            nlapack.sgeev(jobvl, jobvr, n, d1, n, d2, d3, d4, n, d5, n);
+        }
+        return [wr, vr];
+    }
+    catch (err) {
+        const { data: d1 } = this;
+        const p = eye_1.eye(n);
+        let max = 0;
+        let i = 0;
+        let j = 0;
+        let k = 0;
+        let l = 0;
+        do {
+            // Find maximum off-diagonal element
+            for (i = 0; i < n; i += 1) {
+                for (j = i + 1; j < n; j += 1) {
+                    if (Math.abs(d1[i * n + j]) >= max) {
+                        max = Math.abs(d1[i * n + j]);
+                        k = i;
+                        l = j;
+                    }
+                }
+            }
+            // Find c and s
+            let t;
+            if (Math.abs(d1[k * n + l]) < Math.abs(d1[l * n + l]) * 1e-36) {
+                t = d1[k * n + l] / d1[l * n + l];
+            }
+            else {
+                const phi = d1[l * n + l] / 2 * d1[k * n + l];
+                t = 1 / (Math.abs(phi) + Math.sqrt(phi * phi + 1));
+            }
+            const c = 1 / Math.sqrt(t * t + 1);
+            const s = t * c;
+            const e = d1[k * n + l];
+            d1[k * n + l] = 0;
+            d1[k * n + k] -= t * e;
+            d1[l * n + l] += t * e;
+            // Rotate rows and columns k and l
+            for (i = 0; i < k; i += 1) {
+                rotate(this, c, s, i, k, i, l);
+            }
+            for (i = k + 1; i < l; i += 1) {
+                rotate(this, c, s, k, i, i, l);
+            }
+            for (i = l + 1; i < n; i += 1) {
+                rotate(this, c, s, k, i, l, i);
+            }
+            // Rotate eigenvectors
+            for (i = 0; i < n; i += 1) {
+                rotate(p, c, s, i, k, i, l);
+            }
+        } while (max >= 1e-9);
+        return [this.diagonal(), p];
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_equals.js.html b/docs/vectorious/6.0.4/core_equals.js.html new file mode 100644 index 00000000..f5510a51 --- /dev/null +++ b/docs/vectorious/6.0.4/core_equals.js.html @@ -0,0 +1,158 @@ + + + + + Vectorious: core/equals.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/equals.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.equals = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function equals
+ * @description Checks if `x` and `y` are equal.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @param {Number} tolerance
+ * @returns {Boolean}
+ * @example
+ * import { equals } from 'vectorious/core/equals';
+ *
+ * equals([1, 2, 3], [1, 2, 3]); // => true
+ */
+const equals = (x, y, tolerance = 1e-6) => array_1.array(x).equals(array_1.array(y), tolerance);
+exports.equals = equals;
+/**
+ * @function equals
+ * @memberof NDArray.prototype
+ * @description Checks if current array and `x` are equal.
+ * @param {NDArray} x
+ * @param {Number} tolerance
+ * @returns {Boolean}
+ * @example
+ * import { equals } from 'vectorious/core/equals';
+ *
+ * array([1, 2, 3]).equals([1, 2, 3]); // => true
+ */
+function default_1(x, tolerance = 1e-6) {
+    const { data: d1 } = this;
+    const { data: d2 } = x;
+    const iter = new iterator_1.NDMultiIter(this, x);
+    for (const [i, j] of iter) {
+        if (Math.abs(d1[i] - d2[j]) > tolerance) {
+            return false;
+        }
+    }
+    return true;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_equidimensional.js.html b/docs/vectorious/6.0.4/core_equidimensional.js.html new file mode 100644 index 00000000..9941c529 --- /dev/null +++ b/docs/vectorious/6.0.4/core_equidimensional.js.html @@ -0,0 +1,155 @@ + + + + + Vectorious: core/equidimensional.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/equidimensional.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.equidimensional = void 0;
+const array_1 = require("./array");
+/**
+ * @deprecated
+ * @static
+ * @memberof module:Globals
+ * @function equidimensional
+ * @description Asserts if `x` and `y` have the same shape
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @throws {Error} shapes x and y do not match
+ * @example
+ * import { equidimensional } from 'vectorious/core/equidimensional';
+ *
+ * equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match
+ */
+const equidimensional = (x, y) => {
+    array_1.array(x).equidimensional(array_1.array(y));
+};
+exports.equidimensional = equidimensional;
+/**
+ * @deprecated
+ * @function equidimensional
+ * @memberof NDArray.prototype
+ * @description Asserts if current array and `x` have the same shape
+ * @param {NDArray} x
+ * @throws {Error} shapes x and y do not match
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).equidimensional([1, 2]); // Error: shapes 3 and 2 do not match
+ */
+function default_1(x) {
+    const { shape: s1 } = this;
+    const { shape: s2 } = x;
+    if (!s1.every((dim, i) => dim === s2[i])) {
+        throw new Error(`shapes ${s1} and ${s2} do not match`);
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_equilateral.js.html b/docs/vectorious/6.0.4/core_equilateral.js.html new file mode 100644 index 00000000..a046765a --- /dev/null +++ b/docs/vectorious/6.0.4/core_equilateral.js.html @@ -0,0 +1,155 @@ + + + + + Vectorious: core/equilateral.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/equilateral.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.equilateral = void 0;
+const array_1 = require("./array");
+/**
+ * @deprecated
+ * @static
+ * @memberof module:Globals
+ * @function equilateral
+ * @description Asserts if `x` and `y` have the same length
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @throws {Error} lengths x and y do not match
+ * @example
+ * import { equilateral } from 'vectorious/core/equilateral';
+ *
+ * equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match
+ */
+const equilateral = (x, y) => {
+    array_1.array(x).equilateral(array_1.array(y));
+};
+exports.equilateral = equilateral;
+/**
+ * @deprecated
+ * @function equilateral
+ * @memberof NDArray.prototype
+ * @description Asserts if current array and `x` have the same length
+ * @param {NDArray} x
+ * @throws {Error} lengths x and y do not match
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).equilateral([1, 2]); // Error: lengths 3 and 2 do not match
+ */
+function default_1(x) {
+    const { length: l1 } = this;
+    const { length: l2 } = x;
+    if (l1 !== l2) {
+        throw new Error(`lengths ${l1} and ${l2} do not match`);
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_exp.js.html b/docs/vectorious/6.0.4/core_exp.js.html new file mode 100644 index 00000000..458b32a8 --- /dev/null +++ b/docs/vectorious/6.0.4/core_exp.js.html @@ -0,0 +1,156 @@ + + + + + Vectorious: core/exp.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/exp.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.exp = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { exp: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function exp
+ * @description
+ * Returns e^x of each element of `x`, where x is the argument,
+ * and e is Euler's constant (2.718…), the base of the natural logarithm.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { exp } from 'vectorious/core/exp';
+ *
+ * exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])
+ */
+const exp = (x) => array_1.array(x).exp();
+exports.exp = exp;
+/**
+ * @function exp
+ * @memberof NDArray.prototype
+ * @description
+ * Returns e^x of each element of current array, where x is the argument,
+ * and e is Euler's constant (2.718…), the base of the natural logarithm.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).exp(); // <=> array([2.7182817459106445, 7.389056205749512, 20.08553695678711])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_expm1.js.html b/docs/vectorious/6.0.4/core_expm1.js.html new file mode 100644 index 00000000..6b3fd755 --- /dev/null +++ b/docs/vectorious/6.0.4/core_expm1.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/expm1.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/expm1.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.expm1 = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { expm1: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function expm1
+ * @description Returns subtracting 1 from exp(x) of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { expm1 } from 'vectorious/core/expm1';
+ *
+ * expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])
+ */
+const expm1 = (x) => array_1.array(x).expm1();
+exports.expm1 = expm1;
+/**
+ * @function expm1
+ * @memberof NDArray.prototype
+ * @description Returns subtracting 1 from exp(x) of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).expm1(); // <=> array([1.7182817459106445, 6.389056205749512, 19.08553695678711])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_eye.js.html b/docs/vectorious/6.0.4/core_eye.js.html new file mode 100644 index 00000000..29f441f9 --- /dev/null +++ b/docs/vectorious/6.0.4/core_eye.js.html @@ -0,0 +1,138 @@ + + + + + Vectorious: core/eye.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/eye.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.eye = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function eye
+ * @description Creates an identity matrix of size `n` and type `type`.
+ * @param {Number} n
+ * @returns {NDArray}
+ * @example
+ * import { eye } from 'vectorious/core/eye';
+ *
+ * eye(2); // => array([[1, 0], [0, 1]])
+ */
+const eye = (n) => {
+    const x = new _1.NDArray(new Float64Array(n * n), { shape: [n, n] });
+    const { data: d1 } = x;
+    let i;
+    for (i = 0; i < n; i += 1) {
+        d1[i * n + i] = 1;
+    }
+    return x;
+};
+exports.eye = eye;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_fill.js.html b/docs/vectorious/6.0.4/core_fill.js.html new file mode 100644 index 00000000..c4ff42c0 --- /dev/null +++ b/docs/vectorious/6.0.4/core_fill.js.html @@ -0,0 +1,153 @@ + + + + + Vectorious: core/fill.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/fill.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fill = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function fill
+ * @description Fills `x` with a scalar value
+ * @param {NDArray} x
+ * @param {Number} value
+ * @returns {NDArray}
+ * @example
+ * import { fill } from 'vectorious/core/fill';
+ *
+ * fill([1, 2, 3], 0); // => array([0, 0, 0])
+ */
+const fill = (x, value = 0) => array_1.array(x).fill(value);
+exports.fill = fill;
+/**
+ * @function fill
+ * @memberof NDArray.prototype
+ * @description Fills the current array with a scalar value
+ * @param {Number} value
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).fill(0); // <=> array([0, 0, 0])
+ */
+function default_1(value = 0) {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = value instanceof Function ? value(iter.pos) : value;
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_floor.js.html b/docs/vectorious/6.0.4/core_floor.js.html new file mode 100644 index 00000000..39310542 --- /dev/null +++ b/docs/vectorious/6.0.4/core_floor.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/floor.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/floor.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.floor = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { floor: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function floor
+ * @description Returns the largest integer less than or equal to a number of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { floor } from 'vectorious/core/floor';
+ *
+ * floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])
+ */
+const floor = (x) => array_1.array(x).floor();
+exports.floor = floor;
+/**
+ * @function floor
+ * @memberof NDArray.prototype
+ * @description Returns the largest integer less than or equal to a number of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1.5, 2.5, 3.5]).floor(); // <=> array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_forEach.js.html b/docs/vectorious/6.0.4/core_forEach.js.html new file mode 100644 index 00000000..f2de964c --- /dev/null +++ b/docs/vectorious/6.0.4/core_forEach.js.html @@ -0,0 +1,157 @@ + + + + + Vectorious: core/forEach.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/forEach.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.forEach = void 0;
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function forEach
+ * @description Equivalent to `TypedArray.prototype.forEach`.
+ * @param {NDArray} x
+ * @param {Function} f
+ * @example
+ * import { forEach } from 'vectorious/core/forEach';
+ *
+ * forEach([1, 2, 3], console.log);
+ * // 1 0 [ 1, 2, 3 ]
+ * // 2 1 [ 1, 2, 3 ]
+ * // 3 2 [ 1, 2, 3 ]
+ */
+const forEach = (x, f) => {
+    x.forEach(f);
+};
+exports.forEach = forEach;
+/**
+ * @function forEach
+ * @memberof NDArray.prototype
+ * @description Equivalent to `TypedArray.prototype.forEach`.
+ * @param {Function} f
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).forEach(console.log);
+ * // 1 0 [ 1, 2, 3 ]
+ * // 2 1 [ 1, 2, 3 ]
+ * // 3 2 [ 1, 2, 3 ]
+ */
+function default_1(f) {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        f.call(this, d1[i], i, d1);
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_fround.js.html b/docs/vectorious/6.0.4/core_fround.js.html new file mode 100644 index 00000000..5ccf4ed5 --- /dev/null +++ b/docs/vectorious/6.0.4/core_fround.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/fround.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/fround.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fround = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { fround: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function fround
+ * @description Returns the nearest single precision float representation of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { fround } from 'vectorious/core/fround';
+ *
+ * fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])
+ */
+const fround = (x) => array_1.array(x).fround();
+exports.fround = fround;
+/**
+ * @function fround
+ * @memberof NDArray.prototype
+ * @description Returns the nearest single precision float representation of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([-5.05, 5.05]).fround(); // <=> array([-5.050000190734863, 5.050000190734863])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_gauss.js.html b/docs/vectorious/6.0.4/core_gauss.js.html new file mode 100644 index 00000000..68d062f1 --- /dev/null +++ b/docs/vectorious/6.0.4/core_gauss.js.html @@ -0,0 +1,241 @@ + + + + + Vectorious: core/gauss.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/gauss.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.gauss = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+// import { diagonal } from './diagonal';
+const lapack = __importStar(require("../lapack"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function gauss
+ * @description
+ * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`.
+ * Accelerated with LAPACK `?getrf`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { gauss } from 'vectorious/core/gauss';
+ *
+ * gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])
+ */
+const gauss = (x) => array_1.array(x).gauss();
+exports.gauss = gauss;
+/**
+ * @function gauss
+ * @memberof NDArray.prototype
+ * @description
+ * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of the current matrix.
+ * Accelerated with LAPACK `?getrf`.
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2, 3], [4, 5, 6]]).gauss(); // <=> array([[1, 0, -1], [-0, 1, 2]])
+ */
+function default_1() {
+    const { shape: [r, c], data: d1, dtype } = this;
+    try {
+        const { data: d1 } = this;
+        const ipiv = new Int32Array(Math.min(r, c));
+        lapack.getrf(dtype, r, c, d1, c, ipiv);
+        const iter = new iterator_1.NDIter(this);
+        // Zero out lower triangular part of matrix
+        let [ci, cj] = iter.coords;
+        for (const i of iter) {
+            if (cj < ci) {
+                d1[i] = 0;
+            }
+            [ci, cj] = iter.coords;
+        }
+    }
+    catch (err) {
+        let lead = 0;
+        let leadValue;
+        let pivot;
+        let i;
+        let j;
+        let k;
+        for (i = 0; i < r; i += 1) {
+            if (c <= lead) {
+                return this;
+            }
+            j = i;
+            while (d1[j * c + lead] === 0) {
+                j += 1;
+                if (r === j) {
+                    j = i;
+                    lead += 1;
+                    if (c === lead) {
+                        return this;
+                    }
+                }
+            }
+            if (i !== j) {
+                this.swap(i, j);
+            }
+            pivot = d1[i * c + lead];
+            if (pivot !== 0) {
+                for (k = 0; k < c; k += 1) {
+                    d1[i * c + k] /= pivot;
+                }
+            }
+            for (j = 0; j < r; j += 1) {
+                leadValue = d1[j * c + lead];
+                if (j !== i) {
+                    for (k = 0; k < c; k += 1) {
+                        d1[j * c + k] -= d1[i * c + k] * leadValue;
+                    }
+                }
+            }
+            lead += 1;
+        }
+        for (i = 0; i < r; i += 1) {
+            pivot = 0;
+            for (j = 0; j < c; j += 1) {
+                if (pivot === 0) {
+                    pivot = d1[i * c + j];
+                }
+            }
+            if (pivot === 0) {
+                for (k = 0; k < c; k += 1) {
+                    d1[i * c + k] /= pivot;
+                }
+            }
+        }
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_get.js.html b/docs/vectorious/6.0.4/core_get.js.html new file mode 100644 index 00000000..275531dc --- /dev/null +++ b/docs/vectorious/6.0.4/core_get.js.html @@ -0,0 +1,160 @@ + + + + + Vectorious: core/get.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/get.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.get = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function get
+ * @description Gets the element at `i, j, ..., n` from `x`
+ * @param {NDArray} x
+ * @param {Number[]} ...indices
+ * @returns {Number}
+ * @example
+ * import { get } from 'vectorious/core/get';
+ *
+ * get([1, 2, 3], 2); // 3
+ */
+const get = (x, ...indices) => array_1.array(x).get(...indices);
+exports.get = get;
+/**
+ * @function get
+ * @memberof NDArray.prototype
+ * @description Gets the element at `i, j, ..., n` from current vector.
+ * @param {Number[]} ...indices
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).get(2); // 3
+ */
+function default_1(...indices) {
+    this.check(...indices);
+    const { data: d1, shape: s1 } = this;
+    const { length: ndim } = s1;
+    let index = indices[ndim - 1];
+    let i;
+    let j;
+    for (i = 0; i < ndim - 1; i += 1) {
+        let p = 1;
+        for (j = i + 1; j < ndim; j += 1) {
+            p *= s1[j];
+        }
+        index += indices[i] * p;
+    }
+    return d1[index];
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_index.js.html b/docs/vectorious/6.0.4/core_index.js.html new file mode 100644 index 00000000..594decc9 --- /dev/null +++ b/docs/vectorious/6.0.4/core_index.js.html @@ -0,0 +1,598 @@ + + + + + Vectorious: core/index.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/index.js

+ + + + + + +
+
+
"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+var _a;
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.min = exports.mean = exports.max = exports.matrix = exports.map = exports.magic = exports.lu_factor = exports.lu = exports.log2 = exports.log1p = exports.log10 = exports.log = exports.inv = exports.get = exports.gauss = exports.fround = exports.forEach = exports.floor = exports.fill = exports.eye = exports.expm1 = exports.exp = exports.equilateral = exports.equidimensional = exports.equals = exports.eig = exports.dot = exports.diagonal = exports.det = exports.cross = exports.cosh = exports.cos = exports.copy = exports.combine = exports.check = exports.ceil = exports.cbrt = exports.binOp = exports.augment = exports.atanh = exports.atan = exports.asinh = exports.asin = exports.array = exports.angle = exports.add = exports.acosh = exports.acos = exports.abs = exports.NDArray = void 0;
+exports.zeros = exports.trunc = exports.transpose = exports.trace = exports.toString = exports.toArray = exports.tanh = exports.tan = exports.swap = exports.sum = exports.subtract = exports.square = exports.sqrt = exports.solve = exports.slice = exports.sinh = exports.sin = exports.sign = exports.set = exports.scale = exports.row_add = exports.round = exports.reshape = exports.reduce = exports.reciprocal = exports.rank = exports.range = exports.random = exports.push = exports.project = exports.product = exports.prod = exports.pow = exports.ones = exports.normalize = exports.norm = exports.multiply = void 0;
+const util_1 = require("../util");
+const iterator_1 = require("../iterator");
+const abs_1 = __importDefault(require("./abs"));
+const acos_1 = __importDefault(require("./acos"));
+const acosh_1 = __importDefault(require("./acosh"));
+const add_1 = __importDefault(require("./add"));
+const angle_1 = __importDefault(require("./angle"));
+const asin_1 = __importDefault(require("./asin"));
+const asinh_1 = __importDefault(require("./asinh"));
+const atan_1 = __importDefault(require("./atan"));
+const atanh_1 = __importDefault(require("./atanh"));
+const augment_1 = __importDefault(require("./augment"));
+const binOp_1 = __importDefault(require("./binOp"));
+const cbrt_1 = __importDefault(require("./cbrt"));
+const ceil_1 = __importDefault(require("./ceil"));
+const check_1 = __importDefault(require("./check"));
+const combine_1 = __importDefault(require("./combine"));
+const copy_1 = __importDefault(require("./copy"));
+const cos_1 = __importDefault(require("./cos"));
+const cosh_1 = __importDefault(require("./cosh"));
+const cross_1 = __importDefault(require("./cross"));
+const det_1 = __importDefault(require("./det"));
+const diagonal_1 = __importDefault(require("./diagonal"));
+const dot_1 = __importDefault(require("./dot"));
+const eig_1 = __importDefault(require("./eig"));
+const equals_1 = __importDefault(require("./equals"));
+const equidimensional_1 = __importDefault(require("./equidimensional"));
+const equilateral_1 = __importDefault(require("./equilateral"));
+const exp_1 = __importDefault(require("./exp"));
+const expm1_1 = __importDefault(require("./expm1"));
+const fill_1 = __importDefault(require("./fill"));
+const floor_1 = __importDefault(require("./floor"));
+const forEach_1 = __importDefault(require("./forEach"));
+const fround_1 = __importDefault(require("./fround"));
+const gauss_1 = __importDefault(require("./gauss"));
+const get_1 = __importDefault(require("./get"));
+const inv_1 = __importDefault(require("./inv"));
+const log_1 = __importDefault(require("./log"));
+const log10_1 = __importDefault(require("./log10"));
+const log1p_1 = __importDefault(require("./log1p"));
+const log2_1 = __importDefault(require("./log2"));
+const lu_1 = __importDefault(require("./lu"));
+const lu_factor_1 = __importDefault(require("./lu_factor"));
+const map_1 = __importDefault(require("./map"));
+const max_1 = __importDefault(require("./max"));
+const mean_1 = __importDefault(require("./mean"));
+const min_1 = __importDefault(require("./min"));
+const multiply_1 = __importDefault(require("./multiply"));
+const norm_1 = __importDefault(require("./norm"));
+const normalize_1 = __importDefault(require("./normalize"));
+const pow_1 = __importDefault(require("./pow"));
+const prod_1 = __importDefault(require("./prod"));
+const product_1 = __importDefault(require("./product"));
+const project_1 = __importDefault(require("./project"));
+const push_1 = __importDefault(require("./push"));
+const rank_1 = __importDefault(require("./rank"));
+const reciprocal_1 = __importDefault(require("./reciprocal"));
+const reduce_1 = __importDefault(require("./reduce"));
+const reshape_1 = __importDefault(require("./reshape"));
+const round_1 = __importDefault(require("./round"));
+const row_add_1 = __importDefault(require("./row_add"));
+const scale_1 = __importDefault(require("./scale"));
+const set_1 = __importDefault(require("./set"));
+const sign_1 = __importDefault(require("./sign"));
+const sin_1 = __importDefault(require("./sin"));
+const sinh_1 = __importDefault(require("./sinh"));
+const slice_1 = __importDefault(require("./slice"));
+const solve_1 = __importDefault(require("./solve"));
+const sqrt_1 = __importDefault(require("./sqrt"));
+const square_1 = __importDefault(require("./square"));
+const subtract_1 = __importDefault(require("./subtract"));
+const sum_1 = __importDefault(require("./sum"));
+const swap_1 = __importDefault(require("./swap"));
+const tan_1 = __importDefault(require("./tan"));
+const tanh_1 = __importDefault(require("./tanh"));
+const toArray_1 = __importDefault(require("./toArray"));
+const toString_1 = __importDefault(require("./toString"));
+const trace_1 = __importDefault(require("./trace"));
+const transpose_1 = __importDefault(require("./transpose"));
+const trunc_1 = __importDefault(require("./trunc"));
+const inspectSymbol = Symbol.for('nodejs.util.inspect.custom');
+/**
+ * @class NDArray
+ * @description Constructs or copies an NDArray instance.
+ * @param data
+ * @param {Object} [options]
+ * @param {Number[]} [options.shape]
+ * @param {Number} [options.length]
+ * @param {Number[]} [options.strides]
+ * @param {string} [options.dtype]
+ * @example
+ * import { NDArray } from 'vectorious';
+ *
+ * new NDArray() // => array([], dtype=float64)
+ * new NDArray([]) // => array([], dtype=float64)
+ * new NDArray([1, 2, 3]) // => array([1, 2, 3], dtype=float64)
+ * new NDArray([[1, 2], [3, 4]]) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)
+ * new NDArray(new Int32Array([1, 2, 3])) // => array([ 1, 2, 3 ], dtype=int32)
+ * new NDArray([1, 2, 3, 4], {
+ *   shape: [2, 2],
+ *   dtype: 'uint32'
+ * }) // => array([ [ 1, 2 ], [ 3, 4 ] ], dtype=uint32)
+ */
+class NDArray {
+    constructor(data, options) {
+        /**
+         * @name data
+         * @memberof NDArray.prototype
+         * @type TypedArray
+         * @default new Float64Array(0)
+         */
+        this.data = new Float64Array(0);
+        /**
+         * @name dtype
+         * @memberof NDArray.prototype
+         * @type String
+         * @default 'float64'
+         */
+        this.dtype = 'float64';
+        /**
+         * @name length
+         * @memberof NDArray.prototype
+         * @type Number
+         * @default 0
+         */
+        this.length = 0;
+        /**
+         * @name shape
+         * @memberof NDArray.prototype
+         * @type Number[]
+         * @default [0]
+         */
+        this.shape = [0];
+        /**
+         * @name strides
+         * @memberof NDArray.prototype
+         * @type Number[]
+         * @default [0]
+         */
+        this.strides = [0];
+        this[_a] = toString_1.default;
+        this.abs = abs_1.default;
+        this.acos = acos_1.default;
+        this.acosh = acosh_1.default;
+        this.add = add_1.default;
+        this.angle = angle_1.default;
+        this.asin = asin_1.default;
+        this.asinh = asinh_1.default;
+        this.atan = atan_1.default;
+        this.atanh = atanh_1.default;
+        this.augment = augment_1.default;
+        this.binOp = binOp_1.default;
+        this.cbrt = cbrt_1.default;
+        this.ceil = ceil_1.default;
+        this.check = check_1.default;
+        this.combine = combine_1.default;
+        this.copy = copy_1.default;
+        this.cos = cos_1.default;
+        this.cosh = cosh_1.default;
+        this.cross = cross_1.default;
+        this.det = det_1.default;
+        this.diagonal = diagonal_1.default;
+        this.dot = dot_1.default;
+        this.eig = eig_1.default;
+        this.equals = equals_1.default;
+        this.equidimensional = equidimensional_1.default;
+        this.equilateral = equilateral_1.default;
+        this.exp = exp_1.default;
+        this.expm1 = expm1_1.default;
+        this.fill = fill_1.default;
+        this.floor = floor_1.default;
+        this.forEach = forEach_1.default;
+        this.fround = fround_1.default;
+        this.gauss = gauss_1.default;
+        this.get = get_1.default;
+        this.inv = inv_1.default;
+        this.log = log_1.default;
+        this.log10 = log10_1.default;
+        this.log1p = log1p_1.default;
+        this.log2 = log2_1.default;
+        this.lu = lu_1.default;
+        this.lu_factor = lu_factor_1.default;
+        this.map = map_1.default;
+        this.max = max_1.default;
+        this.mean = mean_1.default;
+        this.min = min_1.default;
+        this.multiply = multiply_1.default;
+        this.norm = norm_1.default;
+        this.normalize = normalize_1.default;
+        this.pow = pow_1.default;
+        this.prod = prod_1.default;
+        this.product = product_1.default;
+        this.project = project_1.default;
+        this.push = push_1.default;
+        this.rank = rank_1.default;
+        this.reciprocal = reciprocal_1.default;
+        this.reduce = reduce_1.default;
+        this.reshape = reshape_1.default;
+        this.round = round_1.default;
+        this.row_add = row_add_1.default;
+        this.scale = scale_1.default;
+        this.set = set_1.default;
+        this.sign = sign_1.default;
+        this.sin = sin_1.default;
+        this.sinh = sinh_1.default;
+        this.slice = slice_1.default;
+        this.solve = solve_1.default;
+        this.sqrt = sqrt_1.default;
+        this.square = square_1.default;
+        this.subtract = subtract_1.default;
+        this.sum = sum_1.default;
+        this.swap = swap_1.default;
+        this.tan = tan_1.default;
+        this.tanh = tanh_1.default;
+        this.toArray = toArray_1.default;
+        this.toString = toString_1.default;
+        this.trace = trace_1.default;
+        this.transpose = transpose_1.default;
+        this.trunc = trunc_1.default;
+        if (!data) {
+            return;
+        }
+        if (data instanceof NDArray) {
+            return data;
+        }
+        if (data instanceof iterator_1.NDIter) {
+            if (!options || !options.dtype) {
+                throw new Error('dtype is missing');
+            }
+            if (data.shape) {
+                options.shape = data.shape;
+            }
+            const length = data.length;
+            data = new (util_1.get_type(options.dtype))(length);
+        }
+        const { shape = util_1.get_shape(data), length = util_1.get_length(shape), strides = util_1.get_strides(shape), dtype = util_1.get_dtype(data), } = options || {};
+        this.data = util_1.is_typed_array(data) ? data : new (util_1.get_type(dtype))(util_1.flatten(data));
+        this.shape = shape;
+        this.length = length;
+        this.dtype = dtype;
+        this.strides = strides;
+    }
+    /**
+     * @name x
+     * @memberof NDArray.prototype
+     * @description Gets or sets the value at index 0
+     * @type Number
+     */
+    get x() {
+        return this.get(0);
+    }
+    set x(value) {
+        this.set(0, value);
+    }
+    /**
+     * @name y
+     * @memberof NDArray.prototype
+     * @description Gets or sets the value at index 1
+     * @type Number
+     */
+    get y() {
+        return this.get(1);
+    }
+    set y(value) {
+        this.set(1, value);
+    }
+    /**
+     * @name z
+     * @memberof NDArray.prototype
+     * @description Gets or sets the value at index 2
+     * @type Number
+     */
+    get z() {
+        return this.get(2);
+    }
+    set z(value) {
+        this.set(2, value);
+    }
+    /**
+     * @name w
+     * @memberof NDArray.prototype
+     * @description Gets or sets the value at index 3
+     * @type Number
+     */
+    get w() {
+        return this.get(3);
+    }
+    set w(value) {
+        this.set(3, value);
+    }
+    /**
+     * @name T
+     * @memberof NDArray.prototype
+     * @description Short for `this.transpose()`
+     * @type NDArray
+     */
+    get T() {
+        return this.transpose();
+    }
+}
+exports.NDArray = NDArray;
+_a = inspectSymbol;
+var abs_2 = require("./abs");
+Object.defineProperty(exports, "abs", { enumerable: true, get: function () { return abs_2.abs; } });
+var acos_2 = require("./acos");
+Object.defineProperty(exports, "acos", { enumerable: true, get: function () { return acos_2.acos; } });
+var acosh_2 = require("./acosh");
+Object.defineProperty(exports, "acosh", { enumerable: true, get: function () { return acosh_2.acosh; } });
+var add_2 = require("./add");
+Object.defineProperty(exports, "add", { enumerable: true, get: function () { return add_2.add; } });
+var angle_2 = require("./angle");
+Object.defineProperty(exports, "angle", { enumerable: true, get: function () { return angle_2.angle; } });
+var array_1 = require("./array");
+Object.defineProperty(exports, "array", { enumerable: true, get: function () { return array_1.array; } });
+var asin_2 = require("./asin");
+Object.defineProperty(exports, "asin", { enumerable: true, get: function () { return asin_2.asin; } });
+var asinh_2 = require("./asinh");
+Object.defineProperty(exports, "asinh", { enumerable: true, get: function () { return asinh_2.asinh; } });
+var atan_2 = require("./atan");
+Object.defineProperty(exports, "atan", { enumerable: true, get: function () { return atan_2.atan; } });
+var atanh_2 = require("./atanh");
+Object.defineProperty(exports, "atanh", { enumerable: true, get: function () { return atanh_2.atanh; } });
+var augment_2 = require("./augment");
+Object.defineProperty(exports, "augment", { enumerable: true, get: function () { return augment_2.augment; } });
+var binOp_2 = require("./binOp");
+Object.defineProperty(exports, "binOp", { enumerable: true, get: function () { return binOp_2.binOp; } });
+var cbrt_2 = require("./cbrt");
+Object.defineProperty(exports, "cbrt", { enumerable: true, get: function () { return cbrt_2.cbrt; } });
+var ceil_2 = require("./ceil");
+Object.defineProperty(exports, "ceil", { enumerable: true, get: function () { return ceil_2.ceil; } });
+var check_2 = require("./check");
+Object.defineProperty(exports, "check", { enumerable: true, get: function () { return check_2.check; } });
+var combine_2 = require("./combine");
+Object.defineProperty(exports, "combine", { enumerable: true, get: function () { return combine_2.combine; } });
+var copy_2 = require("./copy");
+Object.defineProperty(exports, "copy", { enumerable: true, get: function () { return copy_2.copy; } });
+var cos_2 = require("./cos");
+Object.defineProperty(exports, "cos", { enumerable: true, get: function () { return cos_2.cos; } });
+var cosh_2 = require("./cosh");
+Object.defineProperty(exports, "cosh", { enumerable: true, get: function () { return cosh_2.cosh; } });
+var cross_2 = require("./cross");
+Object.defineProperty(exports, "cross", { enumerable: true, get: function () { return cross_2.cross; } });
+var det_2 = require("./det");
+Object.defineProperty(exports, "det", { enumerable: true, get: function () { return det_2.det; } });
+var diagonal_2 = require("./diagonal");
+Object.defineProperty(exports, "diagonal", { enumerable: true, get: function () { return diagonal_2.diagonal; } });
+var dot_2 = require("./dot");
+Object.defineProperty(exports, "dot", { enumerable: true, get: function () { return dot_2.dot; } });
+var eig_2 = require("./eig");
+Object.defineProperty(exports, "eig", { enumerable: true, get: function () { return eig_2.eig; } });
+var equals_2 = require("./equals");
+Object.defineProperty(exports, "equals", { enumerable: true, get: function () { return equals_2.equals; } });
+var equidimensional_2 = require("./equidimensional");
+Object.defineProperty(exports, "equidimensional", { enumerable: true, get: function () { return equidimensional_2.equidimensional; } });
+var equilateral_2 = require("./equilateral");
+Object.defineProperty(exports, "equilateral", { enumerable: true, get: function () { return equilateral_2.equilateral; } });
+var exp_2 = require("./exp");
+Object.defineProperty(exports, "exp", { enumerable: true, get: function () { return exp_2.exp; } });
+var expm1_2 = require("./expm1");
+Object.defineProperty(exports, "expm1", { enumerable: true, get: function () { return expm1_2.expm1; } });
+var eye_1 = require("./eye");
+Object.defineProperty(exports, "eye", { enumerable: true, get: function () { return eye_1.eye; } });
+var fill_2 = require("./fill");
+Object.defineProperty(exports, "fill", { enumerable: true, get: function () { return fill_2.fill; } });
+var floor_2 = require("./floor");
+Object.defineProperty(exports, "floor", { enumerable: true, get: function () { return floor_2.floor; } });
+var forEach_2 = require("./forEach");
+Object.defineProperty(exports, "forEach", { enumerable: true, get: function () { return forEach_2.forEach; } });
+var fround_2 = require("./fround");
+Object.defineProperty(exports, "fround", { enumerable: true, get: function () { return fround_2.fround; } });
+var gauss_2 = require("./gauss");
+Object.defineProperty(exports, "gauss", { enumerable: true, get: function () { return gauss_2.gauss; } });
+var get_2 = require("./get");
+Object.defineProperty(exports, "get", { enumerable: true, get: function () { return get_2.get; } });
+var inv_2 = require("./inv");
+Object.defineProperty(exports, "inv", { enumerable: true, get: function () { return inv_2.inv; } });
+var log_2 = require("./log");
+Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_2.log; } });
+var log10_2 = require("./log10");
+Object.defineProperty(exports, "log10", { enumerable: true, get: function () { return log10_2.log10; } });
+var log1p_2 = require("./log1p");
+Object.defineProperty(exports, "log1p", { enumerable: true, get: function () { return log1p_2.log1p; } });
+var log2_2 = require("./log2");
+Object.defineProperty(exports, "log2", { enumerable: true, get: function () { return log2_2.log2; } });
+var lu_2 = require("./lu");
+Object.defineProperty(exports, "lu", { enumerable: true, get: function () { return lu_2.lu; } });
+var lu_factor_2 = require("./lu_factor");
+Object.defineProperty(exports, "lu_factor", { enumerable: true, get: function () { return lu_factor_2.lu_factor; } });
+var magic_1 = require("./magic");
+Object.defineProperty(exports, "magic", { enumerable: true, get: function () { return magic_1.magic; } });
+var map_2 = require("./map");
+Object.defineProperty(exports, "map", { enumerable: true, get: function () { return map_2.map; } });
+var matrix_1 = require("./matrix");
+Object.defineProperty(exports, "matrix", { enumerable: true, get: function () { return matrix_1.matrix; } });
+var max_2 = require("./max");
+Object.defineProperty(exports, "max", { enumerable: true, get: function () { return max_2.max; } });
+var mean_2 = require("./mean");
+Object.defineProperty(exports, "mean", { enumerable: true, get: function () { return mean_2.mean; } });
+var min_2 = require("./min");
+Object.defineProperty(exports, "min", { enumerable: true, get: function () { return min_2.min; } });
+var multiply_2 = require("./multiply");
+Object.defineProperty(exports, "multiply", { enumerable: true, get: function () { return multiply_2.multiply; } });
+var norm_2 = require("./norm");
+Object.defineProperty(exports, "norm", { enumerable: true, get: function () { return norm_2.norm; } });
+var normalize_2 = require("./normalize");
+Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return normalize_2.normalize; } });
+var ones_1 = require("./ones");
+Object.defineProperty(exports, "ones", { enumerable: true, get: function () { return ones_1.ones; } });
+var pow_2 = require("./pow");
+Object.defineProperty(exports, "pow", { enumerable: true, get: function () { return pow_2.pow; } });
+var prod_2 = require("./prod");
+Object.defineProperty(exports, "prod", { enumerable: true, get: function () { return prod_2.prod; } });
+var product_2 = require("./product");
+Object.defineProperty(exports, "product", { enumerable: true, get: function () { return product_2.product; } });
+var project_2 = require("./project");
+Object.defineProperty(exports, "project", { enumerable: true, get: function () { return project_2.project; } });
+var push_2 = require("./push");
+Object.defineProperty(exports, "push", { enumerable: true, get: function () { return push_2.push; } });
+var random_1 = require("./random");
+Object.defineProperty(exports, "random", { enumerable: true, get: function () { return random_1.random; } });
+var range_1 = require("./range");
+Object.defineProperty(exports, "range", { enumerable: true, get: function () { return range_1.range; } });
+var rank_2 = require("./rank");
+Object.defineProperty(exports, "rank", { enumerable: true, get: function () { return rank_2.rank; } });
+var reciprocal_2 = require("./reciprocal");
+Object.defineProperty(exports, "reciprocal", { enumerable: true, get: function () { return reciprocal_2.reciprocal; } });
+var reduce_2 = require("./reduce");
+Object.defineProperty(exports, "reduce", { enumerable: true, get: function () { return reduce_2.reduce; } });
+var reshape_2 = require("./reshape");
+Object.defineProperty(exports, "reshape", { enumerable: true, get: function () { return reshape_2.reshape; } });
+var round_2 = require("./round");
+Object.defineProperty(exports, "round", { enumerable: true, get: function () { return round_2.round; } });
+var row_add_2 = require("./row_add");
+Object.defineProperty(exports, "row_add", { enumerable: true, get: function () { return row_add_2.row_add; } });
+var scale_2 = require("./scale");
+Object.defineProperty(exports, "scale", { enumerable: true, get: function () { return scale_2.scale; } });
+var set_2 = require("./set");
+Object.defineProperty(exports, "set", { enumerable: true, get: function () { return set_2.set; } });
+var sign_2 = require("./sign");
+Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return sign_2.sign; } });
+var sin_2 = require("./sin");
+Object.defineProperty(exports, "sin", { enumerable: true, get: function () { return sin_2.sin; } });
+var sinh_2 = require("./sinh");
+Object.defineProperty(exports, "sinh", { enumerable: true, get: function () { return sinh_2.sinh; } });
+var slice_2 = require("./slice");
+Object.defineProperty(exports, "slice", { enumerable: true, get: function () { return slice_2.slice; } });
+var solve_2 = require("./solve");
+Object.defineProperty(exports, "solve", { enumerable: true, get: function () { return solve_2.solve; } });
+var sqrt_2 = require("./sqrt");
+Object.defineProperty(exports, "sqrt", { enumerable: true, get: function () { return sqrt_2.sqrt; } });
+var square_2 = require("./square");
+Object.defineProperty(exports, "square", { enumerable: true, get: function () { return square_2.square; } });
+var subtract_2 = require("./subtract");
+Object.defineProperty(exports, "subtract", { enumerable: true, get: function () { return subtract_2.subtract; } });
+var sum_2 = require("./sum");
+Object.defineProperty(exports, "sum", { enumerable: true, get: function () { return sum_2.sum; } });
+var swap_2 = require("./swap");
+Object.defineProperty(exports, "swap", { enumerable: true, get: function () { return swap_2.swap; } });
+var tan_2 = require("./tan");
+Object.defineProperty(exports, "tan", { enumerable: true, get: function () { return tan_2.tan; } });
+var tanh_2 = require("./tanh");
+Object.defineProperty(exports, "tanh", { enumerable: true, get: function () { return tanh_2.tanh; } });
+var toArray_2 = require("./toArray");
+Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_2.toArray; } });
+var toString_2 = require("./toString");
+Object.defineProperty(exports, "toString", { enumerable: true, get: function () { return toString_2.toString; } });
+var trace_2 = require("./trace");
+Object.defineProperty(exports, "trace", { enumerable: true, get: function () { return trace_2.trace; } });
+var transpose_2 = require("./transpose");
+Object.defineProperty(exports, "transpose", { enumerable: true, get: function () { return transpose_2.transpose; } });
+var trunc_2 = require("./trunc");
+Object.defineProperty(exports, "trunc", { enumerable: true, get: function () { return trunc_2.trunc; } });
+var zeros_1 = require("./zeros");
+Object.defineProperty(exports, "zeros", { enumerable: true, get: function () { return zeros_1.zeros; } });
+try {
+    window.v = NDArray;
+}
+catch (error) { }
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_inv.js.html b/docs/vectorious/6.0.4/core_inv.js.html new file mode 100644 index 00000000..8c3ded38 --- /dev/null +++ b/docs/vectorious/6.0.4/core_inv.js.html @@ -0,0 +1,205 @@ + + + + + Vectorious: core/inv.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/inv.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.inv = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+const eye_1 = require("./eye");
+const augment_1 = require("./augment");
+const zeros_1 = require("./zeros");
+const lapack = __importStar(require("../lapack"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function inv
+ * @description
+ * Determines the inverse of `x`.
+ * Accelerated with LAPACK `?getrf` and `?getri`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { inv } from 'vectorious/core/inv';
+ *
+ * inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])
+ */
+const inv = (x) => array_1.array(x).inv();
+exports.inv = inv;
+/**
+ * @function inv
+ * @memberof NDArray.prototype
+ * @description
+ * Determines the inverse of current matrix using Gaussian elimination.
+ * Accelerated with LAPACK `?getri`.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]).inv(); // <=> array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])
+ */
+function default_1() {
+    this.square();
+    const { shape: [n], dtype } = this;
+    try {
+        const { data: d1 } = this;
+        const ipiv = new Int32Array(n);
+        lapack.getrf(dtype, n, n, d1, n, ipiv);
+        lapack.getri(dtype, n, d1, n, ipiv);
+        return this;
+    }
+    catch (err) {
+        const identity = eye_1.eye(n);
+        const rref = augment_1.augment(this, identity).gauss();
+        const left = zeros_1.zeros(n, n);
+        const right = zeros_1.zeros(n, n);
+        const { data: d1 } = rref;
+        const { data: d2 } = left;
+        const { data: d3 } = right;
+        const iter = new iterator_1.NDIter(rref);
+        let [ci, cj] = iter.coords;
+        for (const i of iter) {
+            if (cj < n) {
+                d2[ci * n + cj] = d1[i];
+            }
+            else {
+                d3[ci * n + (cj - n)] = d1[i];
+            }
+            [ci, cj] = iter.coords;
+        }
+        if (!left.equals(identity)) {
+            throw new Error('matrix is not invertible');
+        }
+        return right;
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_log.js.html b/docs/vectorious/6.0.4/core_log.js.html new file mode 100644 index 00000000..973504c8 --- /dev/null +++ b/docs/vectorious/6.0.4/core_log.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/log.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/log.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.log = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { log: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function log
+ * @description Returns the natural logarithm (log_e, also ln) of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { log } from 'vectorious/core/log';
+ *
+ * log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])
+ */
+const log = (x) => array_1.array(x).log();
+exports.log = log;
+/**
+ * @function log
+ * @memberof NDArray.prototype
+ * @description Returns the natural logarithm (log_e, also ln) of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).log(); // <=> array([0, 0.6931471824645996, 1.0986123085021973])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_log10.js.html b/docs/vectorious/6.0.4/core_log10.js.html new file mode 100644 index 00000000..0397d323 --- /dev/null +++ b/docs/vectorious/6.0.4/core_log10.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/log10.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/log10.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.log10 = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { log10: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function log10
+ * @description Returns the base 10 logarithm of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { log10 } from 'vectorious/core/log10';
+ *
+ * log10([10, 100, 1000]); // => array([1, 2, 3])
+ */
+const log10 = (x) => array_1.array(x).log10();
+exports.log10 = log10;
+/**
+ * @function log10
+ * @memberof NDArray.prototype
+ * @description Returns the base 10 logarithm of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([10, 100, 1000]).log10(); // <=> array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_log1p.js.html b/docs/vectorious/6.0.4/core_log1p.js.html new file mode 100644 index 00000000..7920d24c --- /dev/null +++ b/docs/vectorious/6.0.4/core_log1p.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/log1p.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/log1p.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.log1p = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { log1p: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function log1p
+ * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { log1p } from 'vectorious/core/log1p';
+ *
+ * log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])
+ */
+const log1p = (x) => array_1.array(x).log1p();
+exports.log1p = log1p;
+/**
+ * @function log1p
+ * @memberof NDArray.prototype
+ * @description Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]); // <=> array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_log2.js.html b/docs/vectorious/6.0.4/core_log2.js.html new file mode 100644 index 00000000..18a5cb24 --- /dev/null +++ b/docs/vectorious/6.0.4/core_log2.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/log2.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/log2.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.log2 = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { log2: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function log2
+ * @description Returns the base 2 logarithm of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { log2 } from 'vectorious/core/log2';
+ *
+ * log2([1, 2, 4]); // => array([0, 1, 2])
+ */
+const log2 = (x) => array_1.array(x).log2();
+exports.log2 = log2;
+/**
+ * @function log2
+ * @memberof NDArray.prototype
+ * @description Returns the base 2 logarithm of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 4]).log2(); // => array([0, 1, 2])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_lu.js.html b/docs/vectorious/6.0.4/core_lu.js.html new file mode 100644 index 00000000..e4907141 --- /dev/null +++ b/docs/vectorious/6.0.4/core_lu.js.html @@ -0,0 +1,166 @@ + + + + + Vectorious: core/lu.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/lu.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.lu = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function lu
+ * @description
+ * Performs full LU decomposition on `x`.
+ * Accelerated with LAPACK `?getrf`.
+ * @param {NDArray} x
+ * @returns {Array<NDArray, Int32Array>}
+ * @example
+ * import { lu } from 'vectorious/core/lu';
+ *
+ * lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]
+ */
+const lu = (x) => array_1.array(x).lu();
+exports.lu = lu;
+/**
+ * @function lu
+ * @memberof NDArray.prototype
+ * @description
+ * Performs full LU decomposition on current matrix.
+ * Accelerated with LAPACK `?getrf`.
+ * @returns {Array<NDArray|Int32Array>}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu(); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]
+ */
+function default_1() {
+    const [LU, ipiv] = this.copy().lu_factor();
+    const L = LU.copy();
+    const U = LU.copy();
+    const { data: d1 } = L;
+    const { data: d2 } = U;
+    const iter = new iterator_1.NDIter(LU);
+    let [ci, cj] = iter.coords;
+    for (const i of iter) {
+        if (cj < ci) {
+            d2[i] = 0;
+        }
+        else {
+            d1[i] = ci === cj ? 1 : 0;
+        }
+        [ci, cj] = iter.coords;
+    }
+    return [L, U, ipiv];
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_lu_factor.js.html b/docs/vectorious/6.0.4/core_lu_factor.js.html new file mode 100644 index 00000000..ff51b149 --- /dev/null +++ b/docs/vectorious/6.0.4/core_lu_factor.js.html @@ -0,0 +1,211 @@ + + + + + Vectorious: core/lu_factor.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/lu_factor.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.lu_factor = void 0;
+const array_1 = require("./array");
+const lapack = __importStar(require("../lapack"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function lu_factor
+ * @description
+ * Performs LU factorization on `x`.
+ * Accelerated with LAPACK `?getrf`.
+ * @param {NDArray} x
+ * @returns {Array<NDArray|Int32Array>}
+ * @example
+ * import { lu_factor } from 'vectorious/core/lu_factor';
+ *
+ * lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]
+ */
+const lu_factor = (x) => array_1.array(x).lu_factor();
+exports.lu_factor = lu_factor;
+/**
+ * @function lu_factor
+ * @memberof NDArray.prototype
+ * @description
+ * Performs LU factorization on current matrix.
+ * Accelerated with LAPACK `?getrf`.
+ * @returns {Array<NDArray|Int32Array>}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).lu_factor(); // <=> [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]
+ */
+function default_1() {
+    const { data: d1, shape: [n], dtype } = this;
+    const ipiv = new Int32Array(n);
+    try {
+        lapack.getrf(dtype, n, n, d1, n, ipiv);
+    }
+    catch (err) {
+        let max;
+        let abs;
+        let diag;
+        let p;
+        let i;
+        let j;
+        let k;
+        for (k = 0; k < n; k += 1) {
+            p = k;
+            max = Math.abs(d1[k * n + k]);
+            for (j = k + 1; j < n; j += 1) {
+                abs = Math.abs(d1[j * n + k]);
+                if (max < abs) {
+                    max = abs;
+                    p = j;
+                }
+            }
+            ipiv[k] = p + 1;
+            if (p !== k) {
+                this.swap(k, p);
+            }
+            diag = d1[k * n + k];
+            for (i = k + 1; i < n; i += 1) {
+                d1[i * n + k] /= diag;
+            }
+            for (i = k + 1; i < n; i += 1) {
+                for (j = k + 1; j < n - 1; j += 2) {
+                    d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];
+                    d1[i * n + j + 1] -= d1[i * n + k] * d1[k * n + j + 1];
+                }
+                if (j === n - 1) {
+                    d1[i * n + j] -= d1[i * n + k] * d1[k * n + j];
+                }
+            }
+        }
+    }
+    return [this, ipiv];
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_magic.js.html b/docs/vectorious/6.0.4/core_magic.js.html new file mode 100644 index 00000000..0eb60491 --- /dev/null +++ b/docs/vectorious/6.0.4/core_magic.js.html @@ -0,0 +1,146 @@ + + + + + Vectorious: core/magic.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/magic.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.magic = void 0;
+const _1 = require("./");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function magic
+ * @description Creates a magic square matrix of size `n`
+ * @param {Number} n
+ * @returns {NDArray}
+ * @example
+ * import { magic } from 'vectorious/core/magic';
+ *
+ * magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])
+ */
+const magic = (n) => {
+    if (n < 0) {
+        throw new Error('invalid n');
+    }
+    const d1 = new Float64Array(n * n);
+    const magic = new _1.NDArray(d1, { shape: [n, n] });
+    const iter = new iterator_1.NDIter(magic);
+    let [ci, cj] = iter.coords;
+    for (const i of iter) {
+        const a = n - ci - 1;
+        const b = n - cj - 1;
+        d1[i] = ((cj + a * 2 + 1) % n) * n + ((b + a * 2 + 1) % n) + 1;
+        [ci, cj] = iter.coords;
+    }
+    return magic;
+};
+exports.magic = magic;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_map.js.html b/docs/vectorious/6.0.4/core_map.js.html new file mode 100644 index 00000000..1b054eef --- /dev/null +++ b/docs/vectorious/6.0.4/core_map.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/map.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/map.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.map = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function map
+ * @description Equivalent to `TypedArray.prototype.map`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { map } from 'vectorious/core/map';
+ *
+ * map([1, 2, 3], value => -value); // => array([-1, -2, -3])
+ */
+const map = (x, f) => array_1.array(x).map(f);
+exports.map = map;
+/**
+ * @function map
+ * @memberof NDArray.prototype
+ * @description Equivalent to `TypedArray.prototype.map`.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).map(value => -value); // => array([-1, -2, -3])
+ */
+function default_1(f) {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    const map = f.bind(this);
+    const copy = this.copy();
+    const { data: d2 } = copy;
+    for (const i of iter) {
+        d2[i] = map(d1[i], i, d1);
+    }
+    return copy;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_matrix.js.html b/docs/vectorious/6.0.4/core_matrix.js.html new file mode 100644 index 00000000..e2042b13 --- /dev/null +++ b/docs/vectorious/6.0.4/core_matrix.js.html @@ -0,0 +1,131 @@ + + + + + Vectorious: core/matrix.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/matrix.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.matrix = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function matrix
+ * @description Creates a matrix of `r` rows and `c` columns.
+ * @param {Number} r
+ * @param {Number} c
+ * @returns {NDArray}
+ * @example
+ * import { matrix } from 'vectorious/core/matrix';
+ *
+ * matrix(2, 2); // => array([[0, 0], [0, 0]])
+ */
+const matrix = (r, c) => new _1.NDArray(new Float64Array(r * c), { shape: [r, c] });
+exports.matrix = matrix;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_max.js.html b/docs/vectorious/6.0.4/core_max.js.html new file mode 100644 index 00000000..5fa2f63f --- /dev/null +++ b/docs/vectorious/6.0.4/core_max.js.html @@ -0,0 +1,184 @@ + + + + + Vectorious: core/max.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/max.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.max = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const blas = __importStar(require("../blas"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function max
+ * @description
+ * Gets the maximum value (largest) element of `x`.
+ * Accelerated with BLAS `i?amax`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { max } from 'vectorious/core/max';
+ *
+ * max([1, 2, 3]); // => 3
+ */
+const max = (x) => array_1.array(x).max();
+exports.max = max;
+/**
+ * @function max
+ * @memberof NDArray.prototype
+ * @description
+ * Gets the maximum value (smallest) element of current array.
+ * Accelerated with BLAS `i?amax`.
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).max(); // => 3
+ */
+function default_1() {
+    const { data: d1, length: l1, dtype } = this;
+    let max = Number.NEGATIVE_INFINITY;
+    try {
+        max = d1[blas.iamax(dtype, l1, d1, 1)];
+    }
+    catch (err) {
+        const iter = new iterator_1.NDIter(this);
+        for (const i of iter) {
+            const value = d1[i];
+            if (max < value) {
+                max = value;
+            }
+        }
+    }
+    return max;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_mean.js.html b/docs/vectorious/6.0.4/core_mean.js.html new file mode 100644 index 00000000..0a0fe126 --- /dev/null +++ b/docs/vectorious/6.0.4/core_mean.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/mean.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/mean.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.mean = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function mean
+ * @description Gets the arithmetic mean of `x`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { mean } from 'vectorious/core/mean';
+ *
+ * mean([1, 2, 3]); // => 2
+ */
+const mean = (x) => array_1.array(x).mean();
+exports.mean = mean;
+/**
+ * @function mean
+ * @memberof NDArray.prototype
+ * @description Gets the arithmetic mean of current array.
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).mean(); // => 2
+ */
+function default_1() {
+    const { data: d1, length: l1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    let mean = 0;
+    for (const i of iter) {
+        mean += d1[i];
+    }
+    return mean / l1;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_min.js.html b/docs/vectorious/6.0.4/core_min.js.html new file mode 100644 index 00000000..b75e82c4 --- /dev/null +++ b/docs/vectorious/6.0.4/core_min.js.html @@ -0,0 +1,155 @@ + + + + + Vectorious: core/min.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/min.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.min = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function min
+ * @description Gets the minimum value (smallest) element of `x`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { min } from 'vectorious/core/min';
+ *
+ * min([1, 2, 3]); // => 1
+ */
+const min = (x) => array_1.array(x).min();
+exports.min = min;
+/**
+ * @function min
+ * @memberof NDArray.prototype
+ * @description Gets the minimum value (smallest) element of current array.
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).min(); // 1
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    let min = Number.POSITIVE_INFINITY;
+    for (const i of iter) {
+        const value = d1[i];
+        if (min > value) {
+            min = value;
+        }
+    }
+    return min;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_multiply.js.html b/docs/vectorious/6.0.4/core_multiply.js.html new file mode 100644 index 00000000..0c24776c --- /dev/null +++ b/docs/vectorious/6.0.4/core_multiply.js.html @@ -0,0 +1,196 @@ + + + + + Vectorious: core/multiply.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/multiply.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.multiply = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+const matrix_1 = require("./matrix");
+const blas = __importStar(require("../blas"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function multiply
+ * @description
+ * Multiplies two matrices `x` and `y` of matching dimensions.
+ * Accelerated with BLAS `?gemm`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { multiply } from 'vectorious/core/multiply';
+ *
+ * multiply([[1, 2]], [[1], [2]]); // => array([[5]])
+ */
+const multiply = (x, y) => array_1.array(x).multiply(array_1.array(y));
+exports.multiply = multiply;
+/**
+ * @function multiply
+ * @memberof NDArray.prototype
+ * @description
+ * Multiplies current matrix with `x`.
+ * Accelerated with BLAS `?gemm`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2]]).multiply([[1], [2]]); // <=> array([[5]])
+ */
+function default_1(x) {
+    const { shape: [r1, c1], data: d1, dtype } = this;
+    const { shape: [r2, c2], data: d2 } = x;
+    if (c1 !== r2) {
+        throw new Error('sizes do not match');
+    }
+    const y = matrix_1.matrix(r1, c2);
+    const { data: d3 } = y;
+    try {
+        blas.gemm(dtype, blas.NoTrans, blas.NoTrans, r1, c2, c1, 1, d1, c1, d2, c2, 0, d3, c2);
+    }
+    catch (err) {
+        const iter = new iterator_1.NDIter(y);
+        let k;
+        let [ci, cj] = iter.coords;
+        for (const i of iter) {
+            let sum = 0;
+            for (k = 0; k < c1; k += 1) {
+                sum += d1[ci * c1 + k] * d2[k * c2 + cj];
+            }
+            d3[i] = sum;
+            [ci, cj] = iter.coords;
+        }
+    }
+    return y;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_norm.js.html b/docs/vectorious/6.0.4/core_norm.js.html new file mode 100644 index 00000000..5257cfc1 --- /dev/null +++ b/docs/vectorious/6.0.4/core_norm.js.html @@ -0,0 +1,178 @@ + + + + + Vectorious: core/norm.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/norm.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.norm = void 0;
+const array_1 = require("./array");
+const blas = __importStar(require("../blas"));
+const { sqrt: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function norm
+ * @description
+ * Calculates the norm of current array (also called L2 norm or Euclidean length).
+ * Accelerated with BLAS `?nrm2`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { norm } from 'vectorious/core/norm';
+ *
+ * norm([1, 2, 3]); // => 3.7416574954986572
+ */
+const norm = (x) => array_1.array(x).norm();
+exports.norm = norm;
+/**
+ * @function norm
+ * @memberof NDArray.prototype
+ * @description
+ * Calculates the norm of current array (also called L2 norm or Euclidean length).
+ * Accelerated with BLAS `?nrm2`.
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).norm(); // => 3.7416574954986572
+ */
+function default_1() {
+    const { data: d1, length: l1, dtype } = this;
+    let result = 0;
+    try {
+        result = blas.nrm2(dtype, l1, d1, 1);
+    }
+    catch (err) {
+        result = f(this.dot(this));
+    }
+    return result;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_normalize.js.html b/docs/vectorious/6.0.4/core_normalize.js.html new file mode 100644 index 00000000..b4afe5d7 --- /dev/null +++ b/docs/vectorious/6.0.4/core_normalize.js.html @@ -0,0 +1,145 @@ + + + + + Vectorious: core/normalize.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/normalize.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.normalize = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function normalize
+ * @description Normalizes `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { normalize } from 'vectorious/core/normalize';
+ *
+ * normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])
+ */
+const normalize = (x) => array_1.array(x).normalize();
+exports.normalize = normalize;
+/**
+ * @function normalize
+ * @memberof NDArray.prototype
+ * @description Normalizes current vector.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).normalize(); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])
+ */
+function default_1() {
+    return this.scale(1 / this.norm());
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_ones.js.html b/docs/vectorious/6.0.4/core_ones.js.html new file mode 100644 index 00000000..e7cd57e5 --- /dev/null +++ b/docs/vectorious/6.0.4/core_ones.js.html @@ -0,0 +1,130 @@ + + + + + Vectorious: core/ones.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/ones.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ones = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function ones
+ * @description Creates an array containing ones (`1`) of shape `shape`
+ * @param {Number[]} ...shape
+ * @returns {NDArray}
+ * @example
+ * import { ones } from 'vectorious/core/ones';
+ *
+ * ones(3); // => array([1, 1, 1])
+ */
+const ones = (...shape) => new _1.NDArray(new Float64Array(shape.reduce((sum, dim) => sum * dim, 1)), { shape }).fill(1);
+exports.ones = ones;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_pow.js.html b/docs/vectorious/6.0.4/core_pow.js.html new file mode 100644 index 00000000..3ad38443 --- /dev/null +++ b/docs/vectorious/6.0.4/core_pow.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/pow.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/pow.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.pow = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { pow: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function pow
+ * @description Returns each element of `x` to the exponent power, that is, element^exponent.
+ * @param {NDArray} x
+ * @param {Number} exponent
+ * @returns {NDArray}
+ * @example
+ * import { pow } from 'vectorious/core/pow';
+ *
+ * pow([1, 2, 3], 2); // => array([1, 4, 9])
+ */
+const pow = (x, exponent) => array_1.array(x).pow(exponent);
+exports.pow = pow;
+/**
+ * @function pow
+ * @memberof NDArray.prototype
+ * @description Returns each element of current array to the exponent power, that is, element^exponent.
+ * @param {Number} exponent
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).pow(2); // <=> array([1, 4, 9])
+ */
+function default_1(exponent) {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i], exponent);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_prod.js.html b/docs/vectorious/6.0.4/core_prod.js.html new file mode 100644 index 00000000..ab518c72 --- /dev/null +++ b/docs/vectorious/6.0.4/core_prod.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/prod.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/prod.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.prod = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function prod
+ * @description Product of all elements of `x`.
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { prod } from 'vectorious/core/prod';
+ *
+ * prod([1, 2, 3]); // => 6
+ */
+const prod = (x) => array_1.array(x).prod();
+exports.prod = prod;
+/**
+ * @function prod
+ * @memberof NDArray.prototype
+ * @description Product of all elements of current array
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).prod(); // => 6
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    let prod = 1;
+    for (const i of iter) {
+        prod *= d1[i];
+    }
+    return prod;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_product.js.html b/docs/vectorious/6.0.4/core_product.js.html new file mode 100644 index 00000000..a8e7213f --- /dev/null +++ b/docs/vectorious/6.0.4/core_product.js.html @@ -0,0 +1,153 @@ + + + + + Vectorious: core/product.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/product.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.product = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function product
+ * @description Hadamard product of `x` and `y`
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { product } from 'vectorious/core/product';
+ *
+ * product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])
+ */
+const product = (x, y) => array_1.array(x).product(array_1.array(y));
+exports.product = product;
+/**
+ * @function product
+ * @memberof NDArray.prototype
+ * @description Hadamard product of current matrix and `x`
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).product([4, 5, 6]); // <=> array([4, 10, 18])
+ */
+function default_1(x) {
+    const { data: d1 } = this;
+    const { data: d2 } = x;
+    const iter = new iterator_1.NDMultiIter(this, x);
+    for (const [i, j] of iter) {
+        d1[i] *= d2[j];
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_project.js.html b/docs/vectorious/6.0.4/core_project.js.html new file mode 100644 index 00000000..5f9c93af --- /dev/null +++ b/docs/vectorious/6.0.4/core_project.js.html @@ -0,0 +1,146 @@ + + + + + Vectorious: core/project.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/project.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.project = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function project
+ * @description Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { project } from 'vectorious/core/project';
+ *
+ * project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])
+ */
+const project = (x, y) => array_1.array(x).project(array_1.array(y));
+exports.project = project;
+/**
+ * @function project
+ * @memberof NDArray.prototype
+ * @description Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`.
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).project([4, 5, 6]); // <=> array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])
+ */
+function default_1(x) {
+    return x.scale(this.dot(x) / x.dot(x));
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_push.js.html b/docs/vectorious/6.0.4/core_push.js.html new file mode 100644 index 00000000..f49742f8 --- /dev/null +++ b/docs/vectorious/6.0.4/core_push.js.html @@ -0,0 +1,159 @@ + + + + + Vectorious: core/push.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/push.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.push = void 0;
+const util_1 = require("../util");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function push
+ * @description Pushes a new `value` into `x`.
+ * @param {NDArray} x
+ * @param {Number} value
+ * @returns {NDArray}
+ * @example
+ * import { push } from 'vectorious/core/push';
+ *
+ * push([1, 2, 3], 4); // => array([1, 2, 3, 4])
+ */
+const push = (x, value) => array_1.array(x).push(value);
+exports.push = push;
+/**
+ * @function push
+ * @memberof NDArray.prototype
+ * @description Pushes a new `value` into current vector.
+ * @param {Number} value
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).push(4); // => array([1, 2, 3, 4])
+ */
+function default_1(value) {
+    if (this.shape.length !== 1) {
+        throw new Error('push operation not permitted for multidimensional arrays');
+    }
+    const { data: d1, length: l1 } = this;
+    const l2 = l1 + 1;
+    const d2 = new (util_1.get_type(this.dtype))(l2);
+    d2.set(d1);
+    d2[l1] = value;
+    this.data = d2;
+    this.length = l2;
+    this.shape = [l2];
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_random.js.html b/docs/vectorious/6.0.4/core_random.js.html new file mode 100644 index 00000000..897c89d4 --- /dev/null +++ b/docs/vectorious/6.0.4/core_random.js.html @@ -0,0 +1,130 @@ + + + + + Vectorious: core/random.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/random.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.random = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function random
+ * @description Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape`
+ * @param {Number[]} ...shape
+ * @returns {NDArray}
+ * @example
+ * import { random } from 'vectorious/core/random';
+ *
+ * random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])
+ */
+const random = (...shape) => new _1.NDArray(new Float64Array(shape.reduce((sum, dim) => sum * dim, 1)), { shape }).map(() => Math.random());
+exports.random = random;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_range.js.html b/docs/vectorious/6.0.4/core_range.js.html new file mode 100644 index 00000000..39279712 --- /dev/null +++ b/docs/vectorious/6.0.4/core_range.js.html @@ -0,0 +1,179 @@ + + + + + Vectorious: core/range.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/range.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.range = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function range
+ * @description
+ * Creates an array containing a range (can be either ascending or descending)
+ * of numbers specified by the arguments provided (e.g. `NDArray.range(0, .5, 2)`
+ * gives an array containing all numbers in the interval `[0, 2)` separated by
+ * steps of `0.5`)
+ * @param {Number} start
+ * @param {Number} step
+ * @param {Number} stop
+ * @returns {NDArray}
+ * @example
+ * import { range } from 'vectorious/core/range';
+ *
+ * range(1, 2, 9); // => array([1, 3, 5, 7])
+ */
+const range = (...args) => {
+    const type = Float32Array;
+    let backwards = false;
+    let start;
+    let step;
+    let end;
+    switch (args.length) {
+        case 2:
+            end = args.pop();
+            step = 1;
+            start = args.pop();
+            break;
+        case 3:
+            end = args.pop();
+            step = args.pop();
+            start = args.pop();
+            break;
+        default:
+            throw new Error('invalid range');
+    }
+    if (end - start < 0) {
+        const copy = end;
+        end = start;
+        start = copy;
+        backwards = true;
+    }
+    if (step > end - start) {
+        throw new Error('invalid range');
+    }
+    const data = new type(Math.ceil((end - start) / step));
+    let i = start;
+    let j = 0;
+    if (backwards) {
+        for (; i < end; i += step, j += 1) {
+            data[j] = end - i + start;
+        }
+    }
+    else {
+        for (; i < end; i += step, j += 1) {
+            data[j] = i;
+        }
+    }
+    return new _1.NDArray(data);
+};
+exports.range = range;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_rank.js.html b/docs/vectorious/6.0.4/core_rank.js.html new file mode 100644 index 00000000..ebcf3419 --- /dev/null +++ b/docs/vectorious/6.0.4/core_rank.js.html @@ -0,0 +1,159 @@ + + + + + Vectorious: core/rank.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/rank.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.rank = void 0;
+const iterator_1 = require("../iterator");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function rank
+ * @description Finds the rank of `x` using gaussian elimination.
+ * @param {NDArray} x
+ * @param {Number} tolerance
+ * @returns {Number}
+ * @example
+ * import { rank } from 'vectorious/core/rank';
+ *
+ * rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1
+ */
+const rank = (x, tolerance = 1e-6) => array_1.array(x).rank(tolerance);
+exports.rank = rank;
+/**
+ * @function rank
+ * @memberof NDArray.prototype
+ * @description Finds the rank of current matrix using gaussian elimination.
+ * @param {Number} tolerance
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 1, 1], [2, 2, 2], [3, 3, 3]]).rank(); // => 1
+ * @todo Switch to SVD algorithm
+ */
+function default_1(tolerance = 1e-6) {
+    const { data: d1 } = this.copy().gauss();
+    const iter = new iterator_1.NDIter(this);
+    let rk = 0;
+    let [ci, cj] = iter.coords;
+    for (const i of iter) {
+        if (rk <= ci && cj >= ci && d1[i] > tolerance) {
+            rk += 1;
+        }
+        [ci, cj] = iter.coords;
+    }
+    return rk;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_reciprocal.js.html b/docs/vectorious/6.0.4/core_reciprocal.js.html new file mode 100644 index 00000000..a045eb8c --- /dev/null +++ b/docs/vectorious/6.0.4/core_reciprocal.js.html @@ -0,0 +1,151 @@ + + + + + Vectorious: core/reciprocal.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/reciprocal.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.reciprocal = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function reciprocal
+ * @description Gets the element-wise reciprocal of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { reciprocal } from 'vectorious/core/reciprocal';
+ *
+ * reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])
+ */
+const reciprocal = (x) => array_1.array(x).reciprocal();
+exports.reciprocal = reciprocal;
+/**
+ * @function reciprocal
+ * @memberof NDArray.prototype
+ * @description Gets the element-wise reciprocal of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = 1 / d1[i];
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_reduce.js.html b/docs/vectorious/6.0.4/core_reduce.js.html new file mode 100644 index 00000000..e440a458 --- /dev/null +++ b/docs/vectorious/6.0.4/core_reduce.js.html @@ -0,0 +1,167 @@ + + + + + Vectorious: core/reduce.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/reduce.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.reduce = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function reduce
+ * @description Equivalent to `TypedArray.prototype.reduce`.
+ * @param {NDArray} x
+ * @param {Function} f
+ * @param {Number} initialValue
+ * @returns {Number}
+ * @example
+ * import { reduce } from 'vectorious/core/reduce';
+ *
+ * reduce([1, 2, 3], (a, b) => a + b, 0); // => 6
+ */
+const reduce = (x, f, initialValue) => array_1.array(x).reduce(f, initialValue);
+exports.reduce = reduce;
+/**
+ * @function reduce
+ * @memberof NDArray.prototype
+ * @description Equivalent to `TypedArray.prototype.reduce`.
+ * @param {Function} f
+ * @param {Number} initialValue
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).reduce((a, b) => a + b, 0); // => 6
+ */
+function default_1(f, initialValue) {
+    const { data: d1, length: l1 } = this;
+    if (l1 === 0 && typeof initialValue === 'undefined') {
+        throw new Error('Reduce of empty array with no initial value.');
+    }
+    const iter = new iterator_1.NDIter(this);
+    const reduce = f.bind(this);
+    let value;
+    if (typeof initialValue === 'undefined') {
+        value = d1[0];
+        iter.next();
+    }
+    else {
+        value = initialValue;
+    }
+    for (const i of iter) {
+        value = reduce(value, d1[i], i, d1);
+    }
+    return value;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_reshape.js.html b/docs/vectorious/6.0.4/core_reshape.js.html new file mode 100644 index 00000000..310e7d61 --- /dev/null +++ b/docs/vectorious/6.0.4/core_reshape.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/reshape.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/reshape.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.reshape = void 0;
+const util_1 = require("../util");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function reshape
+ * @description Reshapes `x`
+ * @param {NDArray} x
+ * @param {Number[]} ...shape
+ * @returns {NDArray}
+ * @example
+ * import { reshape } from 'vectorious/core/reshape';
+ *
+ * reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])
+ */
+const reshape = (x, ...shape) => array_1.array(x).reshape(...shape);
+exports.reshape = reshape;
+/**
+ * @function reshape
+ * @memberof NDArray.prototype
+ * @description Reshapes current array
+ * @param {Number[]} ...shape
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3, 4]).reshape(2, 2); // <=> array([[1, 2], [3, 4]])
+ */
+function default_1(...shape) {
+    const { length } = this;
+    if (shape.reduce((sum, dim) => sum * dim, 1) !== length) {
+        throw new Error(`shape ${shape} does not match length ${length}`);
+    }
+    this.shape = shape;
+    this.strides = util_1.get_strides(shape);
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_round.js.html b/docs/vectorious/6.0.4/core_round.js.html new file mode 100644 index 00000000..976c98dd --- /dev/null +++ b/docs/vectorious/6.0.4/core_round.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/round.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/round.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.round = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { round: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function round
+ * @description Returns the value of each element of `x` rounded to the nearest integer.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { round } from 'vectorious/core/round';
+ *
+ * round([1.2, 2.8, 3.5]); // => array([1, 3, 4])
+ */
+const round = (x) => array_1.array(x).round();
+exports.round = round;
+/**
+ * @function round
+ * @memberof NDArray.prototype
+ * @description Returns the value of each element of current array rounded to the nearest integer.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1.2, 2.8, 3.5]).round(); // <=> array([1, 3, 4])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_row_add.js.html b/docs/vectorious/6.0.4/core_row_add.js.html new file mode 100644 index 00000000..19333b01 --- /dev/null +++ b/docs/vectorious/6.0.4/core_row_add.js.html @@ -0,0 +1,159 @@ + + + + + Vectorious: core/row_add.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/row_add.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.row_add = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function row_add
+ * @description Adds a multiple of one row multiplied by `scalar` to another inside `x`.
+ * @param {NDArray} x
+ * @param {Number} dest
+ * @param {Number} source
+ * @param {Number} scalar
+ * @returns {NDArray}
+ * @example
+ * import { row_add } from 'vectorious/core/row_add';
+ *
+ * row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])
+ */
+const row_add = (x, dest, source, scalar = 1) => array_1.array(x).row_add(dest, source, scalar);
+exports.row_add = row_add;
+/**
+ * @function row_add
+ * @memberof NDArray.prototype
+ * @description Adds a multiple of one row multiplied by `scalar` to another inside current matrix.
+ * @param {Number} dest
+ * @param {Number} source
+ * @param {Number} scalar
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2], [3, 4]]).row_add(1, 0, 2); // <=> array([[1, 2], [5, 8]])
+ */
+function default_1(dest, source, scalar = 1) {
+    this.check(dest, 0);
+    this.check(source, 0);
+    const [, c] = this.shape;
+    const { data: d1 } = this;
+    let j;
+    for (j = 0; j < c; j += 1) {
+        d1[dest * c + j] += d1[source * c + j] * scalar;
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_scale.js.html b/docs/vectorious/6.0.4/core_scale.js.html new file mode 100644 index 00000000..90be5cb7 --- /dev/null +++ b/docs/vectorious/6.0.4/core_scale.js.html @@ -0,0 +1,182 @@ + + + + + Vectorious: core/scale.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/scale.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.scale = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const blas = __importStar(require("../blas"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function scale
+ * @description
+ * Multiplies all elements of `x` with a specified `scalar`.
+ * Accelerated with BLAS `?scal`.
+ * @param {NDArray} x
+ * @param {Number} scalar
+ * @returns {NDArray}
+ * @example
+ * import { scale } from 'vectorious/core/scale';
+ *
+ * scale([1, 2, 3], 2); // => array([2, 4, 6])
+ */
+const scale = (x, scalar) => array_1.array(x).scale(scalar);
+exports.scale = scale;
+/**
+ * @function scale
+ * @memberof NDArray.prototype
+ * @description
+ * Multiplies all elements of current array with a specified `scalar`.
+ * Accelerated with BLAS `?scal`.
+ * @param {Number} scalar
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).scale(2); // <=> array([2, 4, 6])
+ */
+function default_1(scalar) {
+    const { data: d1, length: l1, dtype } = this;
+    try {
+        blas.scal(dtype, l1, scalar, d1, 1);
+    }
+    catch (err) {
+        const iter = new iterator_1.NDIter(this);
+        for (const i of iter) {
+            d1[i] *= scalar;
+        }
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_set.js.html b/docs/vectorious/6.0.4/core_set.js.html new file mode 100644 index 00000000..7df472b9 --- /dev/null +++ b/docs/vectorious/6.0.4/core_set.js.html @@ -0,0 +1,159 @@ + + + + + Vectorious: core/set.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/set.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.set = void 0;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function set
+ * @description Sets the element at `i, j, ..., n` to `value`.
+ * @param {NDArray} x
+ * @param {Number[]} ...indices
+ * @param {Number} value
+ * @returns {NDArray}
+ * @example
+ * import { set } from 'vectorious/core/set';
+ *
+ * set([1, 2, 3], 1, 0); // => array([1, 0, 3])
+ */
+const set = (x, ...args) => {
+    x.set(...args);
+};
+exports.set = set;
+/**
+ * @function set
+ * @memberof NDArray.prototype
+ * @description Sets the element at `i, j, ..., n` to `value`.
+ * @param {Number[]} ...indices
+ * @param {Number} value
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).set(1, 0); // <=> array([1, 0, 3])
+ */
+function default_1(...args) {
+    const indices = args.slice(0, -1);
+    const value = args[args.length - 1];
+    this.check(...indices);
+    const { shape: s1 } = this;
+    let index = indices[indices.length - 1];
+    let i;
+    for (i = 0; i < indices.length - 1; i += 1) {
+        index += indices[i] * s1[i + 1];
+    }
+    this.data[index] = value;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_sign.js.html b/docs/vectorious/6.0.4/core_sign.js.html new file mode 100644 index 00000000..11b7137b --- /dev/null +++ b/docs/vectorious/6.0.4/core_sign.js.html @@ -0,0 +1,156 @@ + + + + + Vectorious: core/sign.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/sign.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sign = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { sign: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function sign
+ * @description
+ * Returns the sign of each element of `x`, indicating
+ * whether it is positive, negative or zero.
+ * @param {Number} x
+ * @returns {NDArray}
+ * @example
+ * import { sign } from 'vectorious/core/sign';
+ *
+ * sign([1, 2, 3]); // => array([1, 1, 1])
+ */
+const sign = (x) => array_1.array(x).sign();
+exports.sign = sign;
+/**
+ * @function sign
+ * @memberof NDArray.prototype
+ * @description
+ * Returns the sign of each element of current array, indicating
+ * whether it is positive, negative or zero.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).sign(); // <=> array([1, 1, 1])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_sin.js.html b/docs/vectorious/6.0.4/core_sin.js.html new file mode 100644 index 00000000..0e9d00a1 --- /dev/null +++ b/docs/vectorious/6.0.4/core_sin.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/sin.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/sin.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sin = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { sin: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function sin
+ * @description Returns the sine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { sin } from 'vectorious/core/sin';
+ *
+ * sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])
+ */
+const sin = (x) => array_1.array(x).sin();
+exports.sin = sin;
+/**
+ * @function sin
+ * @memberof NDArray.prototype
+ * @description Returns the sine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([0, Math.PI / 2, Math.PI]).sin(); // <=> array([0, 1, 0])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_sinh.js.html b/docs/vectorious/6.0.4/core_sinh.js.html new file mode 100644 index 00000000..b3bdcda9 --- /dev/null +++ b/docs/vectorious/6.0.4/core_sinh.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/sinh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/sinh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sinh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { sinh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function sinh
+ * @description Returns the hyperbolic sine of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { sinh } from 'vectorious/core/sinh';
+ *
+ * sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])
+ */
+const sinh = (x) => array_1.array(x).sinh();
+exports.sinh = sinh;
+/**
+ * @function sinh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic sine of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).sinh(); // <=> array([1.175201177597046, 3.6268603801727295, 10.017874717712402])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_slice.js.html b/docs/vectorious/6.0.4/core_slice.js.html new file mode 100644 index 00000000..a92755a4 --- /dev/null +++ b/docs/vectorious/6.0.4/core_slice.js.html @@ -0,0 +1,175 @@ + + + + + Vectorious: core/slice.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/slice.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.slice = void 0;
+const util_1 = require("../util");
+const _1 = require("./");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function slice
+ * @description Slices `x` in the corresponding dimension
+ * @param {NDArray} x
+ * @param {Number} begin
+ * @param {Number} end
+ * @param {Number} step
+ * @returns {NDArray}
+ * @example
+ * import { slice } from 'vectorious/core/slice';
+ *
+ * slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])
+ */
+const slice = (x, begin, end, step) => array_1.array(x).slice(begin, end, step);
+exports.slice = slice;
+/**
+ * @function slice
+ * @memberof NDArray.prototype
+ * @description Slices the current array along the leading dimension
+ * @param {Number} begin
+ * @param {Number} end
+ * @param {Number} step
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3, 4]).slice(0, 4, 2); // => array([1, 3])
+ */
+function default_1(begin = 0, end = this.shape[0], step = 1) {
+    const { data: d1, shape: s1 } = this;
+    const nd = s1.length;
+    if (begin < 0 || end < 0) {
+        return this.slice(begin < 0 ? s1[s1.length - 1] + begin : begin, end < 0 ? s1[s1.length - 1] + end : end);
+    }
+    if (begin > end) {
+        return this.slice(end, begin, step);
+    }
+    if (step <= 0) {
+        throw new Error('step argument has to be a positive integer');
+    }
+    const s2 = [Math.ceil((end - begin) / Math.abs(step)), ...s1.slice(1)];
+    const l2 = util_1.get_length(s2);
+    const st2 = util_1.get_strides(s2);
+    const d2 = nd > 1
+        ? d1.subarray(begin * s2[s2.length - 1], end * s2[s2.length - 1])
+        : d1.subarray(begin, end);
+    st2[0] *= step;
+    return new _1.NDArray(d2, {
+        shape: s2,
+        length: l2,
+        strides: st2,
+    });
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_solve.js.html b/docs/vectorious/6.0.4/core_solve.js.html new file mode 100644 index 00000000..1605386b --- /dev/null +++ b/docs/vectorious/6.0.4/core_solve.js.html @@ -0,0 +1,203 @@ + + + + + Vectorious: core/solve.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/solve.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+    Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+    o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.solve = void 0;
+const array_1 = require("./array");
+const lapack = __importStar(require("../lapack"));
+/**
+ * @static
+ * @memberof module:Globals
+ * @function solve
+ * @description
+ * Solves the equation AX = B (where A is `x` and B is `y`).
+ * Accelerated with LAPACK `?gesv`.
+ * @param {NDArray} x
+ * @param {NDArray} y
+ * @returns {NDArray}
+ * @example
+ * import { solve } from 'vectorious/core/solve';
+ *
+ * solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])
+ */
+const solve = (x, y) => array_1.array(x).solve(array_1.array(y));
+exports.solve = solve;
+/**
+ * @function solve
+ * @memberof NDArray.prototype
+ * @description
+ * Solves the equation AX = B (where A is current matrix and B is `x`).
+ * Accelerated with LAPACK `?gesv`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 3, 5], [2, 4, 7], [1, 1, 0]]).solve([[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])
+ */
+function default_1(x) {
+    const { data: d1, dtype } = this;
+    const { data: d2, shape: [n, nrhs] } = x;
+    try {
+        const ipiv = new Int32Array(n);
+        lapack.gesv(dtype, n, nrhs, d1, n, ipiv, d2, nrhs);
+    }
+    catch (err) {
+        const [LU, ipiv] = this.lu_factor();
+        const { data: d1 } = LU;
+        const { data: d2 } = x;
+        let i;
+        let j;
+        let k;
+        for (i = 0; i < ipiv.length; i += 1) {
+            if (i !== ipiv[i] - 1) {
+                x.swap(i, ipiv[i] - 1);
+            }
+        }
+        for (k = 0; k < nrhs; k += 1) {
+            for (i = 0; i < n; i += 1) {
+                for (j = 0; j < i; j += 1) {
+                    d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];
+                }
+            }
+            for (i = n - 1; i >= 0; i -= 1) {
+                for (j = i + 1; j < n; j += 1) {
+                    d2[i * nrhs + k] -= d1[i * n + j] * d2[j * nrhs + k];
+                }
+                d2[i * nrhs + k] /= d1[i * n + i];
+            }
+        }
+    }
+    return x;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_sqrt.js.html b/docs/vectorious/6.0.4/core_sqrt.js.html new file mode 100644 index 00000000..538bcf9f --- /dev/null +++ b/docs/vectorious/6.0.4/core_sqrt.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/sqrt.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/sqrt.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sqrt = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { sqrt: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function sqrt
+ * @description Returns the positive square root of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { sqrt } from 'vectorious/core/sqrt';
+ *
+ * sqrt([1, 4, 9]); // => array([1, 2, 3])
+ */
+const sqrt = (x) => array_1.array(x).sqrt();
+exports.sqrt = sqrt;
+/**
+ * @function sqrt
+ * @memberof NDArray.prototype
+ * @description Returns the positive square root of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 4, 9]); // <=> array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_square.js.html b/docs/vectorious/6.0.4/core_square.js.html new file mode 100644 index 00000000..b6db4666 --- /dev/null +++ b/docs/vectorious/6.0.4/core_square.js.html @@ -0,0 +1,151 @@ + + + + + Vectorious: core/square.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/square.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.square = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function square
+ * @description Asserts if `x` is square.
+ * @param {NDArray} x
+ * @throws {Error} matrix is not square
+ * @example
+ * import { square } from 'vectorious/core/square';
+ *
+ * square([1, 2, 3]); // Error: matrix is not square
+ */
+const square = (x) => {
+    array_1.array(x).square();
+};
+exports.square = square;
+/**
+ * @function square
+ * @memberof NDArray.prototype
+ * @description Asserts if current matrix is square.
+ * @throws {Error} matrix is not square
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).square(); // Error: matrix is not square
+ */
+function default_1() {
+    const { length } = this.shape;
+    const [r, c] = this.shape;
+    if (length !== 2 || r !== c) {
+        throw new Error('matrix is not square');
+    }
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_subtract.js.html b/docs/vectorious/6.0.4/core_subtract.js.html new file mode 100644 index 00000000..9deb33c4 --- /dev/null +++ b/docs/vectorious/6.0.4/core_subtract.js.html @@ -0,0 +1,149 @@ + + + + + Vectorious: core/subtract.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/subtract.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.subtract = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function subtract
+ * @description
+ * Subtracts `y` from `x`.
+ * Accelerated with BLAS `?axpy`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { subtract } from 'vectorious/core/subtract';
+ *
+ * subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])
+ */
+const subtract = (x, y) => array_1.array(x).subtract(array_1.array(y));
+exports.subtract = subtract;
+/**
+ * @function subtract
+ * @memberof NDArray.prototype
+ * @description
+ * Subtracts `x` from the current array.
+ * Accelerated with BLAS `?axpy`.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).subtract([1, 1, 1]); // <=> array([0, 1, 2])
+ */
+function default_1(x) {
+    return this.add(x, -1);
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_sum.js.html b/docs/vectorious/6.0.4/core_sum.js.html new file mode 100644 index 00000000..acbe1001 --- /dev/null +++ b/docs/vectorious/6.0.4/core_sum.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/sum.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/sum.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.sum = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function sum
+ * @description Sum of `x`
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { sum } from 'vectorious/core/sum';
+ *
+ * sum([1, 2, 3]); // => 6
+ */
+const sum = (x) => array_1.array(x).sum();
+exports.sum = sum;
+/**
+ * @function sum
+ * @memberof NDArray.prototype
+ * @description Sum of array elements
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).sum(); // => 6
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    let sum = 0;
+    for (const i of iter) {
+        sum += d1[i];
+    }
+    return sum;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_swap.js.html b/docs/vectorious/6.0.4/core_swap.js.html new file mode 100644 index 00000000..0c48243d --- /dev/null +++ b/docs/vectorious/6.0.4/core_swap.js.html @@ -0,0 +1,156 @@ + + + + + Vectorious: core/swap.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/swap.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.swap = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function swap
+ * @description Swaps two rows `i` and `j` in `x`.
+ * @param {NDArray} x
+ * @param {Number} i
+ * @param {Number} j
+ * @returns {NDArray}
+ * @example
+ * import { swap } from 'vectorious/core/swap';
+ *
+ * swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])
+ */
+const swap = (x, i, j) => array_1.array(x).swap(i, j);
+exports.swap = swap;
+/**
+ * @function swap
+ * @memberof NDArray.prototype
+ * @description Swaps two rows `i` and `j` in current matrix
+ * @param {Number} i
+ * @param {Number} j
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2], [3, 4]]); // <=> array([[3, 4], [1, 2]])
+ */
+function default_1(i, j) {
+    this.check(i, 0);
+    this.check(j, 0);
+    const { data: d1 } = this;
+    const [, c] = this.shape;
+    const d2 = d1.slice(i * c, (i + 1) * c);
+    d1.copyWithin(i * c, j * c, (j + 1) * c);
+    d1.set(d2, j * c);
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_tan.js.html b/docs/vectorious/6.0.4/core_tan.js.html new file mode 100644 index 00000000..d01abef9 --- /dev/null +++ b/docs/vectorious/6.0.4/core_tan.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/tan.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/tan.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.tan = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { tan: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function tan
+ * @description Returns the tangent of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { tan } from 'vectorious/core/tan';
+ *
+ * tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])
+ */
+const tan = (x) => array_1.array(x).tan();
+exports.tan = tan;
+/**
+ * @function tan
+ * @memberof NDArray.prototype
+ * @description Returns the tangent of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).tan(); // <=> array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_tanh.js.html b/docs/vectorious/6.0.4/core_tanh.js.html new file mode 100644 index 00000000..89d2f5f6 --- /dev/null +++ b/docs/vectorious/6.0.4/core_tanh.js.html @@ -0,0 +1,152 @@ + + + + + Vectorious: core/tanh.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/tanh.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.tanh = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { tanh: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function tanh
+ * @description Returns the hyperbolic tangent of each element of `x`.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { tanh } from 'vectorious/core/tanh';
+ *
+ * tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])
+ */
+const tanh = (x) => array_1.array(x).tanh();
+exports.tanh = tanh;
+/**
+ * @function tanh
+ * @memberof NDArray.prototype
+ * @description Returns the hyperbolic tangent of each element of current array.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).tanh(); // <=> array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_toArray.js.html b/docs/vectorious/6.0.4/core_toArray.js.html new file mode 100644 index 00000000..39601d07 --- /dev/null +++ b/docs/vectorious/6.0.4/core_toArray.js.html @@ -0,0 +1,163 @@ + + + + + Vectorious: core/toArray.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/toArray.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.toArray = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function toArray
+ * @description Converts `x` into a JavaScript array.
+ * @param {NDArray} x
+ * @returns {Array}
+ * @example
+ * import { toArray } from 'vectorious/core/toArray';
+ *
+ * toArray([1, 2, 3]); // => [1, 2, 3]
+ */
+const toArray = (x) => array_1.array(x).toArray();
+exports.toArray = toArray;
+/**
+ * @function toArray
+ * @memberof NDArray.prototype
+ * @description Converts current vector into a JavaScript array.
+ * @param {Number} index
+ * @param {Number} dim
+ * @returns {Array}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).toArray(); // => [1, 2, 3]
+ */
+function default_1(index = 0, dim = 0) {
+    const { data: d1, shape: s1, strides: st1 } = this;
+    const { length: ndim } = s1;
+    if (dim >= ndim) {
+        return d1[index];
+    }
+    const n = s1[dim];
+    const stride = st1[dim];
+    const list = [];
+    for (let i = 0; i < n; i++) {
+        const item = this.toArray(index, dim + 1);
+        if (item === null) {
+            return null;
+        }
+        list[i] = item;
+        index += stride;
+    }
+    return list;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_toString.js.html b/docs/vectorious/6.0.4/core_toString.js.html new file mode 100644 index 00000000..efef8ada --- /dev/null +++ b/docs/vectorious/6.0.4/core_toString.js.html @@ -0,0 +1,146 @@ + + + + + Vectorious: core/toString.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/toString.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.toString = void 0;
+const util_1 = require("util");
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function toString
+ * @description Converts `x` into a readable formatted string.
+ * @param {NDArray} x
+ * @returns {String}
+ * @example
+ * import { toString } from 'vectorious/core/toString';
+ *
+ * toString([1, 2, 3]); // => '1,2,3'
+ */
+const toString = (x) => array_1.array(x).toString();
+exports.toString = toString;
+/**
+ * @function toString
+ * @memberof NDArray.prototype
+ * @description Converts current vector into a readable formatted string.
+ * @returns {String}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).toString(); // => '1,2,3'
+ */
+function default_1() {
+    return `array(${util_1.inspect(this.toArray(), { depth: 10, breakLength: 40 })}, dtype=${this.dtype})`;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_trace.js.html b/docs/vectorious/6.0.4/core_trace.js.html new file mode 100644 index 00000000..2b321f52 --- /dev/null +++ b/docs/vectorious/6.0.4/core_trace.js.html @@ -0,0 +1,153 @@ + + + + + Vectorious: core/trace.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/trace.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.trace = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function trace
+ * @description Gets the trace of `x` (the sum of all diagonal elements).
+ * @param {NDArray} x
+ * @returns {Number}
+ * @example
+ * import { trace } from 'vectorious/core/trace';
+ *
+ * trace([[1, 2], [3, 4]]); // => 5
+ */
+const trace = (x) => array_1.array(x).trace();
+exports.trace = trace;
+/**
+ * @function trace
+ * @memberof NDArray.prototype
+ * @description Gets the trace of the matrix (the sum of all diagonal elements).
+ * @returns {Number}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1, 2, 3]).trace(); // => 5
+ */
+function default_1() {
+    const [r, c] = this.shape;
+    const { data: d1 } = this;
+    const n = Math.min(r, c);
+    let result = 0;
+    let j;
+    for (j = 0; j < n; j += 1) {
+        result += d1[j * c + j];
+    }
+    return result;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_transpose.js.html b/docs/vectorious/6.0.4/core_transpose.js.html new file mode 100644 index 00000000..be4168ab --- /dev/null +++ b/docs/vectorious/6.0.4/core_transpose.js.html @@ -0,0 +1,154 @@ + + + + + Vectorious: core/transpose.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/transpose.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.transpose = void 0;
+const array_1 = require("./array");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function transpose
+ * @description Transposes `x` (mirror across the diagonal).
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { transpose } from 'vectorious/core/transpose';
+ *
+ * transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
+ */
+const transpose = (x) => array_1.array(x).transpose();
+exports.transpose = transpose;
+/**
+ * @function transpose
+ * @memberof NDArray.prototype
+ * @description Transposes current matrix (mirror across the diagonal).
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // <=> array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
+ */
+function default_1() {
+    if (this.shape.length < 2) {
+        return this;
+    }
+    let tmp = this.shape[0];
+    this.shape[0] = this.shape[1];
+    this.shape[1] = tmp;
+    tmp = this.strides[0];
+    this.strides[0] = this.strides[1];
+    this.strides[1] = tmp;
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_trunc.js.html b/docs/vectorious/6.0.4/core_trunc.js.html new file mode 100644 index 00000000..4557c92f --- /dev/null +++ b/docs/vectorious/6.0.4/core_trunc.js.html @@ -0,0 +1,156 @@ + + + + + Vectorious: core/trunc.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/trunc.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.trunc = void 0;
+const array_1 = require("./array");
+const iterator_1 = require("../iterator");
+const { trunc: f } = Math;
+/**
+ * @static
+ * @memberof module:Globals
+ * @function trunc
+ * @description
+ * Returns the integer part of each element of `x`,
+ * removing any fractional digits.
+ * @param {NDArray} x
+ * @returns {NDArray}
+ * @example
+ * import { trunc } from 'vectorious/core/trunc';
+ *
+ * trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])
+ */
+const trunc = (x) => array_1.array(x).trunc();
+exports.trunc = trunc;
+/**
+ * @function trunc
+ * @memberof NDArray.prototype
+ * @description
+ * Returns the integer part of each element of current array,
+ * removing any fractional digits.
+ * @returns {this}
+ * @example
+ * import { array } from 'vectorious/core/array';
+ *
+ * array([1.2, 2.8, 3.5]).trunc(); // => array([1, 2, 3])
+ */
+function default_1() {
+    const { data: d1 } = this;
+    const iter = new iterator_1.NDIter(this);
+    for (const i of iter) {
+        d1[i] = f(d1[i]);
+    }
+    return this;
+}
+exports.default = default_1;
+;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/core_zeros.js.html b/docs/vectorious/6.0.4/core_zeros.js.html new file mode 100644 index 00000000..f2f7da6a --- /dev/null +++ b/docs/vectorious/6.0.4/core_zeros.js.html @@ -0,0 +1,130 @@ + + + + + Vectorious: core/zeros.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

core/zeros.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.zeros = void 0;
+const _1 = require("./");
+/**
+ * @static
+ * @memberof module:Globals
+ * @function zeros
+ * @description Creates an array containing zeros (`0`) of shape `shape`
+ * @param {Number[]} ...shape
+ * @returns {NDArray}
+ * @example
+ * import { zeros } from 'vectorious/core/zeros';
+ *
+ * zeros(3); // => array([0, 0, 0])
+ */
+const zeros = (...shape) => new _1.NDArray(new Float64Array(shape.reduce((sum, dim) => sum * dim, 1)), { shape }).fill(0);
+exports.zeros = zeros;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/index.html b/docs/vectorious/6.0.4/index.html new file mode 100644 index 00000000..42036522 --- /dev/null +++ b/docs/vectorious/6.0.4/index.html @@ -0,0 +1,209 @@ + + + + + Vectorious: + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

+

+ + + + + + + +

vectorious 6.0.4

+ + + + + + + + + + + + + + + +
+

+ Vectorious Logo +

+

+ A linear algebra library, written in TypeScript and accelerated with C++ bindings to BLAS and LAPACK. +

+

+ +

+

Usage

+

Follow the installation instructions in nlapack and nblas to get maximum performance.

+
# with C++ bindings
+$ npm install vectorious
+
+# or, if you don't want C++ bindings
+$ npm install vectorious --no-optional
+
+
import v = require('vectorious');
+
+const x = v.random(2, 2);
+/*
+array([
+  [
+    0.26472008228302,
+    0.4102575480937958
+  ],
+  [
+    0.4068726599216461,
+    0.4589384198188782
+  ]
+], dtype=float64)
+*/
+
+const y = v.range(0, 9).reshape(3, 3);
+/*
+array([
+  [ 0, 1, 2 ],
+  [ 3, 4, 5 ],
+  [ 6, 7, 8 ]
+], dtype=float64)
+*/
+
+const z = v.array([[1, 2], [3, 4]]);
+/*
+array([ [ 1, 2 ], [ 3, 4 ] ], dtype=float64)
+*/
+
+x.add(z);
+/*
+array([
+  [
+    1.26472008228302,
+    2.410257577896118
+  ],
+  [
+    3.4068727493286133,
+    4.4589385986328125
+  ]
+], dtype=float64)
+*/
+
+

Documentation

+ +

Examples

+

Basic

+ +

Machine learning

+ +

Benchmarks

+

Run benchmarks with

+
$ npm run benchmark
+
+
+ + + + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + \ No newline at end of file diff --git a/docs/vectorious/6.0.4/index.js.html b/docs/vectorious/6.0.4/index.js.html new file mode 100644 index 00000000..e0ee4234 --- /dev/null +++ b/docs/vectorious/6.0.4/index.js.html @@ -0,0 +1,129 @@ + + + + + Vectorious: index.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

index.js

+ + + + + + +
+
+
"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+    if (k2 === undefined) k2 = k;
+    o[k2] = m[k];
+}));
+var __exportStar = (this && this.__exportStar) || function(m, exports) {
+    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * @module Globals
+ */
+__exportStar(require("./core"), exports);
+__exportStar(require("./iterator"), exports);
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/iterator_index.js.html b/docs/vectorious/6.0.4/iterator_index.js.html new file mode 100644 index 00000000..01a55598 --- /dev/null +++ b/docs/vectorious/6.0.4/iterator_index.js.html @@ -0,0 +1,435 @@ + + + + + Vectorious: iterator/index.js + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

source

+

iterator/index.js

+ + + + + + +
+
+
"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.NDMultiIter = exports.NDIter = exports.V_MAXDIMS = void 0;
+const array_1 = require("../core/array");
+exports.V_MAXDIMS = 32;
+/**
+ * @class NDIter
+ * @description Constructs an NDIter instance.
+ * @param {NDArray} x
+ */
+class NDIter {
+    constructor(x) {
+        this.x = array_1.array(x);
+        const { shape, strides, length, } = this.x;
+        this.length = length;
+        this.lengthm1 = length - 1;
+        this.nd = shape.length;
+        this.ndm1 = this.nd - 1;
+        this.shape = Array(exports.V_MAXDIMS).fill(0);
+        this.strides = Array(exports.V_MAXDIMS).fill(0);
+        this.shapem1 = Array(exports.V_MAXDIMS).fill(0);
+        this.coords = Array(exports.V_MAXDIMS).fill(0);
+        this.backstrides = Array(exports.V_MAXDIMS).fill(0);
+        this.factors = Array(exports.V_MAXDIMS).fill(0);
+        if (this.nd !== 0) {
+            this.factors[this.nd - 1] = 1;
+        }
+        this.contiguous = true;
+        let stride = 1;
+        let i;
+        for (i = 0; i < this.nd; i += 1) {
+            this.shape[i] = shape[i];
+            this.shapem1[i] = shape[i] - 1;
+            this.strides[i] = strides[i];
+            this.backstrides[i] = strides[i] * this.shapem1[i];
+            this.coords[i] = 0;
+            // Check if C-contiguous
+            if (shape[this.ndm1 - i] !== 1) {
+                if (strides[i] !== stride) {
+                    this.contiguous = false;
+                }
+                stride *= shape[this.ndm1 - i];
+            }
+            if (i > 0) {
+                this.factors[this.ndm1 - i] = this.factors[this.nd - i] * shape[this.nd - i];
+            }
+        }
+        this.index = 0;
+        this.pos = 0;
+    }
+    /**
+     * @function done
+     * @memberof NDIter.prototype
+     * @description Returns true if the iterator is done, false otherwise
+     * @returns {Boolean}
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDIter(array([1, 2, 3]));
+     * iter.done(); // false
+     */
+    done() {
+        return this.index > this.lengthm1;
+    }
+    /**
+     * @function current
+     * @memberof NDIter.prototype
+     * @description Returns the current element of the iterator
+     * @returns {Object} current
+     * @returns {Number} [current.value]
+     * @returns {Boolean} current.done
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDIter(array([1, 2, 3]));
+     * iter.current(); // { value: 1, done: false }
+     */
+    current() {
+        const done = this.done();
+        return {
+            value: done ? undefined : this.pos,
+            done,
+        };
+    }
+    /**
+     * @function next1d
+     * @memberof NDIter.prototype
+     * @description Steps to the next position in the iterator, assuming it is 1 dimensional.
+     */
+    next1d() {
+        const { strides, } = this;
+        this.pos += strides[0];
+        this.coords[0] += 1;
+    }
+    /**
+     * @function nextcontiguous
+     * @memberof NDIter.prototype
+     * @description Steps to the next position in the iterator, assuming its data is contiguous.
+     */
+    nextcontiguous() {
+        this.pos += 1;
+    }
+    /**
+     * @function next2d
+     * @memberof NDIter.prototype
+     * @description Steps to the next position in the iterator, assuming it is 2 dimensional.
+     */
+    next2d() {
+        const { strides, shapem1, backstrides, } = this;
+        if (this.coords[1] < shapem1[1]) {
+            this.coords[1] += 1;
+            this.pos += strides[1];
+        }
+        else {
+            this.coords[1] = 0;
+            this.coords[0] += 1;
+            this.pos += strides[0] - backstrides[1];
+        }
+    }
+    /**
+     * @function next2d
+     * @memberof NDIter.prototype
+     * @description Steps to the next position in the iterator
+     */
+    nextnd() {
+        const { ndm1, shapem1, strides, backstrides, } = this;
+        let i;
+        for (i = ndm1; i >= 0; i -= 1) {
+            if (this.coords[i] < shapem1[i]) {
+                this.coords[i] += 1;
+                this.pos += strides[i];
+                break;
+            }
+            this.coords[i] = 0;
+            this.pos -= backstrides[i];
+        }
+    }
+    /**
+     * @function next
+     * @memberof NDIter.prototype
+     * @description
+     * Steps to the next position in the iterator.
+     * Returns the current index of the iterator, or undefined if done.
+     * @returns {Object}
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDIter(array([1, 2, 3]));
+     * iter.next(); // { value: 2, done: false }
+     * iter.next(); // { value: 3, done: false }
+     * iter.next(); // { done: true }
+     */
+    next() {
+        const current = this.current();
+        this.index += 1;
+        const { ndm1, contiguous, } = this;
+        if (ndm1 === 0) {
+            this.next1d();
+        }
+        else if (contiguous) {
+            this.nextcontiguous();
+        }
+        else if (ndm1 === 1) {
+            this.next2d();
+        }
+        else {
+            this.nextnd();
+        }
+        return current;
+    }
+    [Symbol.iterator]() {
+        return this;
+    }
+}
+exports.NDIter = NDIter;
+/**
+ * @class NDMultiIter
+ * @description Constructs an NDMultiIter instance.
+ * @param {NDArray[]} ...args
+ */
+class NDMultiIter {
+    constructor(...args) {
+        this.iters = args.map(arg => new NDIter(arg));
+        this.numiter = args.length;
+        let i;
+        let nd;
+        for (i = 0, nd = 0; i < this.numiter; i += 1) {
+            nd = Math.max(nd, this.iters[i].x.shape.length);
+        }
+        this.nd = nd;
+        this.shape = Array(nd).fill(0);
+        let it;
+        let j;
+        let k;
+        let tmp;
+        for (i = 0; i < nd; i += 1) {
+            this.shape[i] = 1;
+            for (j = 0; j < this.numiter; j += 1) {
+                it = this.iters[j];
+                k = i + it.x.shape.length - nd;
+                if (k >= 0) {
+                    tmp = it.x.shape[k];
+                    if (tmp == 1) {
+                        continue;
+                    }
+                    if (this.shape[i] == 1) {
+                        this.shape[i] = tmp;
+                    }
+                    else if (this.shape[i] !== tmp) {
+                        throw new Error('shape mismatch');
+                    }
+                }
+            }
+        }
+        tmp = this.shape.reduce((acc, dim) => acc * dim, 1);
+        this.length = tmp;
+        this.lengthm1 = tmp - 1;
+        for (i = 0; i < this.numiter; i += 1) {
+            it = this.iters[i];
+            it.nd = this.nd;
+            it.ndm1 = this.nd - 1;
+            it.length = tmp;
+            it.lengthm1 = tmp - 1;
+            nd = it.x.shape.length;
+            if (nd !== 0) {
+                it.factors[this.nd - 1] = 1;
+            }
+            for (j = 0; j < this.nd; j += 1) {
+                it.shape[j] = this.shape[j];
+                it.shapem1[j] = this.shape[j] - 1;
+                k = j + nd - this.nd;
+                if ((k < 0) || it.x.shape[k] !== this.shape[j]) {
+                    it.contiguous = false;
+                    it.strides[j] = 0;
+                }
+                else {
+                    it.strides[j] = it.x.strides[k];
+                }
+                it.backstrides[j] = it.strides[j] * it.shapem1[j];
+                if (j > 0) {
+                    it.factors[this.nd - j - 1] = it.factors[this.nd - j] * this.shape[this.nd - j];
+                }
+            }
+        }
+        this.index = 0;
+        this.pos = Array(this.numiter).fill(0);
+    }
+    /**
+     * @function done
+     * @memberof NDMultiIter
+     * @description Returns true if the iterator is done, false otherwise
+     * @returns {Boolean}
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDMultiIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+     * iter.done(); // false
+     */
+    done() {
+        return this.index > this.lengthm1;
+    }
+    /**
+     * @function current
+     * @memberof NDMultiIter
+     * @description Returns the current indices of the iterators
+     * @returns {Object} current
+     * @returns {Number[]} [current.value]
+     * @returns {Boolean} current.done
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDMultiIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+     * iter.current(); // { value: [0, 0], done: false }
+     */
+    current() {
+        const done = this.done();
+        return {
+            value: done ? undefined : this.pos,
+            done,
+        };
+    }
+    /**
+     * @function next
+     * @memberof NDMultiIter
+     * @description
+     * Steps to the next position in the iterator.
+     * Returns the current indices of the iterators, or undefined if done.
+     * @returns {Object} current
+     * @returns {Number[]} [current.value]
+     * @returns {Boolean} current.done
+     * @example
+     * import { array } from 'vectorious/core/array';
+     * import { NDMultiIter } from 'vectorious/iterator';
+     *
+     * const iter = new NDMultiIter(array([1, 2, 3]), array([4, 5, 6]));
+     * iter.next(); // { value: [0, 0], done: false }
+     * iter.next(); // { value: [1, 1], done: false }
+     * iter.next(); // { value: [2, 2], done: false },
+     * iter.next(); // { value: undefined, done: true },
+     */
+    next() {
+        const current = this.current();
+        this.index += 1;
+        const { numiter, } = this;
+        let it;
+        let i;
+        for (i = 0; i < numiter; i += 1) {
+            it = this.iters[i];
+            this.pos[i] = it.pos;
+            it.next();
+        }
+        return current;
+    }
+    [Symbol.iterator]() {
+        return this;
+    }
+}
+exports.NDMultiIter = NDMultiIter;
+
+
+
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + diff --git a/docs/vectorious/6.0.4/module-Globals.html b/docs/vectorious/6.0.4/module-Globals.html new file mode 100644 index 00000000..783e2a02 --- /dev/null +++ b/docs/vectorious/6.0.4/module-Globals.html @@ -0,0 +1,14509 @@ + + + + + Vectorious: Globals + + + + + + + + + + + + + +
+ + + Vectorious + + +

+ + Vectorious + +

+ +
+ + +
+
+

Module

+

Globals

+ + + + + +
+ + +
+ + + + + +
+ +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + +

Methods

+ + + + + +
+ + + + + + + + + +
+ static +
+ +

abs(x) → {NDArray} +

+ + + + + +
+ +

Returns the absolute value of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { abs } from 'vectorious/core/abs';
+
+abs([-1, -2, -3]) // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

acos(x) → {NDArray} +

+ + + + + +
+ +

Returns the arccosine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { acos } from 'vectorious/core/acos';
+
+acos([-1, 0, 1]); // => array([3.141592653589793, 1.5707963267948966, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

acosh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic arccosine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { acosh } from 'vectorious/core/acosh';
+
+acosh([1, 2, 3]); // => array([0, 1.316957950592041, 1.7627471685409546])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

add(x, y) → {NDArray} +

+ + + + + +
+ +

Adds y multiplied by alpha to x. +Accelerated with BLAS ?axpy.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { add } from 'vectorious/core/add';
+
+add([1, 2, 3], [4, 5, 6]); // => array([5, 7, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

angle(x, y) → {number} +

+ + + + + +
+ +

Determines the angle between the x and y

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + number + + +
  • + +
+ + + + +

Example

+ +
import { angle } from 'vectorious/core/angle';
+
+angle([1, 2, 3], [4, 5, 6]); // => 0.22572622788897287
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

array() → {NDArray} +

+ + + + + +
+ +

array(...args) is an alias for new v(...args)

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...args + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { array } from 'vectorious/core/array';
+
+array([1, 2, 3]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

asin(x) → {NDArray} +

+ + + + + +
+ +

Returns the arcsine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { asin } from 'vectorious/core/asin';
+
+asin([-1, 0, 1]) // => array([-1.5707963705062866, 0, 1.5707963705062866])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

asinh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic arcsine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { asinh } from 'vectorious/core/asinh';
+
+asinh([0, 1, 2]) // => array([0, 0.8813735842704773, 1.4436354637145996])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

atan(x) → {NDArray} +

+ + + + + +
+ +

Returns the arctangent of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { atan } from 'vectorious/core/atan';
+
+atan([1, 2, 3]); // => array([0.7853981852531433, 1.1071487665176392, 1.249045729637146])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

atanh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic arctangent of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { atanh } from 'vectorious/core/atanh';
+
+atanh([0, -0.5]); // => array([0, -0.5493061542510986])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

augment(x, y) → {NDArray} +

+ + + + + +
+ +

Augments x and y.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { augment } from 'vectorious/core/augment';
+
+augment([[1, 2], [3, 4]], [[1], [2]]); // => array([[1, 2, 1], [3, 4, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

binOp(x, y) → {NDArray} +

+ + + + + +
+ +

Perform binary operation f on y in x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { binOp } from 'vectorious/core/binOp';
+
+binOp([1, 2, 3], [4, 5, 6], (a, b) => a + b); // => array([[5, 7, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

cbrt(x) → {NDArray} +

+ + + + + +
+ +

Returns the cube root of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { cbrt } from 'vectorious/core/cbrt';
+
+cbrt([1, 8, 27]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

ceil(x) → {NDArray} +

+ + + + + +
+ +

Returns smallest integer greater than or equal to of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { ceil } from 'vectorious/core/ceil';
+
+ceil([0.5, 1.5, 2.5]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

check(x) +

+ + + + + +
+ +

Asserts if indices i, j, ..., n are within the bounds of x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { check } from 'vectorious/core/check';
+
+check([0.5, 1.5, 2.5], 3); // Error: index out of bounds
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

index out of bounds

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

combine(x, y) → {NDArray} +

+ + + + + +
+ +

Combines the vector x with y

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { combine } from 'vectorious/core/combine';
+
+combine([1, 2, 3], [4, 5, 6]); // => array([1, 2, 3, 4, 5, 6])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

copy(x) → {NDArray} +

+ + + + + +
+ +

Makes a copy of x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { copy } from 'vectorious/core/copy';
+
+copy([1, 2, 3]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

cos(x) → {NDArray} +

+ + + + + +
+ +

Returns the cosine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { cos } from 'vectorious/core/cos';
+
+cos([0, Math.PI / 2, Math.PI]); // => array([1, 0, -1])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

cosh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic cosine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { cosh } from 'vectorious/core/cosh';
+
+cosh([0, 1, 2]); // => array([1, 1.5430806875228882, 3.762195587158203])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

cross(x, y) → {NDArray} +

+ + + + + +
+ +

Computes the cross product of the x and the vector y +This operation can only calculated for vectors with three components. +Otherwise it throws an exception.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { cross } from 'vectorious/core/cross';
+
+cross([1, 2, 3], [4, 5, 6]); // => array([-3, 6, -3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

det(x) → {Number} +

+ + + + + +
+ +

Gets the determinant of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { det } from 'vectorious/core/det';
+
+det([[0, 1], [2, 3]]); // => -2
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

diagonal(x) → {NDArray} +

+ + + + + +
+ +

Gets the diagonal of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { diagonal } from 'vectorious/core/diagonal';
+
+diagonal([[1, 2], [3, 4]]); // => array([1, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

dot(x, y) → {Number} +

+ + + + + +
+ +

Performs dot multiplication with x and y. +Accelerated with BLAS ?dot.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { dot } from 'vectorious/core/dot';
+
+dot([1, 2, 3], [4, 5, 6]); // => 32
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

eig(x) → {Array.<NDArray>} +

+ + + + + +
+ +

Gets eigenvalues and eigenvectors of x using the Jacobi method. +Accelerated with LAPACK ?geev.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<NDArray> + + +
  • + +
+ + + + +

Example

+ +
import { eig } from 'vectorious/core/eig';
+
+eig([[1, 0, 0], [0, 2, 0], [0, 0, 3]]); // => [array([1, 2, 3]), array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

equals(x, y, tolerance) → {Boolean} +

+ + + + + +
+ +

Checks if x and y are equal.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + tolerance + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Boolean + + +
  • + +
+ + + + +

Example

+ +
import { equals } from 'vectorious/core/equals';
+
+equals([1, 2, 3], [1, 2, 3]); // => true
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

equidimensional(x, y) +

+ + + + + +
+ +

Asserts if x and y have the same shape

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + +

Deprecated

+ +
  • Yes
+ + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { equidimensional } from 'vectorious/core/equidimensional';
+
+equidimensional([1, 2, 3], [1, 2]); // Error: shapes 3 and 2 do not match
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

shapes x and y do not match

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

equilateral(x, y) +

+ + + + + +
+ +

Asserts if x and y have the same length

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + +

Deprecated

+ +
  • Yes
+ + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { equilateral } from 'vectorious/core/equilateral';
+
+equilateral([1, 2, 3], [1, 2]); // Error: lengths 3 and 2 do not match
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

lengths x and y do not match

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

exp(x) → {NDArray} +

+ + + + + +
+ +

Returns e^x of each element of x, where x is the argument, +and e is Euler's constant (2.718…), the base of the natural logarithm.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { exp } from 'vectorious/core/exp';
+
+exp([1, 2, 3]); // => array([2.7182817459106445, 7.389056205749512, 20.08553695678711])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

expm1(x) → {NDArray} +

+ + + + + +
+ +

Returns subtracting 1 from exp(x) of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { expm1 } from 'vectorious/core/expm1';
+
+expm1([1, 2, 3]); // => array([1.7182817459106445, 6.389056205749512, 19.08553695678711])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

eye(n) → {NDArray} +

+ + + + + +
+ +

Creates an identity matrix of size n and type type.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + n + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { eye } from 'vectorious/core/eye';
+
+eye(2); // => array([[1, 0], [0, 1]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

fill(x, value) → {NDArray} +

+ + + + + +
+ +

Fills x with a scalar value

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { fill } from 'vectorious/core/fill';
+
+fill([1, 2, 3], 0); // => array([0, 0, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

floor(x) → {NDArray} +

+ + + + + +
+ +

Returns the largest integer less than or equal to a number of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { floor } from 'vectorious/core/floor';
+
+floor([1.5, 2.5, 3.5]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

forEach(x, f) +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.forEach.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + f + + + + + + + + function + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { forEach } from 'vectorious/core/forEach';
+
+forEach([1, 2, 3], console.log);
+// 1 0 [ 1, 2, 3 ]
+// 2 1 [ 1, 2, 3 ]
+// 3 2 [ 1, 2, 3 ]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

fround(x) → {NDArray} +

+ + + + + +
+ +

Returns the nearest single precision float representation of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { fround } from 'vectorious/core/fround';
+
+fround([-5.05, 5.05]); // => array([-5.050000190734863, 5.050000190734863])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

gauss(x) → {NDArray} +

+ + + + + +
+ +

Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of x. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { gauss } from 'vectorious/core/gauss';
+
+gauss([[1, 2, 3], [4, 5, 6]]); // => array([[1, 0, -1], [-0, 1, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

get(x) → {Number} +

+ + + + + +
+ +

Gets the element at i, j, ..., n from x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { get } from 'vectorious/core/get';
+
+get([1, 2, 3], 2); // 3
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

inv(x) → {NDArray} +

+ + + + + +
+ +

Determines the inverse of x. +Accelerated with LAPACK ?getrf and ?getri.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { inv } from 'vectorious/core/inv';
+
+inv([[2, -1, 0], [-1, 2, -1], [0, -1, 2]]); // => array([[0.75, 0.5, 0.25], [0.5, 1, 0.5], [0.25, 0.5, 0.75]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

log(x) → {NDArray} +

+ + + + + +
+ +

Returns the natural logarithm (log_e, also ln) of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { log } from 'vectorious/core/log';
+
+log([1, 2, 3]); // => array([0, 0.6931471824645996, 1.0986123085021973])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

log1p(x) → {NDArray} +

+ + + + + +
+ +

Returns the natural logarithm (log_e, also ln) of 1 + x for each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { log1p } from 'vectorious/core/log1p';
+
+log1p([1, 2, 3]); // => array([0.6931471824645996, 1.0986123085021973, 1.3862943649291992])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

log2(x) → {NDArray} +

+ + + + + +
+ +

Returns the base 2 logarithm of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { log2 } from 'vectorious/core/log2';
+
+log2([1, 2, 4]); // => array([0, 1, 2])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

log10(x) → {NDArray} +

+ + + + + +
+ +

Returns the base 10 logarithm of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { log10 } from 'vectorious/core/log10';
+
+log10([10, 100, 1000]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

lu(x) → {Array.<NDArray, Int32Array>} +

+ + + + + +
+ +

Performs full LU decomposition on x. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<NDArray, Int32Array> + + +
  • + +
+ + + + +

Example

+ +
import { lu } from 'vectorious/core/lu';
+
+lu([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[1, 0, 0], [0.5, 1, 0], [0.5, -1, 1]]), array([[2, 4, 7], [0, 1, 1.5], [0, 0, -2]]), Int32Array([2, 2, 3])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

lu_factor(x) → {Array.<(NDArray|Int32Array)>} +

+ + + + + +
+ +

Performs LU factorization on x. +Accelerated with LAPACK ?getrf.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array.<(NDArray|Int32Array)> + + +
  • + +
+ + + + +

Example

+ +
import { lu_factor } from 'vectorious/core/lu_factor';
+
+lu_factor([[1, 3, 5], [2, 4, 7], [1, 1, 0]]); // => [array([[2, 4, 7], [0.5, 1, 1.5], [0.5, -1, -2]]), Int32Array([2, 2, 3])]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

magic(n) → {NDArray} +

+ + + + + +
+ +

Creates a magic square matrix of size n

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + n + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { magic } from 'vectorious/core/magic';
+
+magic(3); // => array([[8, 1, 6], [3, 5, 7], [4, 9, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

map(x) → {NDArray} +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.map.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { map } from 'vectorious/core/map';
+
+map([1, 2, 3], value => -value); // => array([-1, -2, -3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

matrix(r, c) → {NDArray} +

+ + + + + +
+ +

Creates a matrix of r rows and c columns.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + r + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + c + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { matrix } from 'vectorious/core/matrix';
+
+matrix(2, 2); // => array([[0, 0], [0, 0]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

max(x) → {Number} +

+ + + + + +
+ +

Gets the maximum value (largest) element of x. +Accelerated with BLAS i?amax.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { max } from 'vectorious/core/max';
+
+max([1, 2, 3]); // => 3
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

mean(x) → {Number} +

+ + + + + +
+ +

Gets the arithmetic mean of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { mean } from 'vectorious/core/mean';
+
+mean([1, 2, 3]); // => 2
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

min(x) → {Number} +

+ + + + + +
+ +

Gets the minimum value (smallest) element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { min } from 'vectorious/core/min';
+
+min([1, 2, 3]); // => 1
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

multiply(x, y) → {NDArray} +

+ + + + + +
+ +

Multiplies two matrices x and y of matching dimensions. +Accelerated with BLAS ?gemm.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { multiply } from 'vectorious/core/multiply';
+
+multiply([[1, 2]], [[1], [2]]); // => array([[5]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

norm(x) → {Number} +

+ + + + + +
+ +

Calculates the norm of current array (also called L2 norm or Euclidean length). +Accelerated with BLAS ?nrm2.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { norm } from 'vectorious/core/norm';
+
+norm([1, 2, 3]); // => 3.7416574954986572
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

normalize(x) → {NDArray} +

+ + + + + +
+ +

Normalizes x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { normalize } from 'vectorious/core/normalize';
+
+normalize([1, 2, 3]); // => array([0.26726123690605164, 0.5345224738121033, 0.8017836809158325])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

ones() → {NDArray} +

+ + + + + +
+ +

Creates an array containing ones (1) of shape shape

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...shape + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { ones } from 'vectorious/core/ones';
+
+ones(3); // => array([1, 1, 1])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

pow(x, exponent) → {NDArray} +

+ + + + + +
+ +

Returns each element of x to the exponent power, that is, element^exponent.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + exponent + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { pow } from 'vectorious/core/pow';
+
+pow([1, 2, 3], 2); // => array([1, 4, 9])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

prod(x) → {Number} +

+ + + + + +
+ +

Product of all elements of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { prod } from 'vectorious/core/prod';
+
+prod([1, 2, 3]); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

product(x, y) → {NDArray} +

+ + + + + +
+ +

Hadamard product of x and y

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { product } from 'vectorious/core/product';
+
+product([1, 2, 3], [4, 5, 6]); // => array([4, 10, 18])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

project(x, y) → {NDArray} +

+ + + + + +
+ +

Projects the y onto x using the projection formula (y * (x * y / y * y)).

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { project } from 'vectorious/core/project';
+
+project([1, 2, 3], [4, 5, 6]); // => array([1.6623376607894897, 2.0779221057891846, 2.49350643157959])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

push(x, value) → {NDArray} +

+ + + + + +
+ +

Pushes a new value into x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { push } from 'vectorious/core/push';
+
+push([1, 2, 3], 4); // => array([1, 2, 3, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

random() → {NDArray} +

+ + + + + +
+ +

Creates a vector containing random samples from a uniform distribution over [0, 1) of shape shape

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...shape + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { random } from 'vectorious/core/random';
+
+random(3); // => array([0.27496153116226196, 0.7581521272659302, 0.3682245910167694])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

range(start, step, stop) → {NDArray} +

+ + + + + +
+ +

Creates an array containing a range (can be either ascending or descending) +of numbers specified by the arguments provided (e.g. NDArray.range(0, .5, 2) +gives an array containing all numbers in the interval [0, 2) separated by +steps of 0.5)

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + start + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + step + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + stop + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { range } from 'vectorious/core/range';
+
+range(1, 2, 9); // => array([1, 3, 5, 7])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

rank(x, tolerance) → {Number} +

+ + + + + +
+ +

Finds the rank of x using gaussian elimination.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + tolerance + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { rank } from 'vectorious/core/rank';
+
+rank([[1, 1, 1], [2, 2, 2], [3, 3, 3]]); // => 1
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

reciprocal(x) → {NDArray} +

+ + + + + +
+ +

Gets the element-wise reciprocal of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { reciprocal } from 'vectorious/core/reciprocal';
+
+reciprocal([1, 2, 3]); // => array([1, 0.5, 0.3333333432674408])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

reduce(x, f, initialValue) → {Number} +

+ + + + + +
+ +

Equivalent to TypedArray.prototype.reduce.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + f + + + + + + + + function + + + + + + + + + +
    + +
  • + + + +
  • + + initialValue + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { reduce } from 'vectorious/core/reduce';
+
+reduce([1, 2, 3], (a, b) => a + b, 0); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

reshape(x) → {NDArray} +

+ + + + + +
+ +

Reshapes x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + ...shape + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { reshape } from 'vectorious/core/reshape';
+
+reshape([1, 2, 3, 4], 2, 2); // => array([[1, 2], [3, 4]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

round(x) → {NDArray} +

+ + + + + +
+ +

Returns the value of each element of x rounded to the nearest integer.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { round } from 'vectorious/core/round';
+
+round([1.2, 2.8, 3.5]); // => array([1, 3, 4])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

row_add(x, dest, source, scalar) → {NDArray} +

+ + + + + +
+ +

Adds a multiple of one row multiplied by scalar to another inside x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + dest + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + source + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + scalar + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { row_add } from 'vectorious/core/row_add';
+
+row_add([[1, 2], [3, 4]], 1, 0, 2); // => array([[1, 2], [5, 8]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

scale(x, scalar) → {NDArray} +

+ + + + + +
+ +

Multiplies all elements of x with a specified scalar. +Accelerated with BLAS ?scal.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + scalar + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { scale } from 'vectorious/core/scale';
+
+scale([1, 2, 3], 2); // => array([2, 4, 6])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

set(x, value) → {NDArray} +

+ + + + + +
+ +

Sets the element at i, j, ..., n to value.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + ...indices + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + + +
  • + + value + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { set } from 'vectorious/core/set';
+
+set([1, 2, 3], 1, 0); // => array([1, 0, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

sign(x) → {NDArray} +

+ + + + + +
+ +

Returns the sign of each element of x, indicating +whether it is positive, negative or zero.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { sign } from 'vectorious/core/sign';
+
+sign([1, 2, 3]); // => array([1, 1, 1])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

sin(x) → {NDArray} +

+ + + + + +
+ +

Returns the sine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { sin } from 'vectorious/core/sin';
+
+sin([0, Math.PI / 2, Math.PI]); // => array([0, 1, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

sinh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic sine of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { sinh } from 'vectorious/core/sinh';
+
+sinh([1, 2, 3]); // => array([1.175201177597046, 3.6268603801727295, 10.017874717712402])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

slice(x, begin, end, step) → {NDArray} +

+ + + + + +
+ +

Slices x in the corresponding dimension

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + begin + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + end + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + step + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { slice } from 'vectorious/core/slice';
+
+slice([1, 2, 3, 4], 0, 4, 2); // => array([1, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

solve(x, y) → {NDArray} +

+ + + + + +
+ +

Solves the equation AX = B (where A is x and B is y). +Accelerated with LAPACK ?gesv.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + y + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { solve } from 'vectorious/core/solve';
+
+solve([[1, 3, 5], [2, 4, 7], [1, 1, 0]], [[1], [3], [5]]); // => array([[3.25], [1.75], [-1.5]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

sqrt(x) → {NDArray} +

+ + + + + +
+ +

Returns the positive square root of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { sqrt } from 'vectorious/core/sqrt';
+
+sqrt([1, 4, 9]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

square(x) +

+ + + + + +
+ +

Asserts if x is square.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +

Example

+ +
import { square } from 'vectorious/core/square';
+
+square([1, 2, 3]); // Error: matrix is not square
+ + + + + + + + + + + + +

Throws

+ + + +
+
+
+

matrix is not square

+
+
+
+
+
+
+ Type +
+
+ + + + + Error + + + +
+
+
+
+
+ + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

subtract(x) → {NDArray} +

+ + + + + +
+ +

Subtracts y from x. +Accelerated with BLAS ?axpy.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { subtract } from 'vectorious/core/subtract';
+
+subtract([1, 2, 3], [1, 1, 1]); // => array([0, 1, 2])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

sum(x) → {Number} +

+ + + + + +
+ +

Sum of x

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { sum } from 'vectorious/core/sum';
+
+sum([1, 2, 3]); // => 6
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

swap(x, i, j) → {NDArray} +

+ + + + + +
+ +

Swaps two rows i and j in x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + + +
  • + + i + + + + + + + + Number + + + + + + + + + +
    + +
  • + + + +
  • + + j + + + + + + + + Number + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { swap } from 'vectorious/core/swap';
+
+swap([[1, 2], [3, 4]], 0, 1); // => array([[3, 4], [1, 2]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

tan(x) → {NDArray} +

+ + + + + +
+ +

Returns the tangent of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { tan } from 'vectorious/core/tan';
+
+tan([1, 2, 3]); // => array([1.5574077367782593, -2.185039758682251, -0.14254654943943024])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

tanh(x) → {NDArray} +

+ + + + + +
+ +

Returns the hyperbolic tangent of each element of x.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { tanh } from 'vectorious/core/tanh';
+
+tanh([1, 2, 3]); // => array([0.7615941762924194, 0.9640275835990906, 0.9950547814369202])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

toArray(x) → {Array} +

+ + + + + +
+ +

Converts x into a JavaScript array.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Array + + +
  • + +
+ + + + +

Example

+ +
import { toArray } from 'vectorious/core/toArray';
+
+toArray([1, 2, 3]); // => [1, 2, 3]
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

toString(x) → {String} +

+ + + + + +
+ +

Converts x into a readable formatted string.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + String + + +
  • + +
+ + + + +

Example

+ +
import { toString } from 'vectorious/core/toString';
+
+toString([1, 2, 3]); // => '1,2,3'
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

trace(x) → {Number} +

+ + + + + +
+ +

Gets the trace of x (the sum of all diagonal elements).

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + Number + + +
  • + +
+ + + + +

Example

+ +
import { trace } from 'vectorious/core/trace';
+
+trace([[1, 2], [3, 4]]); // => 5
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

transpose(x) → {NDArray} +

+ + + + + +
+ +

Transposes x (mirror across the diagonal).

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { transpose } from 'vectorious/core/transpose';
+
+transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); // => array([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

trunc(x) → {NDArray} +

+ + + + + +
+ +

Returns the integer part of each element of x, +removing any fractional digits.

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + x + + + + + + + + NDArray + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { trunc } from 'vectorious/core/trunc';
+
+trunc([1.2, 2.8, 3.5]); // => array([1, 2, 3])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + +
+ + + + + + + + + +
+ static +
+ +

zeros() → {NDArray} +

+ + + + + +
+ +

Creates an array containing zeros (0) of shape shape

+
+ + + + + + + + + +

Parameters

+ + +
    + + +
  • + + ...shape + + + + + + + + Array.<Number> + + + + + + + + + +
    + +
  • + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Returns

+
    + +
  • + + NDArray + + +
  • + +
+ + + + +

Example

+ +
import { zeros } from 'vectorious/core/zeros';
+
+zeros(3); // => array([0, 0, 0])
+ + + + + + + + + + + + + + +

Source

+ + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ +
+
+ Documentation generated by JSDoc 3.6.6 on Sun Apr 18 2021 15:09:56 GMT+0200 (Central European Summer Time) +
+
+ + + \ No newline at end of file diff --git a/docs/vectorious/6.0.4/scripts/prism-linenumbers.js b/docs/vectorious/6.0.4/scripts/prism-linenumbers.js new file mode 100644 index 00000000..67ede74a --- /dev/null +++ b/docs/vectorious/6.0.4/scripts/prism-linenumbers.js @@ -0,0 +1,57 @@ +(function() { + +if (typeof self === 'undefined' || !self.Prism || !self.document) { + return; +} + +Prism.hooks.add('complete', function (env) { + if (!env.code) { + return; + } + + // works only for wrapped inside
 (not inline)
+  var pre = env.element.parentNode;
+  var clsReg = /\s*\bline-numbers\b\s*/;
+  if (
+    !pre || !/pre/i.test(pre.nodeName) ||
+      // Abort only if nor the 
 nor the  have the class
+    (!clsReg.test(pre.className) && !clsReg.test(env.element.className))
+  ) {
+    return;
+  }
+
+  if (env.element.querySelector(".line-numbers-rows")) {
+    // Abort if line numbers already exists
+    return;
+  }
+
+  if (clsReg.test(env.element.className)) {
+    // Remove the class "line-numbers" from the 
+    env.element.className = env.element.className.replace(clsReg, '');
+  }
+  if (!clsReg.test(pre.className)) {
+    // Add the class "line-numbers" to the 
+    pre.className += ' line-numbers';
+  }
+
+  var match = env.code.match(/\n(?!$)/g);
+  var linesNum = match ? match.length + 1 : 1;
+  var lineNumbersWrapper;
+
+  var lines = new Array(linesNum + 1);
+  lines = lines.join('');
+
+  lineNumbersWrapper = document.createElement('span');
+  lineNumbersWrapper.setAttribute('aria-hidden', 'true');
+  lineNumbersWrapper.className = 'line-numbers-rows';
+  lineNumbersWrapper.innerHTML = lines;
+
+  if (pre.hasAttribute('data-start')) {
+    pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
+  }
+
+  env.element.appendChild(lineNumbersWrapper);
+
+});
+
+}());
\ No newline at end of file
diff --git a/docs/vectorious/6.0.4/scripts/prism.dev.js b/docs/vectorious/6.0.4/scripts/prism.dev.js
new file mode 100644
index 00000000..beb5e582
--- /dev/null
+++ b/docs/vectorious/6.0.4/scripts/prism.dev.js
@@ -0,0 +1,1115 @@
+/* PrismJS 1.13.0
+http://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+json&plugins=line-highlight+line-numbers */
+var _self = (typeof window !== 'undefined')
+	? window   // if in browser
+	: (
+		(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
+		? self // if in worker
+		: {}   // if in node js
+	);
+
+/**
+ * Prism: Lightweight, robust, elegant syntax highlighting
+ * MIT license http://www.opensource.org/licenses/mit-license.php/
+ * @author Lea Verou http://lea.verou.me
+ */
+
+var Prism = (function(){
+
+// Private helper vars
+var lang = /\blang(?:uage)?-(\w+)\b/i;
+var uniqueId = 0;
+
+var _ = _self.Prism = {
+	manual: _self.Prism && _self.Prism.manual,
+	disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
+	util: {
+		encode: function (tokens) {
+			if (tokens instanceof Token) {
+				return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
+			} else if (_.util.type(tokens) === 'Array') {
+				return tokens.map(_.util.encode);
+			} else {
+				return tokens.replace(/&/g, '&').replace(/ text.length) {
+						// Something went terribly wrong, ABORT, ABORT!
+						return;
+					}
+
+					if (str instanceof Token) {
+						continue;
+					}
+
+					if (greedy && i != strarr.length - 1) {
+						pattern.lastIndex = pos;
+						var match = pattern.exec(text);
+						if (!match) {
+							break;
+						}
+
+						var from = match.index + (lookbehind ? match[1].length : 0),
+						    to = match.index + match[0].length,
+						    k = i,
+						    p = pos;
+
+						for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
+							p += strarr[k].length;
+							// Move the index i to the element in strarr that is closest to from
+							if (from >= p) {
+								++i;
+								pos = p;
+							}
+						}
+
+						// If strarr[i] is a Token, then the match starts inside another Token, which is invalid
+						if (strarr[i] instanceof Token) {
+							continue;
+						}
+
+						// Number of tokens to delete and replace with the new match
+						delNum = k - i;
+						str = text.slice(pos, p);
+						match.index -= pos;
+					} else {
+						pattern.lastIndex = 0;
+
+						var match = pattern.exec(str),
+							delNum = 1;
+					}
+
+					if (!match) {
+						if (oneshot) {
+							break;
+						}
+
+						continue;
+					}
+
+					if(lookbehind) {
+						lookbehindLength = match[1] ? match[1].length : 0;
+					}
+
+					var from = match.index + lookbehindLength,
+					    match = match[0].slice(lookbehindLength),
+					    to = from + match.length,
+					    before = str.slice(0, from),
+					    after = str.slice(to);
+
+					var args = [i, delNum];
+
+					if (before) {
+						++i;
+						pos += before.length;
+						args.push(before);
+					}
+
+					var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
+
+					args.push(wrapped);
+
+					if (after) {
+						args.push(after);
+					}
+
+					Array.prototype.splice.apply(strarr, args);
+
+					if (delNum != 1)
+						_.matchGrammar(text, strarr, grammar, i, pos, true, token);
+
+					if (oneshot)
+						break;
+				}
+			}
+		}
+	},
+
+	tokenize: function(text, grammar, language) {
+		var strarr = [text];
+
+		var rest = grammar.rest;
+
+		if (rest) {
+			for (var token in rest) {
+				grammar[token] = rest[token];
+			}
+
+			delete grammar.rest;
+		}
+
+		_.matchGrammar(text, strarr, grammar, 0, 0, false);
+
+		return strarr;
+	},
+
+	hooks: {
+		all: {},
+
+		add: function (name, callback) {
+			var hooks = _.hooks.all;
+
+			hooks[name] = hooks[name] || [];
+
+			hooks[name].push(callback);
+		},
+
+		run: function (name, env) {
+			var callbacks = _.hooks.all[name];
+
+			if (!callbacks || !callbacks.length) {
+				return;
+			}
+
+			for (var i=0, callback; callback = callbacks[i++];) {
+				callback(env);
+			}
+		}
+	}
+};
+
+var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
+	this.type = type;
+	this.content = content;
+	this.alias = alias;
+	// Copy of the full string this token was created from
+	this.length = (matchedStr || "").length|0;
+	this.greedy = !!greedy;
+};
+
+Token.stringify = function(o, language, parent) {
+	if (typeof o == 'string') {
+		return o;
+	}
+
+	if (_.util.type(o) === 'Array') {
+		return o.map(function(element) {
+			return Token.stringify(element, language, o);
+		}).join('');
+	}
+
+	var env = {
+		type: o.type,
+		content: Token.stringify(o.content, language, parent),
+		tag: 'span',
+		classes: ['token', o.type],
+		attributes: {},
+		language: language,
+		parent: parent
+	};
+
+	if (o.alias) {
+		var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
+		Array.prototype.push.apply(env.classes, aliases);
+	}
+
+	_.hooks.run('wrap', env);
+
+	var attributes = Object.keys(env.attributes).map(function(name) {
+		return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
+	}).join(' ');
+
+	return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '';
+
+};
+
+if (!_self.document) {
+	if (!_self.addEventListener) {
+		// in Node.js
+		return _self.Prism;
+	}
+
+	if (!_.disableWorkerMessageHandler) {
+		// In worker
+		_self.addEventListener('message', function (evt) {
+			var message = JSON.parse(evt.data),
+				lang = message.language,
+				code = message.code,
+				immediateClose = message.immediateClose;
+
+			_self.postMessage(_.highlight(code, _.languages[lang], lang));
+			if (immediateClose) {
+				_self.close();
+			}
+		}, false);
+	}
+
+	return _self.Prism;
+}
+
+//Get current script and highlight
+var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
+
+if (script) {
+	_.filename = script.src;
+
+	if (!_.manual && !script.hasAttribute('data-manual')) {
+		if(document.readyState !== "loading") {
+			if (window.requestAnimationFrame) {
+				window.requestAnimationFrame(_.highlightAll);
+			} else {
+				window.setTimeout(_.highlightAll, 16);
+			}
+		}
+		else {
+			document.addEventListener('DOMContentLoaded', _.highlightAll);
+		}
+	}
+}
+
+return _self.Prism;
+
+})();
+
+if (typeof module !== 'undefined' && module.exports) {
+	module.exports = Prism;
+}
+
+// hack for components to work correctly in node.js
+if (typeof global !== 'undefined') {
+	global.Prism = Prism;
+}
+;
+Prism.languages.markup = {
+	'comment': //,
+	'prolog': /<\?[\s\S]+?\?>/,
+	'doctype': //i,
+	'cdata': //i,
+	'tag': {
+		pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
+		greedy: true,
+		inside: {
+			'tag': {
+				pattern: /^<\/?[^\s>\/]+/i,
+				inside: {
+					'punctuation': /^<\/?/,
+					'namespace': /^[^\s>\/:]+:/
+				}
+			},
+			'attr-value': {
+				pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
+				inside: {
+					'punctuation': [
+						/^=/,
+						{
+							pattern: /(^|[^\\])["']/,
+							lookbehind: true
+						}
+					]
+				}
+			},
+			'punctuation': /\/?>/,
+			'attr-name': {
+				pattern: /[^\s>\/]+/,
+				inside: {
+					'namespace': /^[^\s>\/:]+:/
+				}
+			}
+
+		}
+	},
+	'entity': /&#?[\da-z]{1,8};/i
+};
+
+Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
+	Prism.languages.markup['entity'];
+
+// Plugin to make entity title show the real entity, idea by Roman Komarov
+Prism.hooks.add('wrap', function(env) {
+
+	if (env.type === 'entity') {
+		env.attributes['title'] = env.content.replace(/&/, '&');
+	}
+});
+
+Prism.languages.xml = Prism.languages.markup;
+Prism.languages.html = Prism.languages.markup;
+Prism.languages.mathml = Prism.languages.markup;
+Prism.languages.svg = Prism.languages.markup;
+
+Prism.languages.css = {
+	'comment': /\/\*[\s\S]*?\*\//,
+	'atrule': {
+		pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
+		inside: {
+			'rule': /@[\w-]+/
+			// See rest below
+		}
+	},
+	'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
+	'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
+	'string': {
+		pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+		greedy: true
+	},
+	'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
+	'important': /\B!important\b/i,
+	'function': /[-a-z0-9]+(?=\()/i,
+	'punctuation': /[(){};:]/
+};
+
+Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
+
+if (Prism.languages.markup) {
+	Prism.languages.insertBefore('markup', 'tag', {
+		'style': {
+			pattern: /()[\s\S]*?(?=<\/style>)/i,
+			lookbehind: true,
+			inside: Prism.languages.css,
+			alias: 'language-css',
+			greedy: true
+		}
+	});
+
+	Prism.languages.insertBefore('inside', 'attr-value', {
+		'style-attr': {
+			pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
+			inside: {
+				'attr-name': {
+					pattern: /^\s*style/i,
+					inside: Prism.languages.markup.tag.inside
+				},
+				'punctuation': /^\s*=\s*['"]|['"]\s*$/,
+				'attr-value': {
+					pattern: /.+/i,
+					inside: Prism.languages.css
+				}
+			},
+			alias: 'language-css'
+		}
+	}, Prism.languages.markup.tag);
+};
+Prism.languages.clike = {
+	'comment': [
+		{
+			pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
+			lookbehind: true
+		},
+		{
+			pattern: /(^|[^\\:])\/\/.*/,
+			lookbehind: true,
+			greedy: true
+		}
+	],
+	'string': {
+		pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+		greedy: true
+	},
+	'class-name': {
+		pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
+		lookbehind: true,
+		inside: {
+			punctuation: /[.\\]/
+		}
+	},
+	'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
+	'boolean': /\b(?:true|false)\b/,
+	'function': /[a-z0-9_]+(?=\()/i,
+	'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
+	'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
+	'punctuation': /[{}[\];(),.:]/
+};
+
+Prism.languages.javascript = Prism.languages.extend('clike', {
+	'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
+	'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
+	// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
+	'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,
+	'operator': /-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
+});
+
+Prism.languages.insertBefore('javascript', 'keyword', {
+	'regex': {
+		pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
+		lookbehind: true,
+		greedy: true
+	},
+	// This must be declared before keyword because we use "function" inside the look-forward
+	'function-variable': {
+		pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
+		alias: 'function'
+	},
+	'constant': /\b[A-Z][A-Z\d_]*\b/
+});
+
+Prism.languages.insertBefore('javascript', 'string', {
+	'template-string': {
+		pattern: /`(?:\\[\s\S]|[^\\`])*`/,
+		greedy: true,
+		inside: {
+			'interpolation': {
+				pattern: /\$\{[^}]+\}/,
+				inside: {
+					'interpolation-punctuation': {
+						pattern: /^\$\{|\}$/,
+						alias: 'punctuation'
+					},
+					rest: Prism.languages.javascript
+				}
+			},
+			'string': /[\s\S]+/
+		}
+	}
+});
+
+if (Prism.languages.markup) {
+	Prism.languages.insertBefore('markup', 'tag', {
+		'script': {
+			pattern: /()[\s\S]*?(?=<\/script>)/i,
+			lookbehind: true,
+			inside: Prism.languages.javascript,
+			alias: 'language-javascript',
+			greedy: true
+		}
+	});
+}
+
+Prism.languages.js = Prism.languages.javascript;
+
+Prism.languages.json = {
+	'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
+	'string': {
+		pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
+		greedy: true
+	},
+	'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
+	'punctuation': /[{}[\]);,]/,
+	'operator': /:/g,
+	'boolean': /\b(?:true|false)\b/i,
+	'null': /\bnull\b/i
+};
+
+Prism.languages.jsonp = Prism.languages.json;
+
+(function(){
+
+if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
+	return;
+}
+
+function $$(expr, con) {
+	return Array.prototype.slice.call((con || document).querySelectorAll(expr));
+}
+
+function hasClass(element, className) {
+  className = " " + className + " ";
+  return (" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(className) > -1
+}
+
+// Some browsers round the line-height, others don't.
+// We need to test for it to position the elements properly.
+var isLineHeightRounded = (function() {
+	var res;
+	return function() {
+		if(typeof res === 'undefined') {
+			var d = document.createElement('div');
+			d.style.fontSize = '13px';
+			d.style.lineHeight = '1.5';
+			d.style.padding = 0;
+			d.style.border = 0;
+			d.innerHTML = ' 
 '; + document.body.appendChild(d); + // Browsers that round the line-height should have offsetHeight === 38 + // The others should have 39. + res = d.offsetHeight === 38; + document.body.removeChild(d); + } + return res; + } +}()); + +function highlightLines(pre, lines, classes) { + lines = typeof lines === 'string' ? lines : pre.getAttribute('data-line'); + + var ranges = lines.replace(/\s+/g, '').split(','), + offset = +pre.getAttribute('data-line-offset') || 0; + + var parseMethod = isLineHeightRounded() ? parseInt : parseFloat; + var lineHeight = parseMethod(getComputedStyle(pre).lineHeight); + var hasLineNumbers = hasClass(pre, 'line-numbers'); + + for (var i=0, currentRange; currentRange = ranges[i++];) { + var range = currentRange.split('-'); + + var start = +range[0], + end = +range[1] || start; + + var line = pre.querySelector('.line-highlight[data-range="' + currentRange + '"]') || document.createElement('div'); + + line.setAttribute('aria-hidden', 'true'); + line.setAttribute('data-range', currentRange); + line.className = (classes || '') + ' line-highlight'; + + //if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers + if(hasLineNumbers && Prism.plugins.lineNumbers) { + var startNode = Prism.plugins.lineNumbers.getLine(pre, start); + var endNode = Prism.plugins.lineNumbers.getLine(pre, end); + + if (startNode) { + line.style.top = startNode.offsetTop + 'px'; + } + + if (endNode) { + line.style.height = (endNode.offsetTop - startNode.offsetTop) + endNode.offsetHeight + 'px'; + } + } else { + line.setAttribute('data-start', start); + + if(end > start) { + line.setAttribute('data-end', end); + } + + line.style.top = (start - offset - 1) * lineHeight + 'px'; + + line.textContent = new Array(end - start + 2).join(' \n'); + } + + //allow this to play nicely with the line-numbers plugin + if(hasLineNumbers) { + //need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning + pre.appendChild(line); + } else { + (pre.querySelector('code') || pre).appendChild(line); + } + } +} + +function applyHash() { + var hash = location.hash.slice(1); + + // Remove pre-existing temporary lines + $$('.temporary.line-highlight').forEach(function (line) { + line.parentNode.removeChild(line); + }); + + var range = (hash.match(/\.([\d,-]+)$/) || [,''])[1]; + + if (!range || document.getElementById(hash)) { + return; + } + + var id = hash.slice(0, hash.lastIndexOf('.')), + pre = document.getElementById(id); + + if (!pre) { + return; + } + + if (!pre.hasAttribute('data-line')) { + pre.setAttribute('data-line', ''); + } + + highlightLines(pre, range, 'temporary '); + + document.querySelector('.temporary.line-highlight').scrollIntoView(); + + // offset fixed header with buffer + window.scrollBy(0, -100); +} + +var fakeTimer = 0; // Hack to limit the number of times applyHash() runs + +Prism.hooks.add('before-sanity-check', function(env) { + var pre = env.element.parentNode; + var lines = pre && pre.getAttribute('data-line'); + + if (!pre || !lines || !/pre/i.test(pre.nodeName)) { + return; + } + + /* + * Cleanup for other plugins (e.g. autoloader). + * + * Sometimes blocks are highlighted multiple times. It is necessary + * to cleanup any left-over tags, because the whitespace inside of the
+ * tags change the content of the tag. + */ + var num = 0; + $$('.line-highlight', pre).forEach(function (line) { + num += line.textContent.length; + line.parentNode.removeChild(line); + }); + // Remove extra whitespace + if (num && /^( \n)+$/.test(env.code.slice(-num))) { + env.code = env.code.slice(0, -num); + } +}); + +Prism.hooks.add('complete', function completeHook(env) { + var pre = env.element.parentNode; + var lines = pre && pre.getAttribute('data-line'); + + if (!pre || !lines || !/pre/i.test(pre.nodeName)) { + return; + } + + clearTimeout(fakeTimer); + + var hasLineNumbers = Prism.plugins.lineNumbers; + var isLineNumbersLoaded = env.plugins && env.plugins.lineNumbers; + + if (hasClass(pre, 'line-numbers') && hasLineNumbers && !isLineNumbersLoaded) { + Prism.hooks.add('line-numbers', completeHook); + } else { + highlightLines(pre, lines); + fakeTimer = setTimeout(applyHash, 1); + } +}); + + window.addEventListener('load', applyHash); + window.addEventListener('hashchange', applyHash); + window.addEventListener('resize', function () { + var preElements = document.querySelectorAll('pre[data-line]'); + Array.prototype.forEach.call(preElements, function (pre) { + highlightLines(pre); + }); + }); + +})(); +(function () { + + if (typeof self === 'undefined' || !self.Prism || !self.document) { + return; + } + + /** + * Plugin name which is used as a class name for
 which is activating the plugin
+	 * @type {String}
+	 */
+	var PLUGIN_NAME = 'line-numbers';
+
+	/**
+	 * Regular expression used for determining line breaks
+	 * @type {RegExp}
+	 */
+	var NEW_LINE_EXP = /\n(?!$)/g;
+
+	/**
+	 * Resizes line numbers spans according to height of line of code
+	 * @param {Element} element 
 element
+	 */
+	var _resizeElement = function (element) {
+		var codeStyles = getStyles(element);
+		var whiteSpace = codeStyles['white-space'];
+
+		if (whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line') {
+			var codeElement = element.querySelector('code');
+			var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
+			var lineNumberSizer = element.querySelector('.line-numbers-sizer');
+			var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
+
+			if (!lineNumberSizer) {
+				lineNumberSizer = document.createElement('span');
+				lineNumberSizer.className = 'line-numbers-sizer';
+
+				codeElement.appendChild(lineNumberSizer);
+			}
+
+			lineNumberSizer.style.display = 'block';
+
+			codeLines.forEach(function (line, lineNumber) {
+				lineNumberSizer.textContent = line || '\n';
+				var lineSize = lineNumberSizer.getBoundingClientRect().height;
+				lineNumbersWrapper.children[lineNumber].style.height = lineSize + 'px';
+			});
+
+			lineNumberSizer.textContent = '';
+			lineNumberSizer.style.display = 'none';
+		}
+	};
+
+	/**
+	 * Returns style declarations for the element
+	 * @param {Element} element
+	 */
+	var getStyles = function (element) {
+		if (!element) {
+			return null;
+		}
+
+		return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
+	};
+
+	window.addEventListener('resize', function () {
+		Array.prototype.forEach.call(document.querySelectorAll('pre.' + PLUGIN_NAME), _resizeElement);
+	});
+
+	Prism.hooks.add('complete', function (env) {
+		if (!env.code) {
+			return;
+		}
+
+		// works only for  wrapped inside 
 (not inline)
+		var pre = env.element.parentNode;
+		var clsReg = /\s*\bline-numbers\b\s*/;
+		if (
+			!pre || !/pre/i.test(pre.nodeName) ||
+			// Abort only if nor the 
 nor the  have the class
+			(!clsReg.test(pre.className) && !clsReg.test(env.element.className))
+		) {
+			return;
+		}
+
+		if (env.element.querySelector('.line-numbers-rows')) {
+			// Abort if line numbers already exists
+			return;
+		}
+
+		if (clsReg.test(env.element.className)) {
+			// Remove the class 'line-numbers' from the 
+			env.element.className = env.element.className.replace(clsReg, ' ');
+		}
+		if (!clsReg.test(pre.className)) {
+			// Add the class 'line-numbers' to the 
+			pre.className += ' line-numbers';
+		}
+
+		var match = env.code.match(NEW_LINE_EXP);
+		var linesNum = match ? match.length + 1 : 1;
+		var lineNumbersWrapper;
+
+		var lines = new Array(linesNum + 1);
+		lines = lines.join('');
+
+		lineNumbersWrapper = document.createElement('span');
+		lineNumbersWrapper.setAttribute('aria-hidden', 'true');
+		lineNumbersWrapper.className = 'line-numbers-rows';
+		lineNumbersWrapper.innerHTML = lines;
+
+		if (pre.hasAttribute('data-start')) {
+			pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
+		}
+
+		env.element.appendChild(lineNumbersWrapper);
+
+		_resizeElement(pre);
+
+		Prism.hooks.run('line-numbers', env);
+	});
+
+	Prism.hooks.add('line-numbers', function (env) {
+		env.plugins = env.plugins || {};
+		env.plugins.lineNumbers = true;
+	});
+
+	/**
+	 * Global exports
+	 */
+	Prism.plugins.lineNumbers = {
+		/**
+		 * Get node for provided line number
+		 * @param {Element} element pre element
+		 * @param {Number} number line number
+		 * @return {Element|undefined}
+		 */
+		getLine: function (element, number) {
+			if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
+				return;
+			}
+
+			var lineNumberRows = element.querySelector('.line-numbers-rows');
+			var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
+			var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
+
+			if (number < lineNumberStart) {
+				number = lineNumberStart;
+			}
+			if (number > lineNumberEnd) {
+				number = lineNumberEnd;
+			}
+
+			var lineIndex = number - lineNumberStart;
+
+			return lineNumberRows.children[lineIndex];
+		}
+	};
+
+}());
diff --git a/docs/vectorious/6.0.4/scripts/prism.js b/docs/vectorious/6.0.4/scripts/prism.js
new file mode 100644
index 00000000..fb7b2a9a
--- /dev/null
+++ b/docs/vectorious/6.0.4/scripts/prism.js
@@ -0,0 +1,9 @@
+/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+json+yaml&plugins=line-numbers */
+var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(c?b[1].length:0),_=b.index+b[0].length,P=m,A=y,j=r.length;j>P&&_>A;++P)A+=r[P].length,w>=A&&(++m,y=A);if(r[m]instanceof a||r[P-1].greedy)continue;k=P-m,v=e.slice(y,A),b.index-=y}if(b){c&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),S=[m,k];x&&S.push(x);var N=new a(i,g?n.tokenize(b,g):b,d,b,h);S.push(N),O&&S.push(O),Array.prototype.splice.apply(r,S)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
+Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
+Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
+Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
+Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
+Prism.languages.json={property:/"(?:\\.|[^\\"])*"(?=\s*:)/gi,string:/"(?!:)(?:\\.|[^\\"])*"(?!:)/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,punctuation:/[{}[\]);,]/g,operator:/:/g,"boolean":/\b(true|false)\b/gi,"null":/\bnull\b/gi},Prism.languages.jsonp=Prism.languages.json;
+Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*(?:^|[:\-,[{\r\n?])[ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0,greedy:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
+!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(s.test(t.className)||s.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s,"")),s.test(t.className)||(t.className+=" line-numbers");var n,a=e.code.match(/\n(?!$)/g),l=a?a.length+1:1,r=new Array(l+1);r=r.join(""),n=document.createElement("span"),n.setAttribute("aria-hidden","true"),n.className="line-numbers-rows",n.innerHTML=r,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(n)}}})}();
diff --git a/docs/vectorious/6.0.4/scripts/prism.min.js b/docs/vectorious/6.0.4/scripts/prism.min.js
new file mode 100644
index 00000000..4108adac
--- /dev/null
+++ b/docs/vectorious/6.0.4/scripts/prism.min.js
@@ -0,0 +1,11 @@
+/* PrismJS 1.13.0
+http://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+json&plugins=line-highlight+line-numbers+autolinker */
+var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof r?new r(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof s)){if(m&&b!=t.length-1){h.lastIndex=k;var _=h.exec(e);if(!_)break;for(var j=_.index+(d?_[1].length:0),P=_.index+_[0].length,A=b,x=k,O=t.length;O>A&&(P>x||!t[A].type&&!t[A-1].greedy);++A)x+=t[A].length,j>=x&&(++b,k=x);if(t[b]instanceof s)continue;I=A-b,w=e.slice(k,x),_.index-=k}else{h.lastIndex=0;var _=h.exec(w),I=1}if(_){d&&(p=_[1]?_[1].length:0);var j=_.index+p,_=_[0].slice(p),P=j+_.length,N=w.slice(0,j),S=w.slice(P),C=[b,I];N&&(++b,k+=N.length,C.push(N));var E=new s(u,f?n.tokenize(_,f):_,y,_,m);if(C.push(E),S&&C.push(S),Array.prototype.splice.apply(t,C),1!=I&&n.matchGrammar(e,t,r,b,k,!0,u),i)break}else if(i)break}}}}},tokenize:function(e,t){var r=[e],a=t.rest;if(a){for(var l in a)t[l]=a[l];delete t.rest}return n.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){var r=n.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){var r=n.hooks.all[e];if(r&&r.length)for(var a,l=0;a=r[l++];)a(t)}}},r=n.Token=function(e,t,n,r,a){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!a};if(r.stringify=function(e,t,a){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return r.stringify(n,t,e)}).join("");var l={type:e.type,content:r.stringify(e.content,t,a),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:a};if(e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""},!_self.document)return _self.addEventListener?(n.disableWorkerMessageHandler||_self.addEventListener("message",function(e){var t=JSON.parse(e.data),r=t.language,a=t.code,l=t.immediateClose;_self.postMessage(n.highlight(a,n.languages[r],r)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(n.filename=a.src,n.manual||a.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
+Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
+Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.languages.css,Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css",greedy:!0}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
+Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(?:true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
+Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,"function":/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"},constant:/\b[A-Z][A-Z\d_]*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript",greedy:!0}}),Prism.languages.js=Prism.languages.javascript;
+Prism.languages.json={property:/"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,string:{pattern:/"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,greedy:!0},number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,punctuation:/[{}[\]);,]/,operator:/:/g,"boolean":/\b(?:true|false)\b/i,"null":/\bnull\b/i},Prism.languages.jsonp=Prism.languages.json;
+!function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){n="string"==typeof n?n:e.getAttribute("data-line");for(var o,l=n.replace(/\s+/g,"").split(","),a=+e.getAttribute("data-line-offset")||0,s=r()?parseInt:parseFloat,d=s(getComputedStyle(e).lineHeight),u=t(e,"line-numbers"),c=0;o=l[c++];){var p=o.split("-"),m=+p[0],f=+p[1]||m,h=e.querySelector('.line-highlight[data-range="'+o+'"]')||document.createElement("div");if(h.setAttribute("aria-hidden","true"),h.setAttribute("data-range",o),h.className=(i||"")+" line-highlight",u&&Prism.plugins.lineNumbers){var g=Prism.plugins.lineNumbers.getLine(e,m),y=Prism.plugins.lineNumbers.getLine(e,f);g&&(h.style.top=g.offsetTop+"px"),y&&(h.style.height=y.offsetTop-g.offsetTop+y.offsetHeight+"px")}else h.setAttribute("data-start",m),f>m&&h.setAttribute("data-end",f),h.style.top=(m-a-1)*d+"px",h.textContent=new Array(f-m+2).join(" \n");u?e.appendChild(h):(e.querySelector("code")||e).appendChild(h)}}function i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),o=document.getElementById(r);o&&(o.hasAttribute("data-line")||o.setAttribute("data-line",""),n(o,i,"temporary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var r=function(){var e;return function(){if("undefined"==typeof e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding=0,t.style.border=0,t.innerHTML=" 
 ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}}(),o=0;Prism.hooks.add("before-sanity-check",function(t){var n=t.element.parentNode,i=n&&n.getAttribute("data-line");if(n&&i&&/pre/i.test(n.nodeName)){var r=0;e(".line-highlight",n).forEach(function(e){r+=e.textContent.length,e.parentNode.removeChild(e)}),r&&/^( \n)+$/.test(t.code.slice(-r))&&(t.code=t.code.slice(0,-r))}}),Prism.hooks.add("complete",function l(e){var r=e.element.parentNode,a=r&&r.getAttribute("data-line");if(r&&a&&/pre/i.test(r.nodeName)){clearTimeout(o);var s=Prism.plugins.lineNumbers,d=e.plugins&&e.plugins.lineNumbers;t(r,"line-numbers")&&s&&!d?Prism.hooks.add("line-numbers",l):(n(r,a),o=setTimeout(i,1))}}),window.addEventListener("hashchange",i),window.addEventListener("resize",function(){var e=document.querySelectorAll("pre[data-line]");Array.prototype.forEach.call(e,function(e){n(e)})})}}(); +!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e="line-numbers",t=/\n(?!$)/g,n=function(e){var n=r(e),s=n["white-space"];if("pre-wrap"===s||"pre-line"===s){var l=e.querySelector("code"),i=e.querySelector(".line-numbers-rows"),a=e.querySelector(".line-numbers-sizer"),o=l.textContent.split(t);a||(a=document.createElement("span"),a.className="line-numbers-sizer",l.appendChild(a)),a.style.display="block",o.forEach(function(e,t){a.textContent=e||"\n";var n=a.getBoundingClientRect().height;i.children[t].style.height=n+"px"}),a.textContent="",a.style.display="none"}},r=function(e){return e?window.getComputedStyle?getComputedStyle(e):e.currentStyle||null:null};window.addEventListener("resize",function(){Array.prototype.forEach.call(document.querySelectorAll("pre."+e),n)}),Prism.hooks.add("complete",function(e){if(e.code){var r=e.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(r&&/pre/i.test(r.nodeName)&&(s.test(r.className)||s.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s," ")),s.test(r.className)||(r.className+=" line-numbers");var l,i=e.code.match(t),a=i?i.length+1:1,o=new Array(a+1);o=o.join(""),l=document.createElement("span"),l.setAttribute("aria-hidden","true"),l.className="line-numbers-rows",l.innerHTML=o,r.hasAttribute("data-start")&&(r.style.counterReset="linenumber "+(parseInt(r.getAttribute("data-start"),10)-1)),e.element.appendChild(l),n(r),Prism.hooks.run("line-numbers",e)}}}),Prism.hooks.add("line-numbers",function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}),Prism.plugins.lineNumbers={getLine:function(t,n){if("PRE"===t.tagName&&t.classList.contains(e)){var r=t.querySelector(".line-numbers-rows"),s=parseInt(t.getAttribute("data-start"),10)||1,l=s+(r.children.length-1);s>n&&(n=s),n>l&&(n=l);var i=n-s;return r.children[i]}}}}}(); +!function(){if(("undefined"==typeof self||self.Prism)&&("undefined"==typeof global||global.Prism)){var i=/\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~\/.:=&]+(?:\?[\w\-+%~\/.:#=?&!$'()*,;]*)?(?:#[\w\-+%~\/.:#=?&!$'()*,;]*)?/,n=/\b\S+@[\w.]+[a-z]{2}/,e=/\[([^\]]+)]\(([^)]+)\)/,t=["comment","url","attr-value","string"];Prism.plugins.autolinker={processGrammar:function(r){r&&!r["url-link"]&&(Prism.languages.DFS(r,function(r,a,l){t.indexOf(l)>-1&&"Array"!==Prism.util.type(a)&&(a.pattern||(a=this[r]={pattern:a}),a.inside=a.inside||{},"comment"==l&&(a.inside["md-link"]=e),"attr-value"==l?Prism.languages.insertBefore("inside","punctuation",{"url-link":i},a):a.inside["url-link"]=i,a.inside["email-link"]=n)}),r["url-link"]=i,r["email-link"]=n)}},Prism.hooks.add("before-highlight",function(i){Prism.plugins.autolinker.processGrammar(i.grammar)}),Prism.hooks.add("wrap",function(i){if(/-link$/.test(i.type)){i.tag="a";var n=i.content;if("email-link"==i.type&&0!=n.indexOf("mailto:"))n="mailto:"+n;else if("md-link"==i.type){var t=i.content.match(e);n=t[2],i.content=t[1]}i.attributes.href=n}try{i.content=decodeURIComponent(i.content)}catch(r){}})}}(); diff --git a/docs/vectorious/6.0.4/styles/styles.css b/docs/vectorious/6.0.4/styles/styles.css new file mode 100644 index 00000000..12356e1d --- /dev/null +++ b/docs/vectorious/6.0.4/styles/styles.css @@ -0,0 +1,415 @@ +:root { + --primary-color: #0664a8; + --secondary-color: #107e7d; + --link-color: var(--primary-color); + --link-hover-color: var(--primary-color); + --border-color: #eee; + --code-color: #666; + --code-attention-color: #ca2d00; + --text-color: #4a4a4a; + --light-font-color: #999; + --supporting-color: #7097b5; + --heading-color: var(--text-color); + --subheading-color: var(--secondary-color); + --heading-background: #f7f7f7; + --code-bg-color: #f8f8f8; + --nav-title-color: var(--primary-color); + --nav-title-align: center; + --nav-title-size: 1rem; + --nav-title-margin-bottom: 1.5em; + --nav-title-font-weight: 600; + --nav-list-margin-left: 2em; + --nav-bg-color: #fff; + --nav-heading-display: block; + --nav-heading-color: #aaa; + --nav-link-color: #666; + --nav-text-color: #aaa; + --nav-type-class-color: #fff; + --nav-type-class-bg: #FF8C00; + --nav-type-member-color: #39b739; + --nav-type-member-bg: #d5efd5; + --nav-type-function-color: #549ab9; + --nav-type-function-bg: #e1f6ff; + --nav-type-namespace-color: #eb6420; + --nav-type-namespace-bg: #fad8c7; + --nav-type-typedef-color: #964cb1; + --nav-type-typedef-bg: #f2e4f7; + --nav-type-module-color: #964cb1; + --nav-type-module-bg: #f2e4f7; + --nav-type-event-color: #948b34; + --nav-type-event-bg: #fff6a6; + --max-content-width: 900px; + --nav-width: 320px; + --padding-unit: 30px; + --layout-footer-color: #aaa; + --member-name-signature-display: none; + --base-font-size: 16px; + --base-line-height: 1.7; + --body-font: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + --code-font: Consolas, Monaco, 'Andale Mono', monospace; } + +body { + font-family: var(--body-font); + font-size: var(--base-font-size); + line-height: var(--base-line-height); + color: var(--text-color); + -webkit-font-smoothing: antialiased; + text-size-adjust: 100%; } + +* { + box-sizing: border-box; } + +a { + text-decoration: none; + color: var(--link-color); } + a:hover, a:active { + text-decoration: underline; + color: var(--link-hover-color); } + +img { + max-width: 100%; } + img + p { + margin-top: 1em; } + +ul { + margin: 1em 0; } + +tt, code, kbd, samp { + font-family: var(--code-font); } + +code { + display: inline-block; + background-color: var(--code-bg-color); + padding: 2px 6px 0px; + border-radius: 3px; + color: var(--code-attention-color); } + +.prettyprint.source code:not([class*="language-"]) { + display: block; + padding: 20px; + overflow: scroll; + color: var(--code-color); } + +.layout-main, +.layout-footer { + margin-left: var(--nav-width); } + +.container { + max-width: var(--max-content-width); + margin-left: auto; + margin-right: auto; } + +.layout-main { + margin-top: var(--padding-unit); + margin-bottom: var(--padding-unit); + padding: 0 var(--padding-unit); } + +.layout-header { + background: var(--nav-bg-color); + border-right: 1px solid var(--border-color); + position: fixed; + padding: 0 var(--padding-unit); + top: 0; + left: 0; + right: 0; + width: var(--nav-width); + height: 100%; + overflow: scroll; } + .layout-header h1 { + display: block; + margin-bottom: var(--nav-title-margin-bottom); + font-size: var(--nav-title-size); + font-weight: var(--nav-title-font-weight); + text-align: var(--nav-title-align); } + .layout-header h1 a:link, .layout-header h1 a:visited { + color: var(--nav-title-color); } + .layout-header img { + max-width: 120px; + display: block; + margin: 1em auto; } + +.layout-nav { + margin-bottom: 2rem; } + .layout-nav ul { + margin: 0 0 var(--nav-list-margin-left); + padding: 0; } + .layout-nav li { + list-style-type: none; + font-size: 0.95em; } + .layout-nav li.nav-heading:first-child { + display: var(--nav-heading-display); + margin-left: 0; + margin-bottom: 1em; + text-transform: uppercase; + color: var(--nav-heading-color); + font-size: 0.85em; } + .layout-nav a { + color: var(--nav-link-color); } + .layout-nav a:link, .layout-nav a a:visited { + color: var(--nav-link-color); } + +.layout-content--source { + max-width: none; } + +.nav-heading { + margin-top: 1em; + font-weight: 500; } + .nav-heading a { + color: var(--nav-link-color); } + .nav-heading a:link, .nav-heading a:visited { + color: var(--nav-link-color); } + .nav-heading .nav-item-type { + font-size: 0.9em; } + +.nav-item-type { + display: inline-block; + font-size: 0.9em; + width: 1.2em; + height: 1.2em; + line-height: 1.2em; + display: inline-block; + text-align: center; + border-radius: 0.2em; + margin-right: 0.5em; } + .nav-item-type.type-class { + color: var(--nav-type-class-color); + background: var(--nav-type-class-bg); } + .nav-item-type.type-typedef { + color: var(--nav-type-typedef-color); + background: var(--nav-type-typedef-bg); } + .nav-item-type.type-function { + color: var(--nav-type-function-color); + background: var(--nav-type-function-bg); } + .nav-item-type.type-namespace { + color: var(--nav-type-namespace-color); + background: var(--nav-type-namespace-bg); } + .nav-item-type.type-member { + color: var(--nav-type-member-color); + background: var(--nav-type-member-bg); } + .nav-item-type.type-module { + color: var(--nav-type-module-color); + background: var(--nav-type-module-bg); } + .nav-item-type.type-event { + color: var(--nav-type-event-color); + background: var(--nav-type-event-bg); } + +.nav-item-name.is-function:after { + display: inline; + content: '()'; + color: var(--nav-link-color); + opacity: 0.75; } + +.nav-item-name.is-class { + font-size: 1.1em; } + +.layout-footer { + padding-top: 2rem; + padding-bottom: 2rem; + font-size: 0.8em; + text-align: center; + color: var(--layout-footer-color); } + .layout-footer a { + color: var(--light-font-color); + text-decoration: underline; } + +h1 { + font-size: 2rem; + color: var(--heading-color); } + +h5 { + margin: 0; + font-weight: 500; + font-size: 1em; } + h5 + .code-caption { + margin-top: 1em; } + +.page-kind { + margin: 0 0 -0.5em; + font-weight: 400; + color: var(--light-font-color); + text-transform: uppercase; } + +.page-title { + margin-top: 0; } + +.subtitle { + font-weight: 600; + font-size: 1.5em; + color: var(--subheading-color); + margin: 1em 0; + padding: 0.4em 0; + border-bottom: 1px solid var(--border-color); } + .subtitle + .event, + .subtitle + .member, + .subtitle + .method { + border-top: none; + padding-top: 0; } + +.method-type + .method-name { + margin-top: 0.5em; } + +.event-name, +.member-name, +.method-name, +.type-definition-name { + margin: 1em 0; + font-size: 1.4rem; + font-family: var(--code-font); + font-weight: 600; + color: var(--primary-color); } + .event-name .signature-attributes, + .member-name .signature-attributes, + .method-name .signature-attributes, + .type-definition-name .signature-attributes { + display: inline-block; + margin-left: 0.25em; + font-size: 60%; + color: #999; + font-style: italic; + font-weight: lighter; } + +.type-signature { + display: inline-block; + margin-left: 0.5em; } + +.member-name .type-signature { + display: var(--member-name-signature-display); } + +.type-signature, +.return-type-signature { + color: #aaa; + font-weight: 400; } + .type-signature a:link, .type-signature a:visited, + .return-type-signature a:link, + .return-type-signature a:visited { + color: #aaa; } + +table { + margin-top: 1rem; + width: auto; + min-width: 400px; + max-width: 100%; + border-top: 1px solid var(--border-color); + border-right: 1px solid var(--border-color); } + table th, table h4 { + font-weight: 500; } + table th, + table td { + padding: 0.5rem 0.75rem; } + table th, + table td { + border-left: 1px solid var(--border-color); + border-bottom: 1px solid var(--border-color); } + table p:last-child { + margin-bottom: 0; } + +.readme h2 { + border-bottom: 1px solid var(--border-color); + margin: 1em 0; + padding-bottom: 0.5rem; + color: var(--subheading-color); } + .readme h2 + h3 { + margin-top: 0; } + +.readme h3 { + margin: 2rem 0 1rem 0; } + +article.event, article.member, article.method { + padding: 1em 0 1em; + margin: 1em 0; + border-top: 1px solid var(--border-color); } + +.method-type-signature:not(:empty) { + display: inline-block; + background: #ecf0f1; + color: #627475; + padding: 0.25em 0.5em 0.35em; + font-weight: 300; + font-size: 0.8rem; + margin: 0 0.75em 0 0; } + +.method-heading { + margin: 1em 0; } + +li.method-returns, +.method-params li { + margin-bottom: 1em; } + +.method-source a:link, .method-source a:visited { + color: var(--light-font-color); } + +.method-returns p { + margin: 0; } + +.event-description, +.method-description { + margin: 0 0 2em; } + +.param-type code, +.method-returns code { + color: #111; } + +.param-name { + font-weight: 600; + display: inline-block; + margin-right: 0.5em; } + +.param-type, +.param-default, +.param-attributes { + font-family: var(--code-font); } + +.param-default::before { + display: inline-block; + content: 'Default:'; + font-family: var(--body-font); } + +.param-attributes { + color: var(--light-font-color); } + +.param-description p:first-child { + margin-top: 0; } + +.param-properties { + font-weight: 500; + margin: 1em 0 0; } + +.param-types, +.property-types { + display: inline-block; + margin: 0 0.5em 0 .25em; + color: #999; } + +.param-attr, +.property-attr { + display: inline-block; + padding: 0.2em 0.5em; + border: 1px solid #eee; + color: #aaa; + font-weight: 300; + font-size: 0.8em; + vertical-align: baseline; } + +.properties-table p:last-child { + margin-bottom: 0; } + +pre[class*="language-"] { + border-radius: 0; } + +code[class*="language-"], +pre[class*="language-"] { + text-shadow: none; + border: none; } + code[class*="language-"].source-page, + pre[class*="language-"].source-page { + font-size: 0.9em; } + +.line-numbers .line-numbers-rows { + border-right: none; } + +.source-page { + font-size: 14px; } + .source-page code { + z-index: 1; } + .source-page .line-height.temporary { + z-index: 0; } diff --git a/docs/vectorious/6.0.4/styles/vendor/prism-custom.css b/docs/vectorious/6.0.4/styles/vendor/prism-custom.css new file mode 100644 index 00000000..09d20634 --- /dev/null +++ b/docs/vectorious/6.0.4/styles/vendor/prism-custom.css @@ -0,0 +1,142 @@ +/* PrismJS 1.17.1 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+http */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + background: none; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f6f8fa; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/docs/vectorious/6.0.4/styles/vendor/prism-default.css b/docs/vectorious/6.0.4/styles/vendor/prism-default.css new file mode 100644 index 00000000..006d0a30 --- /dev/null +++ b/docs/vectorious/6.0.4/styles/vendor/prism-default.css @@ -0,0 +1,142 @@ +/* PrismJS 1.17.1 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+http */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + background: none; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/docs/vectorious/6.0.4/styles/vendor/prism-okaidia.css b/docs/vectorious/6.0.4/styles/vendor/prism-okaidia.css new file mode 100644 index 00000000..95b3eab4 --- /dev/null +++ b/docs/vectorious/6.0.4/styles/vendor/prism-okaidia.css @@ -0,0 +1,217 @@ +/* PrismJS 1.16.0 +https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+json&plugins=line-highlight+line-numbers */ +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ + +code[class*="language-"], +pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #272822; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #f8f8f2; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.constant, +.token.symbol, +.token.deleted { + color: #f92672; +} + +.token.boolean, +.token.number { + color: #ae81ff; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #a6e22e; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #f8f8f2; +} + +.token.atrule, +.token.attr-value, +.token.function, +.token.class-name { + color: #e6db74; +} + +.token.keyword { + color: #66d9ef; +} + +.token.regex, +.token.important { + color: #fd971f; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +pre[data-line] { + position: relative; + padding: 1em 0 1em 3em; +} + +.line-highlight { + position: absolute; + left: 0; + right: 0; + padding: inherit 0; + margin-top: 1em; /* Same as .prism’s padding-top */ + + background: hsla(24, 20%, 50%,.08); + background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0)); + + pointer-events: none; + + line-height: inherit; + white-space: pre; +} + + .line-highlight:before, + .line-highlight[data-end]:after { + content: attr(data-start); + position: absolute; + top: .4em; + left: .6em; + min-width: 1em; + padding: 0 .5em; + background-color: hsla(24, 20%, 50%,.4); + color: hsl(24, 20%, 95%); + font: bold 65%/1.5 sans-serif; + text-align: center; + vertical-align: .3em; + border-radius: 999px; + text-shadow: none; + box-shadow: 0 1px white; + } + + .line-highlight[data-end]:after { + content: attr(data-end); + top: auto; + bottom: .4em; + } + +.line-numbers .line-highlight:before, +.line-numbers .line-highlight:after { + content: none; +} + +pre[class*="language-"].line-numbers { + position: relative; + padding-left: 3.8em; + counter-reset: linenumber; +} + +pre[class*="language-"].line-numbers > code { + position: relative; + white-space: inherit; +} + +.line-numbers .line-numbers-rows { + position: absolute; + pointer-events: none; + top: 0; + font-size: 100%; + left: -3.8em; + width: 3em; /* works for line-numbers below 1000 lines */ + letter-spacing: -1px; + border-right: 1px solid #999; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + +} + + .line-numbers-rows > span { + pointer-events: none; + display: block; + counter-increment: linenumber; + } + + .line-numbers-rows > span:before { + content: counter(linenumber); + color: #999; + display: block; + padding-right: 0.8em; + text-align: right; + } diff --git a/docs/vectorious/6.0.4/styles/vendor/prism-tomorrow-night.css b/docs/vectorious/6.0.4/styles/vendor/prism-tomorrow-night.css new file mode 100644 index 00000000..0039e969 --- /dev/null +++ b/docs/vectorious/6.0.4/styles/vendor/prism-tomorrow-night.css @@ -0,0 +1,217 @@ +/* PrismJS 1.16.0 +https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+json&plugins=line-highlight+line-numbers */ +/** + * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML + * Based on https://github.com/chriskempson/tomorrow-theme + * @author Rose Pritchard + */ + +code[class*="language-"], +pre[class*="language-"] { + color: #ccc; + background: none; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #2d2d2d; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.block-comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: #999; +} + +.token.punctuation { + color: #ccc; +} + +.token.tag, +.token.attr-name, +.token.namespace, +.token.deleted { + color: #e2777a; +} + +.token.function-name { + color: #6196cc; +} + +.token.boolean, +.token.number, +.token.function { + color: #f08d49; +} + +.token.property, +.token.class-name, +.token.constant, +.token.symbol { + color: #f8c555; +} + +.token.selector, +.token.important, +.token.atrule, +.token.keyword, +.token.builtin { + color: #cc99cd; +} + +.token.string, +.token.char, +.token.attr-value, +.token.regex, +.token.variable { + color: #7ec699; +} + +.token.operator, +.token.entity, +.token.url { + color: #67cdcc; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +.token.inserted { + color: green; +} + +pre[data-line] { + position: relative; + padding: 1em 0 1em 3em; +} + +.line-highlight { + position: absolute; + left: 0; + right: 0; + padding: inherit 0; + margin-top: 1em; /* Same as .prism’s padding-top */ + + background: hsla(24, 20%, 50%,.08); + background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0)); + + pointer-events: none; + + line-height: inherit; + white-space: pre; +} + + .line-highlight:before, + .line-highlight[data-end]:after { + content: attr(data-start); + position: absolute; + top: .4em; + left: .6em; + min-width: 1em; + padding: 0 .5em; + background-color: hsla(24, 20%, 50%,.4); + color: hsl(24, 20%, 95%); + font: bold 65%/1.5 sans-serif; + text-align: center; + vertical-align: .3em; + border-radius: 999px; + text-shadow: none; + box-shadow: 0 1px white; + } + + .line-highlight[data-end]:after { + content: attr(data-end); + top: auto; + bottom: .4em; + } + +.line-numbers .line-highlight:before, +.line-numbers .line-highlight:after { + content: none; +} + +pre[class*="language-"].line-numbers { + position: relative; + padding-left: 3.8em; + counter-reset: linenumber; +} + +pre[class*="language-"].line-numbers > code { + position: relative; + white-space: inherit; +} + +.line-numbers .line-numbers-rows { + position: absolute; + pointer-events: none; + top: 0; + font-size: 100%; + left: -3.8em; + width: 3em; /* works for line-numbers below 1000 lines */ + letter-spacing: -1px; + border-right: 1px solid #999; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + +} + + .line-numbers-rows > span { + pointer-events: none; + display: block; + counter-increment: linenumber; + } + + .line-numbers-rows > span:before { + content: counter(linenumber); + color: #999; + display: block; + padding-right: 0.8em; + text-align: right; + } + diff --git a/package.json b/package.json index 67c71af1..7a41633b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vectorious", - "version": "6.0.3", + "version": "6.0.4", "description": "A high performance linear algebra library.", "main": "dist/index.js", "browser": "dist/index.browser.js", diff --git a/src/core/slice.bench.ts b/src/core/slice.bench.ts index 993b5161..e84d6607 100644 --- a/src/core/slice.bench.ts +++ b/src/core/slice.bench.ts @@ -4,7 +4,7 @@ import { bench } from '../bench'; bench( 'NDArray', - 'copy', + 'slice', (n: number) => [random(n), 0, Math.floor(Math.random() * n), n], (x, start: number, step: number, end: number): void => { x.slice(start, step, end); diff --git a/src/core/slice.spec.ts b/src/core/slice.spec.ts index 5c98a1c6..38966d43 100644 --- a/src/core/slice.spec.ts +++ b/src/core/slice.spec.ts @@ -1,23 +1,56 @@ import { equals } from './equals'; import { slice } from './slice'; import { array } from './array'; +import { throws } from 'assert'; describe('(v) slice', () => { - it('should work as expected', () => { - const x = array([-1, -2, 3, 4]); + it('should throw error if step is zero or negative', () => { + const x = array([1, 2, 3, 4]); - equals(array([-1, 3]), x.slice(0, 4, 2)); + throws(() => x.slice(0, 4, 0), Error); + throws(() => x.slice(0, 4, -1), Error); }); - it('should work as expected', () => { - const x = array([-1, -2, 3, 4]); + it('should work with negative begin/end', () => { + const x = array([1, 2, 3, 4]); - equals(array([-2, 3]), x.slice(1, 3)); + equals(x.slice(-4, 4), x.slice(0, 4)); + equals(x.slice(-2, 4), x.slice(2, 4)); + equals(x.slice(0, -2), x.slice(0, 2)); + }); + + it('should work with reversed begin/end', () => { + const x = array([1, 2, 3, 4]); + + equals(x.slice(0, 4), x.slice(4, 0)); + }); + + it('should work as expected in 1 dimension', () => { + const x = array([1, 2, 3, 4]); + + equals(array([1, 3]), x.slice(0, 4, 2)); + equals(array([2, 4]), x.slice(1, 4, 2)); + equals(array([1, 2]), x.slice(0, 2)); + equals(array([2, 3]), x.slice(1, 3)); + }); + + it('should work as expected in 2 dimensions', () => { + const x = array([ + [1, 2], + [3, 4], + [5, 6], + [7, 8], + ]); + + equals(array([[1, 2], [5, 6]]), x.slice(0, 4, 2)); + equals(array([[3, 4], [7, 8]]), x.slice(1, 4, 2)); + equals(array([[1, 2], [3, 4]]), x.slice(0, 2)); + equals(array([[3, 4], [5, 6]]), x.slice(1, 3)); }); it('should work as the static equivalent', () => { - const x = array([-1, -2, 3, 4]); + const x = array([1, 2, 3, 4]); - equals(array([-1, 3]), slice(x, 0, 4, 2)); + equals(x.slice(0, 4, 2), slice(x, 0, 4, 2)); }); }); diff --git a/src/core/slice.ts b/src/core/slice.ts index 34ad634f..77986012 100644 --- a/src/core/slice.ts +++ b/src/core/slice.ts @@ -1,4 +1,5 @@ -import { get_strides } from '../util'; +import { TypedArray } from '../types'; +import { get_length, get_strides } from '../util'; import { NDArray } from './'; import { array } from './array'; @@ -28,7 +29,7 @@ export const slice = ( /** * @function slice * @memberof NDArray.prototype - * @description Slices the current array in the corresponding dimension + * @description Slices the current array along the leading dimension * @param {Number} begin * @param {Number} end * @param {Number} step @@ -44,24 +45,33 @@ export default function( end: number = this.shape[0], step: number = 1 ): NDArray { - const { shape: s1 } = this; + const { data: d1, shape: s1 } = this; const nd = s1.length; if (begin < 0 || end < 0) { - return this.slice(begin < 0 ? nd + begin : begin, end < 0 ? nd + end : end); + return this.slice(begin < 0 ? s1[s1.length - 1] + begin : begin, end < 0 ? s1[s1.length - 1] + end : end); } - if (step === 0) { - throw new Error('step argument cannot be 0'); + if (begin > end) { + return this.slice(end, begin, step); } - const s2: number[] = [Math.ceil((end - begin) / step), ...s1.slice(1)]; - const l2: number = s2.reduce((sum: number, dim: number) => sum * dim, 1); + if (step <= 0) { + throw new Error('step argument has to be a positive integer'); + } + + const s2: number[] = [Math.ceil((end - begin) / Math.abs(step)), ...s1.slice(1)]; + const l2: number = get_length(s2); const st2: number[] = get_strides(s2); + const d2: TypedArray = nd > 1 + ? d1.subarray(begin * s2[s2.length - 1], end * s2[s2.length - 1]) + : d1.subarray(begin, end); - this.shape = s2; - this.length = l2; - this.strides = st2; + st2[0] *= step; - return this; + return new NDArray(d2, { + shape: s2, + length: l2, + strides: st2, + }); };