diff --git a/README.md b/README.md index 3bdcf403..855b2a89 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Follow the installation instructions in [nlapack](https://github.com/nperf/nlapack) and [nblas](https://github.com/nperf/nblas) to get maximum performance. -##### In node.js +#### In node.js ```bash # with C++ bindings @@ -39,21 +39,7 @@ Matrix { */ ``` -Will use your local BLAS copy (if any). Some notes for different operating systems: - -* **OSX** - by default included in the Accelerate framework -* **Debian/Ubuntu** - different options, easiest is to `apt-get install libblas-dev` -* **Windows** - https://icl.cs.utk.edu/lapack-for-windows/ - -##### In browser - -Download a [**release**](https://github.com/mateogianolio/vectorious/releases) and use it like this: - -```html - -``` - -Or if you prefer to use a CDN: +#### In browser ```html @@ -77,7 +63,6 @@ Or if you prefer to use a CDN: ### Examples **Basic** - * [**Solving linear systems of equations**](https://github.com/mateogianolio/vectorious/tree/master/examples/solve.js) * [**Using low-level BLAS routines**](https://github.com/mateogianolio/vectorious/tree/master/examples/blas.js) @@ -85,45 +70,18 @@ Or if you prefer to use a CDN: * [**Neural network**](https://github.com/mateogianolio/vectorious/tree/master/examples/neural-network.js) (by [@lucidrains](https://github.com/lucidrains)) * [**Logistic regression**](https://github.com/mateogianolio/vectorious/tree/master/examples/logistic-regression.js) -### [Documentation](https://github.com/mateogianolio/vectorious/wiki) +### Documentation -### Benchmarks +* [**API Documentation**](https://mateogianolio.github.io/vectorious) +* [**Usage guides**](https://github.com/mateogianolio/vectorious/wiki) -Benchmarks are performed using `Float32Array` of size `n` (matrices are sized `sqrt(n) x sqrt(n)`). +### Benchmarks -#### Specs +Run benchmarks with +```bash +$ npm run benchmark ``` -Macbook Pro Early '15 -Processor: 2,7 GHz Intel Core i5 -Memory: 8 GB 1867 MHz DDR3 -GPU: Intel Iris Graphics 6100 1536 MB -``` - -#### Results - -| Matrix | | | -|---------|--------|--------| -| ![add](benchmarks/Matrix/add.png) | ![augment](benchmarks/Matrix/augment.png) | ![binOp](benchmarks/Matrix/binOp.png) | -| ![determinant](benchmarks/Matrix/determinant.png) | ![diag](benchmarks/Matrix/diag.png) | ![gauss](benchmarks/Matrix/gauss.png) | -| ![inverse](benchmarks/Matrix/inverse.png) | ![lu](benchmarks/Matrix/lu.png) | ![multiply](benchmarks/Matrix/multiply.png) | -| ![plu](benchmarks/Matrix/plu.png) | ![product](benchmarks/Matrix/product.png) | ![rank](benchmarks/Matrix/rank.png) | -| ![rowAdd](benchmarks/Matrix/rowAdd.png) | ![scale](benchmarks/Matrix/scale.png) | ![solve](benchmarks/Matrix/solve.png) | -| ![subtract](benchmarks/Matrix/subtract.png) | ![swap](benchmarks/Matrix/swap.png) | ![trace](benchmarks/Matrix/trace.png) | -| ![transpose](benchmarks/Matrix/transpose.png) | | | - -| Vector | | | -|---------|--------|--------| -| ![add](benchmarks/Vector/add.png) | ![angle](benchmarks/Vector/angle.png) | ![binOp](benchmarks/Vector/binOp.png) | -| ![combine](benchmarks/Vector/combine.png) | ![dot](benchmarks/Vector/dot.png) | ![normalize](benchmarks/Vector/normalize.png) | -| ![project](benchmarks/Vector/project.png) | ![scale](benchmarks/Vector/scale.png) | ![subtract](benchmarks/Vector/subtract.png) | - -| NDArray | | | -|---------|--------|--------| -| ![add](benchmarks/NDArray/add.png) | ![copy](benchmarks/NDArray/copy.png) | ![dot](benchmarks/NDArray/dot.png) | -| ![magnitude](benchmarks/NDArray/magnitude.png) | ![max](benchmarks/NDArray/max.png) | ![min](benchmarks/NDArray/min.png) | -| ![product](benchmarks/NDArray/product.png) | ![scale](benchmarks/NDArray/scale.png) | ![subtract](benchmarks/NDArray/subtract.png) | - ## Contributors diff --git a/dist/vectorious.min.js b/dist/vectorious.min.js index c8849a63..f0df7fe4 100644 --- a/dist/vectorious.min.js +++ b/dist/vectorious.min.js @@ -1 +1 @@ -!function o(a,s,u){function c(e,t){if(!s[e]){if(!a[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(h)return h(e,!0);var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}var n=s[e]={exports:{}};a[e][0].call(n.exports,function(t){return c(a[e][1][t]||t)},n,n.exports,o,a,s,u)}return s[e].exports}for(var h="function"==typeof require&&require,t=0;t=u&&(u=Math.abs(this.get(c,h)),f=c,p=h);var l=void 0;if(Math.abs(this.get(f,p))<1e-36*Math.abs(this.get(p,p)))l=this.get(f,p)/this.get(p,p);else{var y=this.get(p,p)/2*this.get(f,p);l=1/(Math.abs(y)+Math.sqrt(y*y+1))}var d=1/Math.sqrt(l*l+1),v=l*d,g=this.get(f,p);for(this.set(f,p,0),this.set(f,f,this.get(f,f)-l*g),this.set(p,p,this.get(p,p)+l*g),c=0;cr[e]&&Number.isFinite(r[e])&&0<=r[e]}))throw new Error("index out of bounds")}},{"./":49}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("../util"),n=t("./");n.NDArray.copy=function(t){return t.copy()},n.NDArray.prototype.copy=function(){var t=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return t.data=new(i.get_type(this.dtype))(this.data),t.shape=this.shape,t.length=this.length,t.dtype=this.dtype,t}},{"../util":88,"./":49}],35:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./");i.NDArray.cos=function(t){return t.copy().cos()},i.NDArray.prototype.cos=function(){var t,e=this.length;for(t=0;t=u&&(u=Math.abs(this.get(c,h)),f=c,p=h);var l=void 0;if(Math.abs(this.get(f,p))<1e-36*Math.abs(this.get(p,p)))l=this.get(f,p)/this.get(p,p);else{var y=this.get(p,p)/2*this.get(f,p);l=1/(Math.abs(y)+Math.sqrt(y*y+1))}var d=1/Math.sqrt(l*l+1),v=l*d,g=this.get(f,p);for(this.set(f,p,0),this.set(f,f,this.get(f,f)-l*g),this.set(p,p,this.get(p,p)+l*g),c=0;cr[e]&&Number.isFinite(r[e])&&0<=r[e]}))throw new Error("index out of bounds")}},{"./":49}],34:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("../util"),n=t("./");n.NDArray.copy=function(t){return t.copy()},n.NDArray.prototype.copy=function(){var t=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return t.data=new(i.get_type(this.dtype))(this.data),t.shape=this.shape,t.length=this.length,t.dtype=this.dtype,t}},{"../util":88,"./":49}],35:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=t("./");i.NDArray.cos=function(t){return t.copy().cos()},i.NDArray.prototype.cos=function(){var t,e=this.length;for(t=0;tconstructor

Parameters

@@ -294,13 +294,12 @@

abs

-

Returns the absolute value of each element of current array. -

+

Returns the absolute value of each element of current array.

@@ -326,13 +325,12 @@

acos

-

Returns the arccosine of each element of current array. -

+

Returns the arccosine of each element of current array.

@@ -358,13 +356,12 @@

acosh

-

Returns the hyperbolic arccosine of each element of current array. -

+

Returns the hyperbolic arccosine of each element of current array.

@@ -390,14 +387,13 @@

add

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

+ Accelerated with BLAS ?axpy.

@@ -432,13 +428,12 @@

asin

-

Returns the arcsine of each element of current array. -

+

Returns the arcsine of each element of current array.

@@ -464,13 +459,12 @@

asinh

-

Returns the hyperbolic arcsine of each element of current array. -

+

Returns the hyperbolic arcsine of each element of current array.

@@ -496,13 +490,12 @@

atan

-

Returns the arctangent of each element of current array. -

+

Returns the arctangent of each element of current array.

@@ -528,13 +521,12 @@

atanh

-

Returns the hyperbolic arctangent of each element of current array. -

+

Returns the hyperbolic arctangent of each element of current array.

@@ -559,13 +551,12 @@

augment

augment: function
-

Augments x with current matrix. -

+

Augments x with current matrix.

@@ -603,13 +594,12 @@

binOp

-

Perform binary operation f on x in the current array. -

+

Perform binary operation f on x in the current array.

@@ -668,13 +658,12 @@

cbrt

-

Returns the cube root of each element of current array. -

+

Returns the cube root of each element of current array.

@@ -700,13 +689,12 @@

ceil

-

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

+

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

@@ -732,13 +720,12 @@

check

-

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

+

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

@@ -770,13 +757,12 @@

copy

-

Makes a copy of the class and underlying data -

+

Makes a copy of the class and underlying data

@@ -802,13 +788,12 @@

cos

-

Returns the cosine of each element of current array. -

+

Returns the cosine of each element of current array.

@@ -834,13 +819,12 @@

cosh

-

Returns the hyperbolic cosine of each element of current array. -

+

Returns the hyperbolic cosine of each element of current array.

@@ -867,7 +851,7 @@

data

Implementation of INDArray.data

Inherited from NDArray.data

@@ -877,13 +861,12 @@

det

det: function
-

Gets the determinant of current matrix using LU factorization. -

+

Gets the determinant of current matrix using LU factorization.

@@ -908,13 +891,12 @@

diagonal

diagonal: function
-

Gets the diagonal of current matrix. -

+

Gets the diagonal of current matrix.

@@ -940,14 +922,13 @@

dot

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

+ Accelerated with BLAS ?dot.

@@ -980,7 +961,7 @@

dtype

Implementation of INDArray.dtype

Inherited from NDArray.dtype

@@ -991,13 +972,12 @@

each

-

Equivalent to TypedArray.prototype.forEach. -

+

Equivalent to TypedArray.prototype.forEach.

@@ -1052,14 +1032,13 @@

eig

eig: function

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

+ Accelerated with LAPACK ?geev.

@@ -1091,13 +1070,12 @@

equals

-

Checks if current array and x are equal. -

+

Checks if current array and x are equal.

@@ -1129,13 +1107,12 @@

equidimensional

-

Asserts if current array and x have the same shape -

+

Asserts if current array and x have the same shape

@@ -1167,13 +1144,12 @@

equilateral

-

Asserts if current array and x have the same length -

+

Asserts if current array and x have the same length

@@ -1205,14 +1181,13 @@

exp

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. -

+ and e is Euler's constant (2.718…), the base of the natural logarithm.

@@ -1238,13 +1213,12 @@

expm1

-

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

+

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

@@ -1270,13 +1244,12 @@

fill

-

Fills the current array with a scalar value -

+

Fills the current array with a scalar value

@@ -1308,13 +1281,12 @@

floor

-

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

+

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

@@ -1340,13 +1312,12 @@

fround

-

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

+

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

@@ -1371,13 +1342,12 @@

gauss

gauss: function
-

Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of current matrix. -

+

Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of current matrix.

@@ -1403,13 +1373,12 @@

get

-

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

+

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

@@ -1440,14 +1409,13 @@

inv

inv: function

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

+ Accelerated with LAPACK ?getri.

@@ -1474,7 +1442,7 @@

length

Implementation of INDArray.length

Inherited from NDArray.length

@@ -1485,13 +1453,12 @@

log

-

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

+

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

@@ -1517,13 +1484,12 @@

log10

-

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

+

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

@@ -1549,13 +1515,12 @@

log1p

-

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

+

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

@@ -1581,13 +1546,12 @@

log2

-

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

+

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

@@ -1612,14 +1576,13 @@

lu

lu: function

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

+ Accelerated with LAPACK ?getrf.

@@ -1650,14 +1613,13 @@

lu_factor

lu_factor: function

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

+ Accelerated with LAPACK ?getrf.

@@ -1683,13 +1645,12 @@

map

-

Equivalent to TypedArray.prototype.map. -

+

Equivalent to TypedArray.prototype.map.

@@ -1745,13 +1706,12 @@

max

-

Gets the maximum value (smallest) element of current array. -

+

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

@@ -1777,13 +1737,12 @@

min

-

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

+

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

@@ -1808,14 +1767,13 @@

multiply

multiply: function

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

+ Accelerated with BLAS ?gemm.

@@ -1853,14 +1811,13 @@

norm

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

+ Accelerated with BLAS ?nrm2.

@@ -1886,13 +1843,12 @@

pow

-

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

+

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

@@ -1924,13 +1880,12 @@

product

-

Hadamard product of current matrix and x -

+

Hadamard product of current matrix and x

@@ -1961,13 +1916,12 @@

rank

rank: function
-

Finds the rank of current matrix using gaussian elimination. -

+

Finds the rank of current matrix using gaussian elimination.

@@ -1993,13 +1947,12 @@

reduce

-

Equivalent to TypedArray.prototype.reduce. -

+

Equivalent to TypedArray.prototype.reduce.

@@ -2061,13 +2014,12 @@

reshape

-

Reshapes current array -

+

Reshapes current array

@@ -2075,14 +2027,14 @@

Type declaration

    • -
    • (s: number[]): this
    • +
    • (...shape: number[]): this
    • Parameters

      • -
        s: number[]
        +
        Rest ...shape: number[]

      Returns this

      @@ -2099,13 +2051,12 @@

      round

      -

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

      +

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

      @@ -2130,13 +2081,12 @@

      rowAdd

      rowAdd: function
      -

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

      +

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

      @@ -2174,14 +2124,13 @@

      scale

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

      + Accelerated with BLAS ?scal.

      @@ -2213,13 +2162,12 @@

      set

      -

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

      +

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

      @@ -2252,7 +2200,7 @@

      shape

      Implementation of INDArray.shape

      Inherited from NDArray.shape

      @@ -2263,14 +2211,13 @@

      sign

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

      + whether it is positive, negative or zero.

      @@ -2296,13 +2243,12 @@

      sin

      -

      Returns the sine of each element of current array. -

      +

      Returns the sine of each element of current array.

      @@ -2328,13 +2274,12 @@

      sinh

      -

      Returns the hyperbolic sine of each element of current array. -

      +

      Returns the hyperbolic sine of each element of current array.

      @@ -2360,13 +2305,12 @@

      slice

      -

      Slices the current array in the corresponding dimension -

      +

      Slices the current array in the corresponding dimension

      @@ -2403,14 +2347,13 @@

      solve

      solve: function

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

      + Accelerated with LAPACK ?gesv.

      @@ -2448,13 +2391,12 @@

      sqrt

      -

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

      +

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

      @@ -2479,13 +2421,12 @@

      square

      square: function
      -

      Asserts if current matrix is square. -

      +

      Asserts if current matrix is square.

      @@ -2511,14 +2452,13 @@

      subtract

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

      + Accelerated with BLAS ?axpy.

      @@ -2549,13 +2489,12 @@

      swap

      swap: function
      -

      Swaps two rows i and j in current matrix -

      +

      Swaps two rows i and j in current matrix

      @@ -2590,13 +2529,12 @@

      tan

      -

      Returns the tangent of each element of current array. -

      +

      Returns the tangent of each element of current array.

      @@ -2622,13 +2560,12 @@

      tanh

      -

      Returns the hyperbolic tangent of each element of current array. -

      +

      Returns the hyperbolic tangent of each element of current array.

      @@ -2653,13 +2590,12 @@

      toArray

      toArray: function
      -

      Converts current matrix into a two-dimensional array -

      +

      Converts current matrix into a two-dimensional array

      @@ -2684,13 +2620,12 @@

      toString

      toString: function
      -

      Converts current matrix into a readable formatted string. -

      +

      Converts current matrix into a readable formatted string.

      @@ -2715,13 +2650,12 @@

      trace

      trace: function
      -

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

      +

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

      @@ -2746,13 +2680,12 @@

      transpose

      transpose: function
      -

      Transposes current matrix (mirror across the diagonal). -

      +

      Transposes current matrix (mirror across the diagonal).

      @@ -2778,14 +2711,13 @@

      trunc

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

      + removing any fractional digits.

      @@ -2811,13 +2743,12 @@

      Static abs

      -

      Returns the absolute value of each element of x. -

      +

      Returns the absolute value of each element of x.

      @@ -2855,13 +2786,12 @@

      Static acos

      -

      Returns the arccosine of each element of x. -

      +

      Returns the arccosine of each element of x.

      @@ -2899,13 +2829,12 @@

      Static acosh

      -

      Returns the hyperbolic arccosine of each element of x. -

      +

      Returns the hyperbolic arccosine of each element of x.

      @@ -2943,14 +2872,13 @@

      Static add

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

      + Accelerated with BLAS ?axpy.

      @@ -2994,13 +2922,12 @@

      Static asin

      -

      Returns the arcsine of each element of x. -

      +

      Returns the arcsine of each element of x.

      @@ -3038,13 +2965,12 @@

      Static asinh

      -

      Returns the hyperbolic arcsine of each element of x. -

      +

      Returns the hyperbolic arcsine of each element of x.

      @@ -3082,13 +3008,12 @@

      Static atan

      -

      Returns the arctangent of each element of x. -

      +

      Returns the arctangent of each element of x.

      @@ -3126,13 +3051,12 @@

      Static atanh

      -

      Returns the hyperbolic arctangent of each element of x. -

      +

      Returns the hyperbolic arctangent of each element of x.

      @@ -3169,13 +3093,12 @@

      Static augment

      augment: function
      -

      Augments x and y. -

      +

      Augments x and y.

      @@ -3216,13 +3139,12 @@

      Static binOp

      -

      Perform binary operation f on y in x. -

      +

      Perform binary operation f on y in x.

      @@ -3290,13 +3212,12 @@

      Static cbrt

      -

      Returns the cube root of each element of x. -

      +

      Returns the cube root of each element of x.

      @@ -3334,13 +3255,12 @@

      Static ceil

      -

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

      +

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

      @@ -3378,13 +3298,12 @@

      Static check

      -

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

      +

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

      @@ -3425,13 +3344,12 @@

      Static copy

      -

      Makes a copy of x -

      +

      Makes a copy of x

      @@ -3469,13 +3387,12 @@

      Static cos

      -

      Returns the cosine of each element of x. -

      +

      Returns the cosine of each element of x.

      @@ -3513,13 +3430,12 @@

      Static cosh

      -

      Returns the hyperbolic cosine of each element of x. -

      +

      Returns the hyperbolic cosine of each element of x.

      @@ -3556,13 +3472,12 @@

      Static det

      det: function
      -

      Gets the determinant of x. -

      +

      Gets the determinant of x.

      @@ -3599,13 +3514,12 @@

      Static diagonal

      diagonal: function
      -

      Gets the diagonal of x. -

      +

      Gets the diagonal of x.

      @@ -3643,14 +3557,13 @@

      Static dot

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

      + Accelerated with BLAS ?dot.

      @@ -3691,13 +3604,12 @@

      Static each

      -

      Equivalent to TypedArray.prototype.forEach. -

      +

      Equivalent to TypedArray.prototype.forEach.

      @@ -3761,14 +3673,13 @@

      Static eig

      eig: function

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

      + Accelerated with LAPACK ?geev.

      @@ -3806,13 +3717,12 @@

      Static equals

      -

      Checks if x and y are equal. -

      +

      Checks if x and y are equal.

      @@ -3853,13 +3763,12 @@

      Static equidimensional

      -

      Asserts if x and y have the same shape -

      +

      Asserts if x and y have the same shape

      @@ -3900,13 +3809,12 @@

      Static equilateral

      -

      Asserts if x and y have the same length -

      +

      Asserts if x and y have the same length

      @@ -3947,14 +3855,13 @@

      Static exp

      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. -

      + and e is Euler's constant (2.718…), the base of the natural logarithm.

      @@ -3992,13 +3899,12 @@

      Static expm1

      -

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

      +

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

      @@ -4036,13 +3942,12 @@

      Static eye

      -

      Creates an identity matrix of size n and type type. -

      +

      Creates an identity matrix of size n and type type.

      @@ -4080,13 +3985,12 @@

      Static fill

      -

      Fills x with a scalar value -

      +

      Fills x with a scalar value

      @@ -4127,13 +4031,12 @@

      Static floor

      -

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

      +

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

      @@ -4171,13 +4074,12 @@

      Static fround

      -

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

      +

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

      @@ -4214,13 +4116,12 @@

      Static gauss

      gauss: function
      -

      Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of x. -

      +

      Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of x.

      @@ -4258,13 +4159,12 @@

      Static get

      -

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

      +

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

      @@ -4304,14 +4204,13 @@

      Static inv

      inv: function

      Determines the inverse of x. - Accelerated with LAPACK ?getri. -

      + Accelerated with LAPACK ?getri.

      @@ -4349,13 +4248,12 @@

      Static log

      -

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

      +

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

      @@ -4393,13 +4291,12 @@

      Static log10

      -

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

      +

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

      @@ -4437,13 +4334,12 @@

      Static log1p

      -

      Returns the base 2 logarithm of each element of x. -

      +

      Returns the base 2 logarithm of each element of x.

      @@ -4481,13 +4377,12 @@

      Static log2

      -

      Returns the base 10 logarithm of each element of x. -

      +

      Returns the base 10 logarithm of each element of x.

      @@ -4524,14 +4419,13 @@

      Static lu

      lu: function

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

      + Accelerated with LAPACK ?getrf.

      @@ -4568,14 +4462,13 @@

      Static lu_factor

      lu_factor: function

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

      + Accelerated with LAPACK ?getrf.

      @@ -4612,13 +4505,12 @@

      Static magic

      magic: function
      -

      Creates a magic square matrix of size -

      +

      Creates a magic square matrix of size

      @@ -4659,13 +4551,12 @@

      Static map

      -

      Equivalent to TypedArray.prototype.map. -

      +

      Equivalent to TypedArray.prototype.map.

      @@ -4730,14 +4621,13 @@

      Static max

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

      + Accelerated with BLAS i?amax.

      @@ -4775,13 +4665,12 @@

      Static min

      -

      Gets the minimum value (smallest) element of x. -

      +

      Gets the minimum value (smallest) element of x.

      @@ -4818,14 +4707,13 @@

      Static multiply

      multiply: function

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

      + Accelerated with BLAS ?gemm.

      @@ -4866,14 +4754,13 @@

      Static norm

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

      + Accelerated with BLAS ?nrm2.

      @@ -4911,13 +4798,12 @@

      Static ones

      -

      Creates an array containing ones (1) of shape shape -

      +

      Creates an array containing ones (1) of shape shape

      @@ -4955,13 +4841,12 @@

      Static pow

      -

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

      +

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

      @@ -5002,13 +4887,12 @@

      Static product

      -

      Hadamard product of x and y -

      +

      Hadamard product of x and y

      @@ -5049,13 +4933,12 @@

      Static random

      -

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

      +

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

      @@ -5093,7 +4976,7 @@

      Static range

      @@ -5101,8 +4984,7 @@

      Static range

      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) -

      + steps of 0.5)

      @@ -5139,13 +5021,12 @@

      Static rank

      rank: function
      -

      Finds the rank of x using gaussian elimination. -

      +

      Finds the rank of x using gaussian elimination.

      @@ -5183,13 +5064,12 @@

      Static reduce

      -

      Equivalent to TypedArray.prototype.reduce. -

      +

      Equivalent to TypedArray.prototype.reduce.

      @@ -5254,13 +5134,12 @@

      Static reshape

      -

      Reshapes x -

      +

      Reshapes x

      @@ -5268,7 +5147,7 @@

      Type declaration

        • -
        • <T>(x: T, s: number[]): T
        • +
        • <T>(x: T, ...shape: number[]): T
        • @@ -5284,7 +5163,7 @@

          Parameters

          x: T
        • -
          s: number[]
          +
          Rest ...shape: number[]

        Returns T

        @@ -5301,13 +5180,12 @@

        Static round

        -

        Returns the value of each element of x rounded to the nearest integer. -

        +

        Returns the value of each element of x rounded to the nearest integer.

        @@ -5344,13 +5222,12 @@

        Static rowAdd

        rowAdd: function
        -

        Adds a multiple of one row multiplied by scalar to another inside x. -

        +

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

        @@ -5397,14 +5274,13 @@

        Static scale

        Multiplies all elements of x with a specified scalar. - Accelerated with BLAS ?scal. -

        + Accelerated with BLAS ?scal.

        @@ -5445,13 +5321,12 @@

        Static set

        -

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

        +

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

        @@ -5492,14 +5367,13 @@

        Static sign

        Returns the sign of each element of x, indicating - whether it is positive, negative or zero. -

        + whether it is positive, negative or zero.

        @@ -5537,13 +5411,12 @@

        Static sin

        -

        Returns the sine of each element of x. -

        +

        Returns the sine of each element of x.

        @@ -5581,13 +5454,12 @@

        Static sinh

        -

        Returns the hyperbolic sine of each element of x. -

        +

        Returns the hyperbolic sine of each element of x.

        @@ -5625,13 +5497,12 @@

        Static slice

        -

        Slices x in the corresponding dimension -

        +

        Slices x in the corresponding dimension

        @@ -5677,14 +5548,13 @@

        Static solve

        solve: function

        Solves the equation AX = B (where A is x and B is y). - Accelerated with LAPACK ?gesv. -

        + Accelerated with LAPACK ?gesv.

        @@ -5725,13 +5595,12 @@

        Static sqrt

        -

        Returns the positive square root of each element of x. -

        +

        Returns the positive square root of each element of x.

        @@ -5768,13 +5637,12 @@

        Static square

        square: function
        -

        Asserts if x is square. -

        +

        Asserts if x is square.

        @@ -5812,13 +5680,12 @@

        Static subtract

        -

        Subtracts y from x. -

        +

        Subtracts y from x.

        @@ -5858,13 +5725,12 @@

        Static swap

        swap: function
        -

        Swaps two rows i and j in x. -

        +

        Swaps two rows i and j in x.

        @@ -5908,13 +5774,12 @@

        Static tan

        -

        Returns the tangent of each element of x. -

        +

        Returns the tangent of each element of x.

        @@ -5952,13 +5817,12 @@

        Static tanh

        -

        Returns the hyperbolic tangent of each element of x. -

        +

        Returns the hyperbolic tangent of each element of x.

        @@ -5995,13 +5859,12 @@

        Static toArray

        toArray: function
        -

        Converts current matrix into a two-dimensional array -

        +

        Converts current matrix into a two-dimensional array

        @@ -6038,13 +5901,12 @@

        Static toString

        toString: function
        -

        Converts x into a readable formatted string -

        +

        Converts x into a readable formatted string

        @@ -6081,13 +5943,12 @@

        Static trace

        trace: function
        -

        Gets the trace of x (the sum of all diagonal elements). -

        +

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

        @@ -6124,13 +5985,12 @@

        Static transpose

        transpose: function
        -

        Transposes x (mirror across the diagonal). -

        +

        Transposes x (mirror across the diagonal).

        @@ -6168,14 +6028,13 @@

        Static trunc

        Returns the integer part of each element of x, - removing any fractional digits. -

        + removing any fractional digits.

        @@ -6213,13 +6072,12 @@

        Static zeros

        -

        Creates an array containing zeros (0) of shape shape -

        +

        Creates an array containing zeros (0) of shape shape

        @@ -6263,7 +6121,7 @@

        T

      • @@ -6761,6 +6619,9 @@

        Returns benchmark

      • +
      • + execSync +
      • floor
      • diff --git a/docs/classes/ndarray.html b/docs/classes/ndarray.html index ef6ee823..243d8358 100644 --- a/docs/classes/ndarray.html +++ b/docs/classes/ndarray.html @@ -227,7 +227,7 @@

        constructor

      • Parameters

        @@ -252,13 +252,12 @@

        abs

        abs: function
        -

        Returns the absolute value of each element of current array. -

        +

        Returns the absolute value of each element of current array.

        @@ -283,13 +282,12 @@

        acos

        acos: function
        -

        Returns the arccosine of each element of current array. -

        +

        Returns the arccosine of each element of current array.

        @@ -314,13 +312,12 @@

        acosh

        acosh: function
        -

        Returns the hyperbolic arccosine of each element of current array. -

        +

        Returns the hyperbolic arccosine of each element of current array.

        @@ -345,14 +342,13 @@

        add

        add: function

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

        + Accelerated with BLAS ?axpy.

        @@ -386,13 +382,12 @@

        asin

        asin: function
        -

        Returns the arcsine of each element of current array. -

        +

        Returns the arcsine of each element of current array.

        @@ -417,13 +412,12 @@

        asinh

        asinh: function
        -

        Returns the hyperbolic arcsine of each element of current array. -

        +

        Returns the hyperbolic arcsine of each element of current array.

        @@ -448,13 +442,12 @@

        atan

        atan: function
        -

        Returns the arctangent of each element of current array. -

        +

        Returns the arctangent of each element of current array.

        @@ -479,13 +472,12 @@

        atanh

        atanh: function
        -

        Returns the hyperbolic arctangent of each element of current array. -

        +

        Returns the hyperbolic arctangent of each element of current array.

        @@ -510,13 +502,12 @@

        binOp

        binOp: function
        -

        Perform binary operation f on x in the current array. -

        +

        Perform binary operation f on x in the current array.

        @@ -574,13 +565,12 @@

        cbrt

        cbrt: function
        -

        Returns the cube root of each element of current array. -

        +

        Returns the cube root of each element of current array.

        @@ -605,13 +595,12 @@

        ceil

        ceil: function
        -

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

        +

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

        @@ -636,13 +625,12 @@

        check

        check: function
        -

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

        +

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

        @@ -673,13 +661,12 @@

        copy

        copy: function
        -

        Makes a copy of the class and underlying data -

        +

        Makes a copy of the class and underlying data

        @@ -704,13 +691,12 @@

        cos

        cos: function
        -

        Returns the cosine of each element of current array. -

        +

        Returns the cosine of each element of current array.

        @@ -735,13 +721,12 @@

        cosh

        cosh: function
        -

        Returns the hyperbolic cosine of each element of current array. -

        +

        Returns the hyperbolic cosine of each element of current array.

        @@ -767,7 +752,7 @@

        data

        @@ -777,14 +762,13 @@

        dot

        dot: function

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

        + Accelerated with BLAS ?dot.

        @@ -816,7 +800,7 @@

        dtype

        @@ -826,13 +810,12 @@

        each

        each: function
        -

        Equivalent to TypedArray.prototype.forEach. -

        +

        Equivalent to TypedArray.prototype.forEach.

        @@ -887,13 +870,12 @@

        equals

        equals: function
        -

        Checks if current array and x are equal. -

        +

        Checks if current array and x are equal.

        @@ -924,13 +906,12 @@

        equidimensional

        equidimensional: function
        -

        Asserts if current array and x have the same shape -

        +

        Asserts if current array and x have the same shape

        @@ -961,13 +942,12 @@

        equilateral

        equilateral: function
        -

        Asserts if current array and x have the same length -

        +

        Asserts if current array and x have the same length

        @@ -998,14 +978,13 @@

        exp

        exp: function

        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. -

        + and e is Euler's constant (2.718…), the base of the natural logarithm.

        @@ -1030,13 +1009,12 @@

        expm1

        expm1: function
        -

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

        +

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

        @@ -1061,13 +1039,12 @@

        fill

        fill: function
        -

        Fills the current array with a scalar value -

        +

        Fills the current array with a scalar value

        @@ -1098,13 +1075,12 @@

        floor

        floor: function
        -

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

        +

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

        @@ -1129,13 +1105,12 @@

        fround

        fround: function
        -

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

        +

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

        @@ -1160,13 +1135,12 @@

        get

        get: function
        -

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

        +

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

        @@ -1198,7 +1172,7 @@

        length

        @@ -1208,13 +1182,12 @@

        log

        log: function
        -

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

        +

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

        @@ -1239,13 +1212,12 @@

        log10

        log10: function
        -

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

        +

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

        @@ -1270,13 +1242,12 @@

        log1p

        log1p: function
        -

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

        +

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

        @@ -1301,13 +1272,12 @@

        log2

        log2: function
        -

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

        +

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

        @@ -1332,13 +1302,12 @@

        map

        map: function
        -

        Equivalent to TypedArray.prototype.map. -

        +

        Equivalent to TypedArray.prototype.map.

        @@ -1393,13 +1362,12 @@

        max

        max: function
        -

        Gets the maximum value (smallest) element of current array. -

        +

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

        @@ -1424,13 +1392,12 @@

        min

        min: function
        -

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

        +

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

        @@ -1455,14 +1422,13 @@

        norm

        norm: function

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

        + Accelerated with BLAS ?nrm2.

        @@ -1487,13 +1453,12 @@

        pow

        pow: function
        -

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

        +

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

        @@ -1524,13 +1489,12 @@

        product

        product: function
        -

        Hadamard product of current matrix and x -

        +

        Hadamard product of current matrix and x

        @@ -1561,13 +1525,12 @@

        reduce

        reduce: function
        -

        Equivalent to TypedArray.prototype.reduce. -

        +

        Equivalent to TypedArray.prototype.reduce.

        @@ -1628,13 +1591,12 @@

        reshape

        reshape: function
        -

        Reshapes current array -

        +

        Reshapes current array

        @@ -1642,14 +1604,14 @@

        Type declaration

          • -
          • (s: number[]): this
          • +
          • (...shape: number[]): this
          • Parameters

            • -
              s: number[]
              +
              Rest ...shape: number[]

            Returns this

            @@ -1665,13 +1627,12 @@

            round

            round: function
            -

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

            +

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

            @@ -1696,14 +1657,13 @@

            scale

            scale: function

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

            + Accelerated with BLAS ?scal.

            @@ -1734,13 +1694,12 @@

            set

            set: function
            -

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

            +

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

            @@ -1772,7 +1731,7 @@

            shape

            @@ -1782,14 +1741,13 @@

            sign

            sign: function

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

            + whether it is positive, negative or zero.

            @@ -1814,13 +1772,12 @@

            sin

            sin: function
            -

            Returns the sine of each element of current array. -

            +

            Returns the sine of each element of current array.

            @@ -1845,13 +1802,12 @@

            sinh

            sinh: function
            -

            Returns the hyperbolic sine of each element of current array. -

            +

            Returns the hyperbolic sine of each element of current array.

            @@ -1876,13 +1832,12 @@

            slice

            slice: function
            -

            Slices the current array in the corresponding dimension -

            +

            Slices the current array in the corresponding dimension

            @@ -1919,13 +1874,12 @@

            sqrt

            sqrt: function
            -

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

            +

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

            @@ -1950,14 +1904,13 @@

            subtract

            subtract: function

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

            + Accelerated with BLAS ?axpy.

            @@ -1988,13 +1941,12 @@

            tan

            tan: function
            -

            Returns the tangent of each element of current array. -

            +

            Returns the tangent of each element of current array.

            @@ -2019,13 +1971,12 @@

            tanh

            tanh: function
            -

            Returns the hyperbolic tangent of each element of current array. -

            +

            Returns the hyperbolic tangent of each element of current array.

            @@ -2050,14 +2001,13 @@

            trunc

            trunc: function

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

            + removing any fractional digits.

            @@ -2082,13 +2032,12 @@

            Static abs

            abs: function
            -

            Returns the absolute value of each element of x. -

            +

            Returns the absolute value of each element of x.

            @@ -2125,13 +2074,12 @@

            Static acos

            acos: function
            -

            Returns the arccosine of each element of x. -

            +

            Returns the arccosine of each element of x.

            @@ -2168,13 +2116,12 @@

            Static acosh

            acosh: function
            -

            Returns the hyperbolic arccosine of each element of x. -

            +

            Returns the hyperbolic arccosine of each element of x.

            @@ -2211,14 +2158,13 @@

            Static add

            add: function

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

            + Accelerated with BLAS ?axpy.

            @@ -2261,13 +2207,12 @@

            Static asin

            asin: function
            -

            Returns the arcsine of each element of x. -

            +

            Returns the arcsine of each element of x.

            @@ -2304,13 +2249,12 @@

            Static asinh

            asinh: function
            -

            Returns the hyperbolic arcsine of each element of x. -

            +

            Returns the hyperbolic arcsine of each element of x.

            @@ -2347,13 +2291,12 @@

            Static atan

            atan: function
            -

            Returns the arctangent of each element of x. -

            +

            Returns the arctangent of each element of x.

            @@ -2390,13 +2333,12 @@

            Static atanh

            atanh: function
            -

            Returns the hyperbolic arctangent of each element of x. -

            +

            Returns the hyperbolic arctangent of each element of x.

            @@ -2433,13 +2375,12 @@

            Static binOp

            binOp: function
            -

            Perform binary operation f on y in x. -

            +

            Perform binary operation f on y in x.

            @@ -2506,13 +2447,12 @@

            Static cbrt

            cbrt: function
            -

            Returns the cube root of each element of x. -

            +

            Returns the cube root of each element of x.

            @@ -2549,13 +2489,12 @@

            Static ceil

            ceil: function
            -

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

            +

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

            @@ -2592,13 +2531,12 @@

            Static check

            check: function
            -

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

            +

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

            @@ -2638,13 +2576,12 @@

            Static copy

            copy: function
            -

            Makes a copy of x -

            +

            Makes a copy of x

            @@ -2681,13 +2618,12 @@

            Static cos

            cos: function
            -

            Returns the cosine of each element of x. -

            +

            Returns the cosine of each element of x.

            @@ -2724,13 +2660,12 @@

            Static cosh

            cosh: function
            -

            Returns the hyperbolic cosine of each element of x. -

            +

            Returns the hyperbolic cosine of each element of x.

            @@ -2767,14 +2702,13 @@

            Static dot

            dot: function

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

            + Accelerated with BLAS ?dot.

            @@ -2814,13 +2748,12 @@

            Static each

            each: function
            -

            Equivalent to TypedArray.prototype.forEach. -

            +

            Equivalent to TypedArray.prototype.forEach.

            @@ -2884,13 +2817,12 @@

            Static equals

            equals: function
            -

            Checks if x and y are equal. -

            +

            Checks if x and y are equal.

            @@ -2930,13 +2862,12 @@

            Static equidimensional

            equidimensional: function
            -

            Asserts if x and y have the same shape -

            +

            Asserts if x and y have the same shape

            @@ -2976,13 +2907,12 @@

            Static equilateral

            equilateral: function
            -

            Asserts if x and y have the same length -

            +

            Asserts if x and y have the same length

            @@ -3022,14 +2952,13 @@

            Static exp

            exp: function

            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. -

            + and e is Euler's constant (2.718…), the base of the natural logarithm.

            @@ -3066,13 +2995,12 @@

            Static expm1

            expm1: function
            -

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

            +

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

            @@ -3109,13 +3037,12 @@

            Static eye

            eye: function
            -

            Creates an identity matrix of size n and type type. -

            +

            Creates an identity matrix of size n and type type.

            @@ -3152,13 +3079,12 @@

            Static fill

            fill: function
            -

            Fills x with a scalar value -

            +

            Fills x with a scalar value

            @@ -3198,13 +3124,12 @@

            Static floor

            floor: function
            -

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

            +

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

            @@ -3241,13 +3166,12 @@

            Static fround

            fround: function
            -

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

            +

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

            @@ -3284,13 +3208,12 @@

            Static get

            get: function
            -

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

            +

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

            @@ -3330,13 +3253,12 @@

            Static log

            log: function
            -

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

            +

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

            @@ -3373,13 +3295,12 @@

            Static log10

            log10: function
            -

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

            +

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

            @@ -3416,13 +3337,12 @@

            Static log1p

            log1p: function
            -

            Returns the base 2 logarithm of each element of x. -

            +

            Returns the base 2 logarithm of each element of x.

            @@ -3459,13 +3379,12 @@

            Static log2

            log2: function
            -

            Returns the base 10 logarithm of each element of x. -

            +

            Returns the base 10 logarithm of each element of x.

            @@ -3502,13 +3421,12 @@

            Static map

            map: function
            -

            Equivalent to TypedArray.prototype.map. -

            +

            Equivalent to TypedArray.prototype.map.

            @@ -3572,14 +3490,13 @@

            Static max

            max: function

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

            + Accelerated with BLAS i?amax.

            @@ -3616,13 +3533,12 @@

            Static min

            min: function
            -

            Gets the minimum value (smallest) element of x. -

            +

            Gets the minimum value (smallest) element of x.

            @@ -3659,14 +3575,13 @@

            Static norm

            norm: function

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

            + Accelerated with BLAS ?nrm2.

            @@ -3703,13 +3618,12 @@

            Static ones

            ones: function
            -

            Creates an array containing ones (1) of shape shape -

            +

            Creates an array containing ones (1) of shape shape

            @@ -3746,13 +3660,12 @@

            Static pow

            pow: function
            -

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

            +

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

            @@ -3792,13 +3705,12 @@

            Static product

            product: function
            -

            Hadamard product of x and y -

            +

            Hadamard product of x and y

            @@ -3838,13 +3750,12 @@

            Static random

            random: function
            -

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

            +

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

            @@ -3881,7 +3792,7 @@

            Static range

            range: function
            @@ -3889,8 +3800,7 @@

            Static range

            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) -

            + steps of 0.5)

            @@ -3927,13 +3837,12 @@

            Static reduce

            reduce: function
            -

            Equivalent to TypedArray.prototype.reduce. -

            +

            Equivalent to TypedArray.prototype.reduce.

            @@ -3997,13 +3906,12 @@

            Static reshape

            reshape: function
            -

            Reshapes x -

            +

            Reshapes x

            @@ -4011,7 +3919,7 @@

            Type declaration

              • -
              • <T>(x: T, s: number[]): T
              • +
              • <T>(x: T, ...shape: number[]): T
              • @@ -4027,7 +3935,7 @@

                Parameters

                x: T
              • -
                s: number[]
                +
                Rest ...shape: number[]

              Returns T

              @@ -4043,13 +3951,12 @@

              Static round

              round: function
              -

              Returns the value of each element of x rounded to the nearest integer. -

              +

              Returns the value of each element of x rounded to the nearest integer.

              @@ -4086,14 +3993,13 @@

              Static scale

              scale: function

              Multiplies all elements of x with a specified scalar. - Accelerated with BLAS ?scal. -

              + Accelerated with BLAS ?scal.

              @@ -4133,13 +4039,12 @@

              Static set

              set: function
              -

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

              +

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

              @@ -4179,14 +4084,13 @@

              Static sign

              sign: function

              Returns the sign of each element of x, indicating - whether it is positive, negative or zero. -

              + whether it is positive, negative or zero.

              @@ -4223,13 +4127,12 @@

              Static sin

              sin: function
              -

              Returns the sine of each element of x. -

              +

              Returns the sine of each element of x.

              @@ -4266,13 +4169,12 @@

              Static sinh

              sinh: function
              -

              Returns the hyperbolic sine of each element of x. -

              +

              Returns the hyperbolic sine of each element of x.

              @@ -4309,13 +4211,12 @@

              Static slice

              slice: function
              -

              Slices x in the corresponding dimension -

              +

              Slices x in the corresponding dimension

              @@ -4361,13 +4262,12 @@

              Static sqrt

              sqrt: function
              -

              Returns the positive square root of each element of x. -

              +

              Returns the positive square root of each element of x.

              @@ -4404,13 +4304,12 @@

              Static subtract

              subtract: function
              -

              Subtracts y from x. -

              +

              Subtracts y from x.

              @@ -4450,13 +4349,12 @@

              Static tan

              tan: function
              -

              Returns the tangent of each element of x. -

              +

              Returns the tangent of each element of x.

              @@ -4493,13 +4391,12 @@

              Static tanh

              tanh: function
              -

              Returns the hyperbolic tangent of each element of x. -

              +

              Returns the hyperbolic tangent of each element of x.

              @@ -4536,14 +4433,13 @@

              Static trunc

              trunc: function

              Returns the integer part of each element of x, - removing any fractional digits. -

              + removing any fractional digits.

              @@ -4580,13 +4476,12 @@

              Static zeros

              zeros: function
              -

              Creates an array containing zeros (0) of shape shape -

              +

              Creates an array containing zeros (0) of shape shape

              @@ -4989,6 +4884,9 @@

              Returns T<
            • benchmark
            • +
            • + execSync +
            • floor
            • diff --git a/docs/classes/vector.html b/docs/classes/vector.html index a1200065..83361909 100644 --- a/docs/classes/vector.html +++ b/docs/classes/vector.html @@ -250,7 +250,7 @@

              constructor

              Parameters

              @@ -273,13 +273,12 @@

              abs

              -

              Returns the absolute value of each element of current array. -

              +

              Returns the absolute value of each element of current array.

              @@ -305,13 +304,12 @@

              acos

              -

              Returns the arccosine of each element of current array. -

              +

              Returns the arccosine of each element of current array.

              @@ -337,13 +335,12 @@

              acosh

              -

              Returns the hyperbolic arccosine of each element of current array. -

              +

              Returns the hyperbolic arccosine of each element of current array.

              @@ -369,14 +366,13 @@

              add

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

              + Accelerated with BLAS ?axpy.

              @@ -410,13 +406,12 @@

              angle

              angle: function
              -

              Determines the angle between the current vector and x. -

              +

              Determines the angle between the current vector and x.

              @@ -448,13 +443,12 @@

              asin

              -

              Returns the arcsine of each element of current array. -

              +

              Returns the arcsine of each element of current array.

              @@ -480,13 +474,12 @@

              asinh

              -

              Returns the hyperbolic arcsine of each element of current array. -

              +

              Returns the hyperbolic arcsine of each element of current array.

              @@ -512,13 +505,12 @@

              atan

              -

              Returns the arctangent of each element of current array. -

              +

              Returns the arctangent of each element of current array.

              @@ -544,13 +536,12 @@

              atanh

              -

              Returns the hyperbolic arctangent of each element of current array. -

              +

              Returns the hyperbolic arctangent of each element of current array.

              @@ -576,13 +567,12 @@

              binOp

              -

              Perform binary operation f on x in the current array. -

              +

              Perform binary operation f on x in the current array.

              @@ -641,13 +631,12 @@

              cbrt

              -

              Returns the cube root of each element of current array. -

              +

              Returns the cube root of each element of current array.

              @@ -673,13 +662,12 @@

              ceil

              -

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

              +

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

              @@ -705,13 +693,12 @@

              check

              -

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

              +

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

              @@ -742,13 +729,12 @@

              combine

              combine: function
              -

              Combines the current vector with x -

              +

              Combines the current vector with x

              @@ -780,13 +766,12 @@

              copy

              -

              Makes a copy of the class and underlying data -

              +

              Makes a copy of the class and underlying data

              @@ -812,13 +797,12 @@

              cos

              -

              Returns the cosine of each element of current array. -

              +

              Returns the cosine of each element of current array.

              @@ -844,13 +828,12 @@

              cosh

              -

              Returns the hyperbolic cosine of each element of current array. -

              +

              Returns the hyperbolic cosine of each element of current array.

              @@ -875,7 +858,7 @@

              cross

              cross: function
              @@ -883,8 +866,7 @@

              cross

              Computes the cross product of the current vector and the vector x This operation can only be calculated for vectors with three components. Otherwise it throws an exception. - The method returns a new (result) vector. -

              + The method returns a new (result) vector.

              @@ -917,7 +899,7 @@

              data

              Implementation of INDArray.data

              Inherited from NDArray.data

              @@ -928,14 +910,13 @@

              dot

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

              + Accelerated with BLAS ?dot.

              @@ -968,7 +949,7 @@

              dtype

              Implementation of INDArray.dtype

              Inherited from NDArray.dtype

              @@ -979,13 +960,12 @@

              each

              -

              Equivalent to TypedArray.prototype.forEach. -

              +

              Equivalent to TypedArray.prototype.forEach.

              @@ -1041,13 +1021,12 @@

              equals

              -

              Checks if current array and x are equal. -

              +

              Checks if current array and x are equal.

              @@ -1079,13 +1058,12 @@

              equidimensional

              -

              Asserts if current array and x have the same shape -

              +

              Asserts if current array and x have the same shape

              @@ -1117,13 +1095,12 @@

              equilateral

              -

              Asserts if current array and x have the same length -

              +

              Asserts if current array and x have the same length

              @@ -1155,14 +1132,13 @@

              exp

              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. -

              + and e is Euler's constant (2.718…), the base of the natural logarithm.

              @@ -1188,13 +1164,12 @@

              expm1

              -

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

              +

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

              @@ -1220,13 +1195,12 @@

              fill

              -

              Fills the current array with a scalar value -

              +

              Fills the current array with a scalar value

              @@ -1258,13 +1232,12 @@

              floor

              -

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

              +

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

              @@ -1290,13 +1263,12 @@

              fround

              -

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

              +

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

              @@ -1322,13 +1294,12 @@

              get

              -

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

              +

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

              @@ -1361,7 +1332,7 @@

              length

              Implementation of INDArray.length

              Inherited from NDArray.length

              @@ -1372,13 +1343,12 @@

              log

              -

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

              +

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

              @@ -1404,13 +1374,12 @@

              log10

              -

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

              +

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

              @@ -1436,13 +1405,12 @@

              log1p

              -

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

              +

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

              @@ -1468,13 +1436,12 @@

              log2

              -

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

              +

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

              @@ -1500,13 +1467,12 @@

              map

              -

              Equivalent to TypedArray.prototype.map. -

              +

              Equivalent to TypedArray.prototype.map.

              @@ -1562,13 +1528,12 @@

              max

              -

              Gets the maximum value (smallest) element of current array. -

              +

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

              @@ -1594,13 +1559,12 @@

              min

              -

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

              +

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

              @@ -1626,14 +1590,13 @@

              norm

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

              + Accelerated with BLAS ?nrm2.

              @@ -1658,13 +1621,12 @@

              normalize

              normalize: function
              -

              Normalizes current vector. -

              +

              Normalizes current vector.

              @@ -1690,13 +1652,12 @@

              pow

              -

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

              +

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

              @@ -1728,13 +1689,12 @@

              product

              -

              Hadamard product of current matrix and x -

              +

              Hadamard product of current matrix and x

              @@ -1765,13 +1725,12 @@

              project

              project: function
              -

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

              +

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

              @@ -1802,13 +1761,12 @@

              push

              push: function
              -

              Pushes a new value into current vector. -

              +

              Pushes a new value into current vector.

              @@ -1840,13 +1798,12 @@

              reduce

              -

              Equivalent to TypedArray.prototype.reduce. -

              +

              Equivalent to TypedArray.prototype.reduce.

              @@ -1908,13 +1865,12 @@

              reshape

              -

              Reshapes current array -

              +

              Reshapes current array

              @@ -1922,14 +1878,14 @@

              Type declaration

                • -
                • (s: number[]): this
                • +
                • (...shape: number[]): this
                • Parameters

                  • -
                    s: number[]
                    +
                    Rest ...shape: number[]

                  Returns this

                  @@ -1946,13 +1902,12 @@

                  round

                  -

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

                  +

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

                  @@ -1978,14 +1933,13 @@

                  scale

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

                  + Accelerated with BLAS ?scal.

                  @@ -2017,13 +1971,12 @@

                  set

                  -

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

                  +

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

                  @@ -2056,7 +2009,7 @@

                  shape

                  Implementation of INDArray.shape

                  Inherited from NDArray.shape

                  @@ -2067,14 +2020,13 @@

                  sign

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

                  + whether it is positive, negative or zero.

                  @@ -2100,13 +2052,12 @@

                  sin

                  -

                  Returns the sine of each element of current array. -

                  +

                  Returns the sine of each element of current array.

                  @@ -2132,13 +2083,12 @@

                  sinh

                  -

                  Returns the hyperbolic sine of each element of current array. -

                  +

                  Returns the hyperbolic sine of each element of current array.

                  @@ -2164,13 +2114,12 @@

                  slice

                  -

                  Slices the current array in the corresponding dimension -

                  +

                  Slices the current array in the corresponding dimension

                  @@ -2208,13 +2157,12 @@

                  sqrt

                  -

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

                  +

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

                  @@ -2240,14 +2188,13 @@

                  subtract

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

                  + Accelerated with BLAS ?axpy.

                  @@ -2279,13 +2226,12 @@

                  tan

                  -

                  Returns the tangent of each element of current array. -

                  +

                  Returns the tangent of each element of current array.

                  @@ -2311,13 +2257,12 @@

                  tanh

                  -

                  Returns the hyperbolic tangent of each element of current array. -

                  +

                  Returns the hyperbolic tangent of each element of current array.

                  @@ -2342,13 +2287,12 @@

                  toArray

                  toArray: function
                  -

                  Converts current vector into a JavaScript array. -

                  +

                  Converts current vector into a JavaScript array.

                  @@ -2373,13 +2317,12 @@

                  toString

                  toString: function
                  -

                  Converts current vector into a readable formatted string. -

                  +

                  Converts current vector into a readable formatted string.

                  @@ -2405,14 +2348,13 @@

                  trunc

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

                  + removing any fractional digits.

                  @@ -2438,13 +2380,12 @@

                  Static abs

                  -

                  Returns the absolute value of each element of x. -

                  +

                  Returns the absolute value of each element of x.

                  @@ -2482,13 +2423,12 @@

                  Static acos

                  -

                  Returns the arccosine of each element of x. -

                  +

                  Returns the arccosine of each element of x.

                  @@ -2526,13 +2466,12 @@

                  Static acosh

                  -

                  Returns the hyperbolic arccosine of each element of x. -

                  +

                  Returns the hyperbolic arccosine of each element of x.

                  @@ -2570,14 +2509,13 @@

                  Static add

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

                  + Accelerated with BLAS ?axpy.

                  @@ -2620,13 +2558,12 @@

                  Static angle

                  angle: function
                  -

                  Determines the angle between the x and y -

                  +

                  Determines the angle between the x and y

                  @@ -2661,13 +2598,12 @@

                  Static asin

                  -

                  Returns the arcsine of each element of x. -

                  +

                  Returns the arcsine of each element of x.

                  @@ -2705,13 +2641,12 @@

                  Static asinh

                  -

                  Returns the hyperbolic arcsine of each element of x. -

                  +

                  Returns the hyperbolic arcsine of each element of x.

                  @@ -2749,13 +2684,12 @@

                  Static atan

                  -

                  Returns the arctangent of each element of x. -

                  +

                  Returns the arctangent of each element of x.

                  @@ -2793,13 +2727,12 @@

                  Static atanh

                  -

                  Returns the hyperbolic arctangent of each element of x. -

                  +

                  Returns the hyperbolic arctangent of each element of x.

                  @@ -2837,13 +2770,12 @@

                  Static binOp

                  -

                  Perform binary operation f on y in x. -

                  +

                  Perform binary operation f on y in x.

                  @@ -2911,13 +2843,12 @@

                  Static cbrt

                  -

                  Returns the cube root of each element of x. -

                  +

                  Returns the cube root of each element of x.

                  @@ -2955,13 +2886,12 @@

                  Static ceil

                  -

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

                  +

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

                  @@ -2999,13 +2929,12 @@

                  Static check

                  -

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

                  +

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

                  @@ -3045,13 +2974,12 @@

                  Static combine

                  combine: function
                  -

                  Combines the vector x with y -

                  +

                  Combines the vector x with y

                  @@ -3086,13 +3014,12 @@

                  Static copy

                  -

                  Makes a copy of x -

                  +

                  Makes a copy of x

                  @@ -3130,13 +3057,12 @@

                  Static cos

                  -

                  Returns the cosine of each element of x. -

                  +

                  Returns the cosine of each element of x.

                  @@ -3174,13 +3100,12 @@

                  Static cosh

                  -

                  Returns the hyperbolic cosine of each element of x. -

                  +

                  Returns the hyperbolic cosine of each element of x.

                  @@ -3217,7 +3142,7 @@

                  Static cross

                  cross: function
                  @@ -3225,8 +3150,7 @@

                  Static cross

                  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. - The method returns a new (result) vector. -

                  + The method returns a new (result) vector.

                  @@ -3261,14 +3185,13 @@

                  Static dot

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

                  + Accelerated with BLAS ?dot.

                  @@ -3309,13 +3232,12 @@

                  Static each

                  -

                  Equivalent to TypedArray.prototype.forEach. -

                  +

                  Equivalent to TypedArray.prototype.forEach.

                  @@ -3380,13 +3302,12 @@

                  Static equals

                  -

                  Checks if x and y are equal. -

                  +

                  Checks if x and y are equal.

                  @@ -3427,13 +3348,12 @@

                  Static equidimensional

                  -

                  Asserts if x and y have the same shape -

                  +

                  Asserts if x and y have the same shape

                  @@ -3474,13 +3394,12 @@

                  Static equilateral

                  -

                  Asserts if x and y have the same length -

                  +

                  Asserts if x and y have the same length

                  @@ -3521,14 +3440,13 @@

                  Static exp

                  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. -

                  + and e is Euler's constant (2.718…), the base of the natural logarithm.

                  @@ -3566,13 +3484,12 @@

                  Static expm1

                  -

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

                  +

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

                  @@ -3610,13 +3527,12 @@

                  Static eye

                  -

                  Creates an identity matrix of size n and type type. -

                  +

                  Creates an identity matrix of size n and type type.

                  @@ -3654,13 +3570,12 @@

                  Static fill

                  -

                  Fills x with a scalar value -

                  +

                  Fills x with a scalar value

                  @@ -3701,13 +3616,12 @@

                  Static floor

                  -

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

                  +

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

                  @@ -3745,13 +3659,12 @@

                  Static fround

                  -

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

                  +

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

                  @@ -3789,13 +3702,12 @@

                  Static get

                  -

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

                  +

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

                  @@ -3836,13 +3748,12 @@

                  Static log

                  -

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

                  +

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

                  @@ -3880,13 +3791,12 @@

                  Static log10

                  -

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

                  +

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

                  @@ -3924,13 +3834,12 @@

                  Static log1p

                  -

                  Returns the base 2 logarithm of each element of x. -

                  +

                  Returns the base 2 logarithm of each element of x.

                  @@ -3968,13 +3877,12 @@

                  Static log2

                  -

                  Returns the base 10 logarithm of each element of x. -

                  +

                  Returns the base 10 logarithm of each element of x.

                  @@ -4012,13 +3920,12 @@

                  Static map

                  -

                  Equivalent to TypedArray.prototype.map. -

                  +

                  Equivalent to TypedArray.prototype.map.

                  @@ -4083,14 +3990,13 @@

                  Static max

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

                  + Accelerated with BLAS i?amax.

                  @@ -4128,13 +4034,12 @@

                  Static min

                  -

                  Gets the minimum value (smallest) element of x. -

                  +

                  Gets the minimum value (smallest) element of x.

                  @@ -4172,14 +4077,13 @@

                  Static norm

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

                  + Accelerated with BLAS ?nrm2.

                  @@ -4216,13 +4120,12 @@

                  Static normalize

                  normalize: function
                  -

                  Normalizes x. -

                  +

                  Normalizes x.

                  @@ -4254,13 +4157,12 @@

                  Static ones

                  -

                  Creates an array containing ones (1) of shape shape -

                  +

                  Creates an array containing ones (1) of shape shape

                  @@ -4298,13 +4200,12 @@

                  Static pow

                  -

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

                  +

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

                  @@ -4345,13 +4246,12 @@

                  Static product

                  -

                  Hadamard product of x and y -

                  +

                  Hadamard product of x and y

                  @@ -4391,13 +4291,12 @@

                  Static project

                  project: function
                  -

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

                  +

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

                  @@ -4431,13 +4330,12 @@

                  Static push

                  push: function
                  -

                  Pushes a new value into x. -

                  +

                  Pushes a new value into x.

                  @@ -4472,13 +4370,12 @@

                  Static random

                  -

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

                  +

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

                  @@ -4516,7 +4413,7 @@

                  Static range

                  @@ -4524,8 +4421,7 @@

                  Static range

                  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) -

                  + steps of 0.5)

                  @@ -4563,13 +4459,12 @@

                  Static reduce

                  -

                  Equivalent to TypedArray.prototype.reduce. -

                  +

                  Equivalent to TypedArray.prototype.reduce.

                  @@ -4634,13 +4529,12 @@

                  Static reshape

                  -

                  Reshapes x -

                  +

                  Reshapes x

                  @@ -4648,7 +4542,7 @@

                  Type declaration

                    • -
                    • <T>(x: T, s: number[]): T
                    • +
                    • <T>(x: T, ...shape: number[]): T
                    • @@ -4664,7 +4558,7 @@

                      Parameters

                      x: T
                    • -
                      s: number[]
                      +
                      Rest ...shape: number[]

                    Returns T

                    @@ -4681,13 +4575,12 @@

                    Static round

                    -

                    Returns the value of each element of x rounded to the nearest integer. -

                    +

                    Returns the value of each element of x rounded to the nearest integer.

                    @@ -4725,14 +4618,13 @@

                    Static scale

                    Multiplies all elements of x with a specified scalar. - Accelerated with BLAS ?scal. -

                    + Accelerated with BLAS ?scal.

                    @@ -4773,13 +4665,12 @@

                    Static set

                    -

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

                    +

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

                    @@ -4820,14 +4711,13 @@

                    Static sign

                    Returns the sign of each element of x, indicating - whether it is positive, negative or zero. -

                    + whether it is positive, negative or zero.

                    @@ -4865,13 +4755,12 @@

                    Static sin

                    -

                    Returns the sine of each element of x. -

                    +

                    Returns the sine of each element of x.

                    @@ -4909,13 +4798,12 @@

                    Static sinh

                    -

                    Returns the hyperbolic sine of each element of x. -

                    +

                    Returns the hyperbolic sine of each element of x.

                    @@ -4953,13 +4841,12 @@

                    Static slice

                    -

                    Slices x in the corresponding dimension -

                    +

                    Slices x in the corresponding dimension

                    @@ -5006,13 +4893,12 @@

                    Static sqrt

                    -

                    Returns the positive square root of each element of x. -

                    +

                    Returns the positive square root of each element of x.

                    @@ -5050,13 +4936,12 @@

                    Static subtract

                    -

                    Subtracts y from x. -

                    +

                    Subtracts y from x.

                    @@ -5097,13 +4982,12 @@

                    Static tan

                    -

                    Returns the tangent of each element of x. -

                    +

                    Returns the tangent of each element of x.

                    @@ -5141,13 +5025,12 @@

                    Static tanh

                    -

                    Returns the hyperbolic tangent of each element of x. -

                    +

                    Returns the hyperbolic tangent of each element of x.

                    @@ -5184,13 +5067,12 @@

                    Static toArray

                    toArray: function
                    -

                    Converts x into a JavaScript array. -

                    +

                    Converts x into a JavaScript array.

                    @@ -5221,13 +5103,12 @@

                    Static toString

                    toString: function
                    -

                    Converts x into a readable formatted string. -

                    +

                    Converts x into a readable formatted string.

                    @@ -5259,14 +5140,13 @@

                    Static trunc

                    Returns the integer part of each element of x, - removing any fractional digits. -

                    + removing any fractional digits.

                    @@ -5304,13 +5184,12 @@

                    Static zeros

                    -

                    Creates an array containing zeros (0) of shape shape -

                    +

                    Creates an array containing zeros (0) of shape shape

                    @@ -5355,7 +5234,7 @@

                    w

                  • @@ -5368,7 +5247,7 @@

                    Returns number
                    @@ -5397,7 +5276,7 @@

                    x

                  • @@ -5410,7 +5289,7 @@

                    Returns number
                    @@ -5439,7 +5318,7 @@

                    y

                  • @@ -5452,7 +5331,7 @@

                    Returns number
                    @@ -5481,7 +5360,7 @@

                    z

                  • @@ -5494,7 +5373,7 @@

                    Returns number
                    @@ -5944,6 +5823,9 @@

                    Returns void benchmark

                  • +
                  • + execSync +
                  • floor
                  • diff --git a/docs/index.html b/docs/index.html index 2c362e11..3019d455 100644 --- a/docs/index.html +++ b/docs/index.html @@ -93,6 +93,7 @@

                    Type aliases

                    Variables

                    • benchmark
                    • +
                    • execSync
                    • floor
                    • nblas
                    • nlapack
                    • @@ -127,7 +128,7 @@

                      DType

                      DType: "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "uint8c" | "float32" | "float64" | "complex64" | "complex128"
                      @@ -137,7 +138,7 @@

                      TypedArray

                      TypedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array
                      @@ -147,7 +148,7 @@

                      TypedArrayConstructor

                      TypedArrayConstructor: Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Uint8ClampedArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor
                      @@ -160,7 +161,17 @@

                      Const benchmark

                      benchmark: any = require('nodemark')
                      + +
                      + +

                      execSync

                      +
                      execSync: any
                      +
                      @@ -170,28 +181,28 @@

                      floor

                      floor: floor
                      @@ -201,12 +212,12 @@

                      Let nblas

                      nblas: any
                      @@ -216,10 +227,10 @@

                      Let nlapack

                      nlapack: any
                      @@ -229,7 +240,7 @@

                      Const plt

                      plt: any = require('matplotnode')
                      @@ -239,59 +250,59 @@

                      random

                      random: random
                      @@ -301,24 +312,24 @@

                      sqrt

                      sqrt: sqrt
                      @@ -335,7 +346,7 @@

                      Const bench

                    • Parameters

                      @@ -385,7 +396,7 @@

                      Const flatten

                    • Parameters

                      @@ -408,7 +419,7 @@

                      Const get_dtype

                    • Parameters

                      @@ -431,7 +442,7 @@

                      Const get_shape

                    • Parameters

                      @@ -454,7 +465,7 @@

                      Const get_type

                    • Parameters

                      @@ -477,7 +488,7 @@

                      Const is_typed_array

                      Parameters

                      @@ -500,7 +511,7 @@

                      Const magicHelper

                    • Parameters

                      @@ -604,7 +615,7 @@

                      Const r

                    • Parameters

                      @@ -618,7 +629,7 @@

                      Returns

                      Parameters

                      @@ -632,7 +643,7 @@

                      Returns

                      Parameters

                      @@ -646,7 +657,7 @@

                      Returns

                      Parameters

                      @@ -660,7 +671,7 @@

                      Returns

                      Parameters

                      @@ -674,7 +685,7 @@

                      Returns

                      Parameters

                      @@ -688,7 +699,7 @@

                      Returns

                      Parameters

                      @@ -702,7 +713,7 @@

                      Returns

                      Parameters

                      @@ -716,7 +727,7 @@

                      Returns

                      Parameters

                      @@ -730,7 +741,7 @@

                      Returns

                      Parameters

                      @@ -744,7 +755,7 @@

                      Returns

                      Parameters

                      @@ -758,7 +769,7 @@

                      Returns

                      Parameters

                      @@ -772,7 +783,7 @@

                      Returns

                      Parameters

                      @@ -786,7 +797,7 @@

                      Returns

                      Parameters

                      @@ -800,7 +811,7 @@

                      Returns

                      Parameters

                      @@ -814,7 +825,7 @@

                      Returns

                      Parameters

                      @@ -828,7 +839,7 @@

                      Returns

                      Parameters

                      @@ -842,7 +853,7 @@

                      Returns

                      Parameters

                      @@ -856,7 +867,7 @@

                      Returns

                      Parameters

                      @@ -870,7 +881,7 @@

                      Returns

                      Parameters

                      @@ -884,7 +895,7 @@

                      Returns

                      Parameters

                      @@ -898,7 +909,7 @@

                      Returns

                      Parameters

                      @@ -912,7 +923,7 @@

                      Returns

                      Parameters

                      @@ -926,7 +937,7 @@

                      Returns

                      Parameters

                      @@ -940,7 +951,7 @@

                      Returns

                      Parameters

                      @@ -954,7 +965,7 @@

                      Returns

                      Parameters

                      @@ -968,7 +979,7 @@

                      Returns

                      Parameters

                      @@ -982,7 +993,7 @@

                      Returns

                      Parameters

                      @@ -996,7 +1007,7 @@

                      Returns

                      Parameters

                      @@ -1010,7 +1021,7 @@

                      Returns

                      Parameters

                      @@ -1024,7 +1035,7 @@

                      Returns

                      Parameters

                      @@ -1038,7 +1049,7 @@

                      Returns

                      Parameters

                      @@ -1052,7 +1063,7 @@

                      Returns

                      Parameters

                      @@ -1066,7 +1077,7 @@

                      Returns

                      Parameters

                      @@ -1080,7 +1091,7 @@

                      Returns

                      Parameters

                      @@ -1094,7 +1105,7 @@

                      Returns

                      Parameters

                      @@ -1108,7 +1119,7 @@

                      Returns

                      Parameters

                      @@ -1122,7 +1133,7 @@

                      Returns

                      Parameters

                      @@ -1136,7 +1147,7 @@

                      Returns

                      Parameters

                      @@ -1150,7 +1161,7 @@

                      Returns

                      Parameters

                      @@ -1164,7 +1175,7 @@

                      Returns

                      Parameters

                      @@ -1178,7 +1189,7 @@

                      Returns

                      Parameters

                      @@ -1192,7 +1203,7 @@

                      Returns

                      Parameters

                      @@ -1206,7 +1217,7 @@

                      Returns

                      Parameters

                      @@ -1220,7 +1231,7 @@

                      Returns

                      Parameters

                      @@ -1234,7 +1245,7 @@

                      Returns

                      Parameters

                      @@ -1248,7 +1259,7 @@

                      Returns

                      Parameters

                      @@ -1262,7 +1273,7 @@

                      Returns

                      Parameters

                      @@ -1276,7 +1287,7 @@

                      Returns

                      Parameters

                      @@ -1290,7 +1301,7 @@

                      Returns

                      Parameters

                      @@ -1304,7 +1315,7 @@

                      Returns

                      Parameters

                      @@ -1318,7 +1329,7 @@

                      Returns

                      Parameters

                      @@ -1332,7 +1343,7 @@

                      Returns

                      Parameters

                      @@ -1346,7 +1357,7 @@

                      Returns

                      Parameters

                      @@ -1360,7 +1371,7 @@

                      Returns

                      Parameters

                      @@ -1374,7 +1385,7 @@

                      Returns

                      Parameters

                      @@ -1388,7 +1399,7 @@

                      Returns

                      Parameters

                      @@ -1402,7 +1413,7 @@

                      Returns

                      Parameters

                      @@ -1416,7 +1427,7 @@

                      Returns

                      Parameters

                      @@ -1430,7 +1441,7 @@

                      Returns

                      Parameters

                      @@ -1444,7 +1455,7 @@

                      Returns

                      Parameters

                      @@ -1458,7 +1469,7 @@

                      Returns

                      Parameters

                      @@ -1472,7 +1483,7 @@

                      Returns

                      Parameters

                      @@ -1486,7 +1497,7 @@

                      Returns

                      Parameters

                      @@ -1500,7 +1511,7 @@

                      Returns

                      Parameters

                      @@ -1514,7 +1525,7 @@

                      Returns

                      Parameters

                      @@ -1528,7 +1539,7 @@

                      Returns

                      Parameters

                      @@ -1542,7 +1553,7 @@

                      Returns

                      Parameters

                      @@ -1556,7 +1567,7 @@

                      Returns

                      Parameters

                      @@ -1570,7 +1581,7 @@

                      Returns

                      Parameters

                      @@ -1584,7 +1595,7 @@

                      Returns

                      Parameters

                      @@ -1598,7 +1609,7 @@

                      Returns

                      Parameters

                      @@ -1612,7 +1623,7 @@

                      Returns

                      Parameters

                      @@ -1626,7 +1637,7 @@

                      Returns

                      Parameters

                      @@ -1640,7 +1651,7 @@

                      Returns

                      Parameters

                      @@ -1654,7 +1665,7 @@

                      Returns

                      Parameters

                      @@ -1677,7 +1688,7 @@

                      Const rhs

                    • Parameters

                      @@ -1700,7 +1711,7 @@

                      Const rotate

                    • @@ -1782,6 +1793,9 @@

                      Returns void benchmark

                    • +
                    • + execSync +
                    • floor
                    • diff --git a/docs/interfaces/indarray.html b/docs/interfaces/indarray.html index 2b6739df..7088c79e 100644 --- a/docs/interfaces/indarray.html +++ b/docs/interfaces/indarray.html @@ -106,7 +106,7 @@

                      data

                      @@ -116,7 +116,7 @@

                      dtype

                      dtype: DType
                      @@ -126,7 +126,7 @@

                      length

                      length: number
                      @@ -136,7 +136,7 @@

                      shape

                      shape: number[]
                      @@ -194,6 +194,9 @@

                      shape

                    • benchmark
                    • +
                    • + execSync +
                    • floor
                    • diff --git a/docs/media/Matrix/augment.png b/docs/media/Matrix/augment.png deleted file mode 100644 index f5f9760e..00000000 Binary files a/docs/media/Matrix/augment.png and /dev/null differ diff --git a/docs/media/Matrix/det.png b/docs/media/Matrix/det.png deleted file mode 100644 index 2ec5f70f..00000000 Binary files a/docs/media/Matrix/det.png and /dev/null differ diff --git a/docs/media/Matrix/diag.png b/docs/media/Matrix/diag.png deleted file mode 100644 index 55590881..00000000 Binary files a/docs/media/Matrix/diag.png and /dev/null differ diff --git a/docs/media/Matrix/eig.png b/docs/media/Matrix/eig.png deleted file mode 100644 index d27c00cb..00000000 Binary files a/docs/media/Matrix/eig.png and /dev/null differ diff --git a/docs/media/Matrix/gauss.png b/docs/media/Matrix/gauss.png deleted file mode 100644 index 0653324f..00000000 Binary files a/docs/media/Matrix/gauss.png and /dev/null differ diff --git a/docs/media/Matrix/inv.png b/docs/media/Matrix/inv.png deleted file mode 100644 index a91079b6..00000000 Binary files a/docs/media/Matrix/inv.png and /dev/null differ diff --git a/docs/media/Matrix/lu.png b/docs/media/Matrix/lu.png deleted file mode 100644 index 62574717..00000000 Binary files a/docs/media/Matrix/lu.png and /dev/null differ diff --git a/docs/media/Matrix/lu_factor.png b/docs/media/Matrix/lu_factor.png deleted file mode 100644 index 5a0cd194..00000000 Binary files a/docs/media/Matrix/lu_factor.png and /dev/null differ diff --git a/docs/media/Matrix/magic.png b/docs/media/Matrix/magic.png deleted file mode 100644 index e9bb8d34..00000000 Binary files a/docs/media/Matrix/magic.png and /dev/null differ diff --git a/docs/media/Matrix/multiply.png b/docs/media/Matrix/multiply.png deleted file mode 100644 index a53612e5..00000000 Binary files a/docs/media/Matrix/multiply.png and /dev/null differ diff --git a/docs/media/Matrix/rank.png b/docs/media/Matrix/rank.png deleted file mode 100644 index 2fbad683..00000000 Binary files a/docs/media/Matrix/rank.png and /dev/null differ diff --git a/docs/media/Matrix/rowAdd.png b/docs/media/Matrix/rowAdd.png deleted file mode 100644 index d5f4fec2..00000000 Binary files a/docs/media/Matrix/rowAdd.png and /dev/null differ diff --git a/docs/media/Matrix/solve.png b/docs/media/Matrix/solve.png deleted file mode 100644 index 6bf544f3..00000000 Binary files a/docs/media/Matrix/solve.png and /dev/null differ diff --git a/docs/media/Matrix/square.png b/docs/media/Matrix/square.png deleted file mode 100644 index 1c19e507..00000000 Binary files a/docs/media/Matrix/square.png and /dev/null differ diff --git a/docs/media/Matrix/swap.png b/docs/media/Matrix/swap.png deleted file mode 100644 index 490ee05f..00000000 Binary files a/docs/media/Matrix/swap.png and /dev/null differ diff --git a/docs/media/Matrix/toArray.png b/docs/media/Matrix/toArray.png deleted file mode 100644 index af963162..00000000 Binary files a/docs/media/Matrix/toArray.png and /dev/null differ diff --git a/docs/media/Matrix/toString.png b/docs/media/Matrix/toString.png deleted file mode 100644 index fec1bd0e..00000000 Binary files a/docs/media/Matrix/toString.png and /dev/null differ diff --git a/docs/media/Matrix/trace.png b/docs/media/Matrix/trace.png deleted file mode 100644 index 123a24c2..00000000 Binary files a/docs/media/Matrix/trace.png and /dev/null differ diff --git a/docs/media/Matrix/transpose.png b/docs/media/Matrix/transpose.png deleted file mode 100644 index 1d43653e..00000000 Binary files a/docs/media/Matrix/transpose.png and /dev/null differ diff --git a/docs/media/NDArray/abs.png b/docs/media/NDArray/abs.png deleted file mode 100644 index dc028fbd..00000000 Binary files a/docs/media/NDArray/abs.png and /dev/null differ diff --git a/docs/media/NDArray/acos.png b/docs/media/NDArray/acos.png deleted file mode 100644 index 30206ebb..00000000 Binary files a/docs/media/NDArray/acos.png and /dev/null differ diff --git a/docs/media/NDArray/acosh.png b/docs/media/NDArray/acosh.png deleted file mode 100644 index 6733e951..00000000 Binary files a/docs/media/NDArray/acosh.png and /dev/null differ diff --git a/docs/media/NDArray/add.png b/docs/media/NDArray/add.png deleted file mode 100644 index 1b7b27cb..00000000 Binary files a/docs/media/NDArray/add.png and /dev/null differ diff --git a/docs/media/NDArray/asin.png b/docs/media/NDArray/asin.png deleted file mode 100644 index 983f8792..00000000 Binary files a/docs/media/NDArray/asin.png and /dev/null differ diff --git a/docs/media/NDArray/asinh.png b/docs/media/NDArray/asinh.png deleted file mode 100644 index 44308ed0..00000000 Binary files a/docs/media/NDArray/asinh.png and /dev/null differ diff --git a/docs/media/NDArray/atan.png b/docs/media/NDArray/atan.png deleted file mode 100644 index 68660f32..00000000 Binary files a/docs/media/NDArray/atan.png and /dev/null differ diff --git a/docs/media/NDArray/atanh.png b/docs/media/NDArray/atanh.png deleted file mode 100644 index bb4f0206..00000000 Binary files a/docs/media/NDArray/atanh.png and /dev/null differ diff --git a/docs/media/NDArray/binOp.png b/docs/media/NDArray/binOp.png deleted file mode 100644 index 5a628ce7..00000000 Binary files a/docs/media/NDArray/binOp.png and /dev/null differ diff --git a/docs/media/NDArray/cbrt.png b/docs/media/NDArray/cbrt.png deleted file mode 100644 index 5603e5d1..00000000 Binary files a/docs/media/NDArray/cbrt.png and /dev/null differ diff --git a/docs/media/NDArray/ceil.png b/docs/media/NDArray/ceil.png deleted file mode 100644 index d9efe90b..00000000 Binary files a/docs/media/NDArray/ceil.png and /dev/null differ diff --git a/docs/media/NDArray/check.png b/docs/media/NDArray/check.png deleted file mode 100644 index 0c64dfd0..00000000 Binary files a/docs/media/NDArray/check.png and /dev/null differ diff --git a/docs/media/NDArray/copy.png b/docs/media/NDArray/copy.png deleted file mode 100644 index 46d35687..00000000 Binary files a/docs/media/NDArray/copy.png and /dev/null differ diff --git a/docs/media/NDArray/cos.png b/docs/media/NDArray/cos.png deleted file mode 100644 index fb54f480..00000000 Binary files a/docs/media/NDArray/cos.png and /dev/null differ diff --git a/docs/media/NDArray/cosh.png b/docs/media/NDArray/cosh.png deleted file mode 100644 index 74548c52..00000000 Binary files a/docs/media/NDArray/cosh.png and /dev/null differ diff --git a/docs/media/NDArray/dot.png b/docs/media/NDArray/dot.png deleted file mode 100644 index cac29d7b..00000000 Binary files a/docs/media/NDArray/dot.png and /dev/null differ diff --git a/docs/media/NDArray/each.png b/docs/media/NDArray/each.png deleted file mode 100644 index 5b1bd068..00000000 Binary files a/docs/media/NDArray/each.png and /dev/null differ diff --git a/docs/media/NDArray/equals.png b/docs/media/NDArray/equals.png deleted file mode 100644 index 69fae95b..00000000 Binary files a/docs/media/NDArray/equals.png and /dev/null differ diff --git a/docs/media/NDArray/equidimensional.png b/docs/media/NDArray/equidimensional.png deleted file mode 100644 index 7f275398..00000000 Binary files a/docs/media/NDArray/equidimensional.png and /dev/null differ diff --git a/docs/media/NDArray/equilateral.png b/docs/media/NDArray/equilateral.png deleted file mode 100644 index 17ef8636..00000000 Binary files a/docs/media/NDArray/equilateral.png and /dev/null differ diff --git a/docs/media/NDArray/exp.png b/docs/media/NDArray/exp.png deleted file mode 100644 index b496ebee..00000000 Binary files a/docs/media/NDArray/exp.png and /dev/null differ diff --git a/docs/media/NDArray/expm1.png b/docs/media/NDArray/expm1.png deleted file mode 100644 index f2321387..00000000 Binary files a/docs/media/NDArray/expm1.png and /dev/null differ diff --git a/docs/media/NDArray/eye.png b/docs/media/NDArray/eye.png deleted file mode 100644 index ec1261d7..00000000 Binary files a/docs/media/NDArray/eye.png and /dev/null differ diff --git a/docs/media/NDArray/fill.png b/docs/media/NDArray/fill.png deleted file mode 100644 index 97cf541e..00000000 Binary files a/docs/media/NDArray/fill.png and /dev/null differ diff --git a/docs/media/NDArray/floor.png b/docs/media/NDArray/floor.png deleted file mode 100644 index 46911c86..00000000 Binary files a/docs/media/NDArray/floor.png and /dev/null differ diff --git a/docs/media/NDArray/fround.png b/docs/media/NDArray/fround.png deleted file mode 100644 index 2d0fb188..00000000 Binary files a/docs/media/NDArray/fround.png and /dev/null differ diff --git a/docs/media/NDArray/get.png b/docs/media/NDArray/get.png deleted file mode 100644 index 46e63fe0..00000000 Binary files a/docs/media/NDArray/get.png and /dev/null differ diff --git a/docs/media/NDArray/log.png b/docs/media/NDArray/log.png deleted file mode 100644 index 749a7d40..00000000 Binary files a/docs/media/NDArray/log.png and /dev/null differ diff --git a/docs/media/NDArray/log10.png b/docs/media/NDArray/log10.png deleted file mode 100644 index 4338deb7..00000000 Binary files a/docs/media/NDArray/log10.png and /dev/null differ diff --git a/docs/media/NDArray/log1p.png b/docs/media/NDArray/log1p.png deleted file mode 100644 index 17385b20..00000000 Binary files a/docs/media/NDArray/log1p.png and /dev/null differ diff --git a/docs/media/NDArray/log2.png b/docs/media/NDArray/log2.png deleted file mode 100644 index e379a791..00000000 Binary files a/docs/media/NDArray/log2.png and /dev/null differ diff --git a/docs/media/NDArray/map.png b/docs/media/NDArray/map.png deleted file mode 100644 index eefdaa7f..00000000 Binary files a/docs/media/NDArray/map.png and /dev/null differ diff --git a/docs/media/NDArray/max.png b/docs/media/NDArray/max.png deleted file mode 100644 index a8a77fc0..00000000 Binary files a/docs/media/NDArray/max.png and /dev/null differ diff --git a/docs/media/NDArray/min.png b/docs/media/NDArray/min.png deleted file mode 100644 index 35e77a67..00000000 Binary files a/docs/media/NDArray/min.png and /dev/null differ diff --git a/docs/media/NDArray/norm.png b/docs/media/NDArray/norm.png deleted file mode 100644 index 75f95996..00000000 Binary files a/docs/media/NDArray/norm.png and /dev/null differ diff --git a/docs/media/NDArray/ones.png b/docs/media/NDArray/ones.png deleted file mode 100644 index d43a2fd6..00000000 Binary files a/docs/media/NDArray/ones.png and /dev/null differ diff --git a/docs/media/NDArray/pow.png b/docs/media/NDArray/pow.png deleted file mode 100644 index 3d19e950..00000000 Binary files a/docs/media/NDArray/pow.png and /dev/null differ diff --git a/docs/media/NDArray/product.png b/docs/media/NDArray/product.png deleted file mode 100644 index 6d0bf003..00000000 Binary files a/docs/media/NDArray/product.png and /dev/null differ diff --git a/docs/media/NDArray/random.png b/docs/media/NDArray/random.png deleted file mode 100644 index 8218fccf..00000000 Binary files a/docs/media/NDArray/random.png and /dev/null differ diff --git a/docs/media/NDArray/range.png b/docs/media/NDArray/range.png deleted file mode 100644 index dc302060..00000000 Binary files a/docs/media/NDArray/range.png and /dev/null differ diff --git a/docs/media/NDArray/reduce.png b/docs/media/NDArray/reduce.png deleted file mode 100644 index 2264b5cf..00000000 Binary files a/docs/media/NDArray/reduce.png and /dev/null differ diff --git a/docs/media/NDArray/reshape.png b/docs/media/NDArray/reshape.png deleted file mode 100644 index 3b99e5f1..00000000 Binary files a/docs/media/NDArray/reshape.png and /dev/null differ diff --git a/docs/media/NDArray/round.png b/docs/media/NDArray/round.png deleted file mode 100644 index c87dd37a..00000000 Binary files a/docs/media/NDArray/round.png and /dev/null differ diff --git a/docs/media/NDArray/scale.png b/docs/media/NDArray/scale.png deleted file mode 100644 index 3be8c146..00000000 Binary files a/docs/media/NDArray/scale.png and /dev/null differ diff --git a/docs/media/NDArray/set.png b/docs/media/NDArray/set.png deleted file mode 100644 index 676c7bff..00000000 Binary files a/docs/media/NDArray/set.png and /dev/null differ diff --git a/docs/media/NDArray/sign.png b/docs/media/NDArray/sign.png deleted file mode 100644 index 43b703dc..00000000 Binary files a/docs/media/NDArray/sign.png and /dev/null differ diff --git a/docs/media/NDArray/sin.png b/docs/media/NDArray/sin.png deleted file mode 100644 index 93732abf..00000000 Binary files a/docs/media/NDArray/sin.png and /dev/null differ diff --git a/docs/media/NDArray/sinh.png b/docs/media/NDArray/sinh.png deleted file mode 100644 index 391a68a0..00000000 Binary files a/docs/media/NDArray/sinh.png and /dev/null differ diff --git a/docs/media/NDArray/sqrt.png b/docs/media/NDArray/sqrt.png deleted file mode 100644 index 72a528f5..00000000 Binary files a/docs/media/NDArray/sqrt.png and /dev/null differ diff --git a/docs/media/NDArray/subtract.png b/docs/media/NDArray/subtract.png deleted file mode 100644 index ded17c17..00000000 Binary files a/docs/media/NDArray/subtract.png and /dev/null differ diff --git a/docs/media/NDArray/tan.png b/docs/media/NDArray/tan.png deleted file mode 100644 index a9042bc9..00000000 Binary files a/docs/media/NDArray/tan.png and /dev/null differ diff --git a/docs/media/NDArray/tanh.png b/docs/media/NDArray/tanh.png deleted file mode 100644 index 3e2ecefb..00000000 Binary files a/docs/media/NDArray/tanh.png and /dev/null differ diff --git a/docs/media/NDArray/trunc.png b/docs/media/NDArray/trunc.png deleted file mode 100644 index b88f4dcf..00000000 Binary files a/docs/media/NDArray/trunc.png and /dev/null differ diff --git a/docs/media/NDArray/zeros.png b/docs/media/NDArray/zeros.png deleted file mode 100644 index 2fb1768d..00000000 Binary files a/docs/media/NDArray/zeros.png and /dev/null differ diff --git a/docs/media/Vector/angle.png b/docs/media/Vector/angle.png deleted file mode 100644 index da0ed715..00000000 Binary files a/docs/media/Vector/angle.png and /dev/null differ diff --git a/docs/media/Vector/combine.png b/docs/media/Vector/combine.png deleted file mode 100644 index faae9f95..00000000 Binary files a/docs/media/Vector/combine.png and /dev/null differ diff --git a/docs/media/Vector/cross.png b/docs/media/Vector/cross.png deleted file mode 100644 index e1c58a1b..00000000 Binary files a/docs/media/Vector/cross.png and /dev/null differ diff --git a/docs/media/Vector/normalize.png b/docs/media/Vector/normalize.png deleted file mode 100644 index 70629472..00000000 Binary files a/docs/media/Vector/normalize.png and /dev/null differ diff --git a/docs/media/Vector/project.png b/docs/media/Vector/project.png deleted file mode 100644 index 23fef396..00000000 Binary files a/docs/media/Vector/project.png and /dev/null differ diff --git a/docs/media/Vector/push.png b/docs/media/Vector/push.png deleted file mode 100644 index 852dfafd..00000000 Binary files a/docs/media/Vector/push.png and /dev/null differ diff --git a/docs/media/Vector/toArray.png b/docs/media/Vector/toArray.png deleted file mode 100644 index 0c6c1ad2..00000000 Binary files a/docs/media/Vector/toArray.png and /dev/null differ diff --git a/docs/media/Vector/toString.png b/docs/media/Vector/toString.png deleted file mode 100644 index 5c069059..00000000 Binary files a/docs/media/Vector/toString.png and /dev/null differ diff --git a/src/Matrix/diagonal.ts b/src/Matrix/diagonal.ts index 29f041ec..f7c7305a 100644 --- a/src/Matrix/diagonal.ts +++ b/src/Matrix/diagonal.ts @@ -9,5 +9,5 @@ Matrix.prototype.diagonal = function(this: T): T { const [r, c] = this.shape; const l2: number = Math.min(r, c); - return this.reshape([l1]).slice(0, l1, l2 + 1); + return this.reshape(l1).slice(0, l1, l2 + 1); }; diff --git a/src/Matrix/index.ts b/src/Matrix/index.ts index e847ed51..a3dfa8f1 100644 --- a/src/Matrix/index.ts +++ b/src/Matrix/index.ts @@ -4,235 +4,198 @@ import { TypedArrayConstructor } from '../types'; export class Matrix extends NDArray { /** * Augments `x` and `y`. - * ![](media://Matrix/augment.png) */ public static augment: (x: T, y: T) => T; /** * Gets the determinant of `x`. - * ![](media://Matrix/det.png) */ public static det: (x: T) => number; /** * Gets the diagonal of `x`. - * ![](media://Matrix/diagonal.png) */ public static diagonal: (x: T) => T; /** * Gets eigenvalues and eigenvectors of `x` using the Jacobi method. * Accelerated with LAPACK `?geev`. - * ![](media://Matrix/eig.png) */ public static eig: (x: T) => [T, T]; /** * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of `x`. - * ![](media://Matrix/gauss.png) */ public static gauss: (x: T) => T; /** * Determines the inverse of `x`. * Accelerated with LAPACK `?getri`. - * ![](media://Matrix/inv.png) */ public static inv: (x: T) => T; /** * Performs full LU decomposition on `x`. * Accelerated with LAPACK `?getrf`. - * ![](media://Matrix/lu.png) */ public static lu: (x: T) => [T, T, Int32Array]; /** * Performs LU factorization on `x`. * Accelerated with LAPACK `?getrf`. - * ![](media://Matrix/lu_factor.png) */ public static lu_factor: (x: T) => [T, Int32Array]; /** * Creates a magic square matrix of `size` - * ![](media://Matrix/magic.png) */ public static magic: (size: number, type?: TypedArrayConstructor) => T; /** * Multiplies two matrices `x` and `y` of matching dimensions. * Accelerated with BLAS `?gemm`. - * ![](media://Matrix/multiply.png) */ public static multiply: (x: T, y: T) => T; /** * Finds the rank of `x` using gaussian elimination. - * ![](media://Matrix/rank.png) */ public static rank: (x: T) => number; /** * Adds a multiple of one row multiplied by `scalar` to another inside `x`. - * ![](media://Matrix/rowAdd.png) */ public static rowAdd: (x: T, dest: number, source: number, scalar?: number) => T; /** * Solves the equation AX = B (where A is `x` and B is `y`). * Accelerated with LAPACK `?gesv`. - * ![](media://Matrix/solve.png) */ public static solve: (x: T, y: T) => T; /** * Asserts if `x` is square. - * ![](media://Matrix/square.png) */ public static square: (x: T) => void; /** * Swaps two rows `i` and `j` in `x`. - * ![](media://Matrix/swap.png) */ public static swap: (x: T, i: number, j: number) => T; /** * Converts current matrix into a two-dimensional array - * ![](media://Matrix/toArray.png) */ public static toArray: (x: T) => number[][]; /** * Converts `x` into a readable formatted string - * ![](media://Matrix/toString.png) */ public static toString: (x: T) => string; /** * Gets the trace of `x` (the sum of all diagonal elements). - * ![](media://Matrix/trace.png) */ public static trace: (x: T) => number; /** * Transposes `x` (mirror across the diagonal). - * ![](media://Matrix/transpose.png) */ public static transpose: (x: T) => T; /** * Augments `x` with current matrix. - * ![](media://Matrix/augment.png) */ public augment!: (x: T) => this; /** * Gets the determinant of current matrix using LU factorization. - * ![](media://Matrix/det.png) */ public det!: () => number; /** * Gets the diagonal of current matrix. - * ![](media://Matrix/diagonal.png) */ public diagonal!: () => this; /** * Gets eigenvalues and eigenvectors of the current matrix using the Jacobi method. * Accelerated with LAPACK `?geev`. - * ![](media://Matrix/eig.png) */ public eig!: () => [T, T]; /** * Gauss-Jordan elimination (i.e. returns the reduced row echelon form) of current matrix. - * ![](media://Matrix/gauss.png) */ public gauss!: () => this; /** * Determines the inverse of current matrix using Gaussian elimination. * Accelerated with LAPACK `?getri`. - * ![](media://Matrix/inv.png) */ public inv!: () => this; /** * Performs full LU decomposition on current matrix. * Accelerated with LAPACK `?getrf`. - * ![](media://Matrix/lu.png) */ public lu!: () => [T, T, Int32Array]; /** * Performs LU factorization on current matrix. * Accelerated with LAPACK `?getrf`. - * ![](media://Matrix/lu_factor.png) */ public lu_factor!: () => [this, Int32Array]; /** * Multiplies current matrix with `x`. * Accelerated with BLAS `?gemm`. - * ![](media://Matrix/multiply.png) */ public multiply!: (x: T) => this; /** * Finds the rank of current matrix using gaussian elimination. - * ![](media://Matrix/rank.png) */ public rank!: () => number; /** * Adds a multiple of one row multiplied by `scalar` to another inside current matrix. - * ![](media://Matrix/rowAdd.png) */ public rowAdd!: (dest: number, source: number, scalar?: number) => this; /** * Solves the equation AX = B (where A is current matrix and B is `x`). * Accelerated with LAPACK `?gesv`. - * ![](media://Matrix/solve.png) */ public solve!: (x: T) => this; /** * Asserts if current matrix is square. - * ![](media://Matrix/square.png) */ public square!: () => void; /** * Swaps two rows `i` and `j` in current matrix - * ![](media://Matrix/swap.png) */ public swap!: (i: number, j: number) => this; /** * Converts current matrix into a two-dimensional array - * ![](media://Matrix/toArray.png) */ public toArray!: () => number[][]; /** * Converts current matrix into a readable formatted string. - * ![](media://Matrix/toString.png) */ public toString!: () => string; /** * Gets the trace of the matrix (the sum of all diagonal elements). - * ![](media://Matrix/trace.png) */ public trace!: () => number; /** * Transposes current matrix (mirror across the diagonal). - * ![](media://Matrix/transpose.png) */ public transpose!: () => this; @@ -258,9 +221,9 @@ export class Matrix extends NDArray { import './augment'; import './det'; import './diagonal'; +import './eig'; import './gauss'; import './inv'; -import './eig'; import './lu'; import './lu_factor'; import './magic'; diff --git a/src/Matrix/transpose.ts b/src/Matrix/transpose.ts index 3f91f721..890aa5c9 100644 --- a/src/Matrix/transpose.ts +++ b/src/Matrix/transpose.ts @@ -16,5 +16,5 @@ Matrix.prototype.transpose = function(this: T): T { } } - return this.reshape([c, r]); + return this.reshape(c, r); }; diff --git a/src/NDArray/index.ts b/src/NDArray/index.ts index 56a151e9..c203f3ec 100644 --- a/src/NDArray/index.ts +++ b/src/NDArray/index.ts @@ -14,240 +14,201 @@ import { export class NDArray implements INDArray { /** * Returns the absolute value of each element of `x`. - * ![](media://NDArray/abs.png) */ public static abs: (x: T) => T; /** * Returns the arccosine of each element of `x`. - * ![](media://NDArray/acos.png) */ public static acos: (x: T) => T; /** * Returns the hyperbolic arccosine of each element of `x`. - * ![](media://NDArray/acosh.png) */ public static acosh: (x: T) => T; /** * Adds `y` multiplied by `alpha` to `x`. * Accelerated with BLAS `?axpy`. - * ![](media://NDArray/add.png) */ public static add: (x: T, y: T, alpha?: number) => T; /** * Returns the arcsine of each element of `x`. - * ![](media://NDArray/asin.png) */ public static asin: (x: T) => T; /** * Returns the hyperbolic arcsine of each element of `x`. - * ![](media://NDArray/asinh.png) */ public static asinh: (x: T) => T; /** * Returns the arctangent of each element of `x`. - * ![](media://NDArray/atan.png) */ public static atan: (x: T) => T; /** * Returns the hyperbolic arctangent of each element of `x`. - * ![](media://NDArray/atanh.png) */ public static atanh: (x: T) => T; /** * Perform binary operation `f` on `y` in `x`. - * ![](media://NDArray/binOp.png) */ public static binOp: (x: T, y: T, f: (a: number, b: number, index: number) => number) => T; /** * Returns the cube root of each element of `x`. - * ![](media://NDArray/cbrt.png) */ public static cbrt: (x: T) => T; /** * Returns smallest integer greater than or equal to of each element of `x`. - * ![](media://NDArray/ceil.png) */ public static ceil: (x: T) => T; /** * Asserts if indices `i, j, ..., n` are within the bounds of `x` - * ![](media://NDArray/check.png) */ public static check: (x: T, ...indices: number[]) => void; /** * Makes a copy of `x` - * ![](media://NDArray/copy.png) */ public static copy: (x: T) => T; /** * Returns the cosine of each element of `x`. - * ![](media://NDArray/cos.png) */ public static cos: (x: T) => T; /** * Returns the hyperbolic cosine of each element of `x`. - * ![](media://NDArray/cosh.png) */ public static cosh: (x: T) => T; /** * Performs dot multiplication with `x` and `y`. * Accelerated with BLAS `?dot`. - * ![](media://NDArray/dot.png) */ public static dot: (x: T, y: T) => number; /** * Equivalent to `TypedArray.prototype.forEach`. - * ![](media://NDArray/each.png) */ public static each: (x: T, f: (value: number, i: number, src: TypedArray) => void) => T; /** * Checks if `x` and `y` are equal. - * ![](media://NDArray/equals.png) */ public static equals: (x: T, y: T) => boolean; /** * Asserts if `x` and `y` have the same shape - * ![](media://NDArray/equidimensional.png) */ public static equidimensional: (x: T, y: T) => void; /** * Asserts if `x` and `y` have the same length - * ![](media://NDArray/equilateral.png) */ public static equilateral: (x: T, y: T) => void; /** * 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. - * ![](media://NDArray/exp.png) */ public static exp: (x: T) => T; /** * Returns subtracting 1 from exp(x) of each element of `x`. - * ![](media://NDArray/expm1.png) */ public static expm1: (x: T) => T; /** * Creates an identity matrix of size `n` and type `type`. - * ![](media://NDArray/eye.png) */ public static eye: (n: number) => T; /** * Fills `x` with a scalar value - * ![](media://NDArray/fill.png) */ public static fill: (x: T, value: number | ((index: number) => number)) => T; /** * Returns the largest integer less than or equal to a number of each element of `x`. - * ![](media://NDArray/floor.png) */ public static floor: (x: T) => T; /** * Returns the nearest single precision float representation of each element of `x`. - * ![](media://NDArray/fround.png) */ public static fround: (x: T) => T; /** * Gets the element at `i, j, ..., n` from `x` - * ![](media://NDArray/get.png) */ public static get: (x: T, ...indices: number[]) => number; /** * Returns the natural logarithm (log_e, also ln) of each element of `x`. - * ![](media://NDArray/log.png) */ public static log: (x: T) => T; /** * Returns the natural logarithm (log_e, also ln) of 1 + x for each element of `x`. - * ![](media://NDArray/log10.png) */ public static log10: (x: T) => T; /** * Returns the base 2 logarithm of each element of `x`. - * ![](media://NDArray/log1p.png) */ public static log1p: (x: T) => T; /** * Returns the base 10 logarithm of each element of `x`. - * ![](media://NDArray/log2.png) */ public static log2: (x: T) => T; /** * Equivalent to `TypedArray.prototype.map`. - * ![](media://NDArray/map.png) */ public static map: (x: T, f: (value: number, i: number, src: TypedArray) => number) => T; /** * Gets the maximum value (largest) element of `x`. * Accelerated with BLAS `i?amax`. - * ![](media://NDArray/max.png) */ public static max: (x: T) => number; /** * Gets the minimum value (smallest) element of `x`. - * ![](media://NDArray/min.png) */ public static min: (x: T) => number; /** * Calculates the norm of current array (also called L2 norm or Euclidean length). * Accelerated with BLAS `?nrm2`. - * ![](media://NDArray/norm.png) */ public static norm: (x: T) => number; /** * Creates an array containing ones (`1`) of shape `shape` - * ![](media://NDArray/ones.png) */ public static ones: (...shape: number[]) => T; /** * Returns each element of `x` to the exponent power, that is, element^exponent. - * ![](media://NDArray/pow.png) */ public static pow: (x: T, exponent: number) => T; /** * Hadamard product of `x` and `y` - * ![](media://NDArray/product.png) */ public static product: (x: T, y: T) => T; /** * Creates a vector containing random samples from a uniform distribution over `[0, 1)` of shape `shape` - * ![](media://NDArray/random.png) */ public static random: (...shape: number[]) => T; @@ -256,13 +217,11 @@ export class NDArray implements INDArray { * 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`) - * ![](media://NDArray/range.png) */ public static range: (...args: number[]) => T; /** * Equivalent to `TypedArray.prototype.reduce`. - * ![](media://NDArray/reduce.png) */ public static reduce: ( x: NDArray, @@ -272,179 +231,150 @@ export class NDArray implements INDArray { /** * Reshapes `x` - * ![](media://NDArray/reshape.png) */ - public static reshape: (x: T, s: number[]) => T; + public static reshape: (x: T, ...shape: number[]) => T; /** * Returns the value of each element of `x` rounded to the nearest integer. - * ![](media://NDArray/round.png) */ public static round: (x: T) => T; /** * Multiplies all elements of `x` with a specified `scalar`. * Accelerated with BLAS `?scal`. - * ![](media://NDArray/scale.png) */ public static scale: (x: T, scalar: number) => T; /** * Sets the element at `i, j, ..., n` to `value`. - * ![](media://NDArray/set.png) */ public static set: (x: T, ...args: number[]) => void; /** * Returns the sign of each element of `x`, indicating * whether it is positive, negative or zero. - * ![](media://NDArray/sign.png) */ public static sign: (x: T) => T; /** * Returns the sine of each element of `x`. - * ![](media://NDArray/sin.png) */ public static sin: (x: T) => T; /** * Returns the hyperbolic sine of each element of `x`. - * ![](media://NDArray/sinh.png) */ public static sinh: (x: T) => T; /** * Slices `x` in the corresponding dimension - * ![](media://NDArray/slice.png) */ public static slice: (x: T, start?: number, step?: number, end?: number) => T; /** * Returns the positive square root of each element of `x`. - * ![](media://NDArray/sqrt.png) */ public static sqrt: (x: T) => T; /** * Subtracts `y` from `x`. - * ![](media://NDArray/subtract.png) */ public static subtract: (x: T, y: T) => T; /** * Returns the tangent of each element of `x`. - * ![](media://NDArray/tan.png) */ public static tan: (x: T) => T; /** * Returns the hyperbolic tangent of each element of `x`. - * ![](media://NDArray/tanh.png) */ public static tanh: (x: T) => T; /** * Returns the integer part of each element of `x`, * removing any fractional digits. - * ![](media://NDArray/trunc.png) */ public static trunc: (x: T) => T; /** * Creates an array containing zeros (`0`) of shape `shape` - * ![](media://NDArray/zeros.png) */ public static zeros: (...shape: number[]) => T; /** * Returns the absolute value of each element of current array. - * ![](media://NDArray/abs.png) */ public abs!: () => this; /** * Returns the arccosine of each element of current array. - * ![](media://NDArray/acos.png) */ public acos!: () => this; /** * Returns the hyperbolic arccosine of each element of current array. - * ![](media://NDArray/acosh.png) */ public acosh!: () => this; /** * Adds `x` multiplied by `alpha` to the current array. * Accelerated with BLAS `?axpy`. - * ![](media://NDArray/add.png) */ public add!: (y: NDArray, alpha?: number) => this; /** * Returns the arcsine of each element of current array. - * ![](media://NDArray/asin.png) */ public asin!: () => this; /** * Returns the hyperbolic arcsine of each element of current array. - * ![](media://NDArray/asinh.png) */ public asinh!: () => this; /** * Returns the arctangent of each element of current array. - * ![](media://NDArray/atan.png) */ public atan!: () => this; /** * Returns the hyperbolic arctangent of each element of current array. - * ![](media://NDArray/atanh.png) */ public atanh!: () => this; /** * Perform binary operation `f` on `x` in the current array. - * ![](media://NDArray/binOp.png) */ public binOp!: (y: NDArray, f: (a: number, b: number, index: number) => number) => this; /** * Returns the cube root of each element of current array. - * ![](media://NDArray/cbrt.png) */ public cbrt!: () => this; /** * Returns smallest integer greater than or equal to of each element of current array. - * ![](media://NDArray/ceil.png) */ public ceil!: () => this; /** * Asserts if indices `i, j, ..., n` are within the bounds of current array - * ![](media://NDArray/check.png) */ public check!: (...indices: number[]) => void; /** * Makes a copy of the class and underlying data - * ![](media://NDArray/copy.png) */ public copy!: () => this; /** * Returns the cosine of each element of current array. - * ![](media://NDArray/cos.png) */ public cos!: () => this; /** * Returns the hyperbolic cosine of each element of current array. - * ![](media://NDArray/cosh.png) */ public cosh!: () => this; @@ -453,7 +383,6 @@ export class NDArray implements INDArray { /** * Performs dot multiplication with `x` and current array * Accelerated with BLAS `?dot`. - * ![](media://NDArray/dot.png) */ public dot!: (y: NDArray) => number; @@ -461,62 +390,52 @@ export class NDArray implements INDArray { /** * Equivalent to `TypedArray.prototype.forEach`. - * ![](media://NDArray/each.png) */ public each!: (f: (value: number, i: number, src: TypedArray) => void) => this; /** * Checks if current array and `x` are equal. - * ![](media://NDArray/equals.png) */ public equals!: (y: NDArray) => boolean; /** * Asserts if current array and `x` have the same shape - * ![](media://NDArray/equidimensional.png) */ public equidimensional!: (y: NDArray) => void; /** * Asserts if current array and `x` have the same length - * ![](media://NDArray/equilateral.png) */ public equilateral!: (y: NDArray) => void; /** * 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. - * ![](media://NDArray/exp.png) */ public exp!: () => this; /** * Returns subtracting 1 from exp(x) of each element of current array. - * ![](media://NDArray/expm1.png) */ public expm1!: () => this; /** * Fills the current array with a scalar value - * ![](media://NDArray/fill.png) */ public fill!: (value: number | ((index: number) => number)) => this; /** * Returns the largest integer less than or equal to a number of each element of current array. - * ![](media://NDArray/floor.png) */ public floor!: () => this; /** * Returns the nearest single precision float representation of each element of current array. - * ![](media://NDArray/fround.png) */ public fround!: () => this; /** * Gets the element at `i, j, ..., n` from current vector. - * ![](media://NDArray/get.png) */ public get!: (...indices: number[]) => number; @@ -524,68 +443,57 @@ export class NDArray implements INDArray { /** * Returns the natural logarithm (log_e, also ln) of each element of current array. - * ![](media://NDArray/log.png) */ public log!: () => this; /** * Returns the natural logarithm (log_e, also ln) of 1 + x for each element of current array. - * ![](media://NDArray/log10.png) */ public log10!: () => this; /** * Returns the base 2 logarithm of each element of current array. - * ![](media://NDArray/log1p.png) */ public log1p!: () => this; /** * Returns the base 10 logarithm of each element of current array. - * ![](media://NDArray/log2.png) */ public log2!: () => this; /** * Equivalent to `TypedArray.prototype.map`. - * ![](media://NDArray/map.png) */ public map!: (f: (value: number, i: number, src: TypedArray) => number) => this; /** * Gets the maximum value (smallest) element of current array. - * ![](media://NDArray/max.png) */ public max!: () => number; /** * Gets the minimum value (smallest) element of current array. - * ![](media://NDArray/min.png) */ public min!: () => number; /** * Calculates the norm of current array (also called L2 norm or Euclidean length). * Accelerated with BLAS `?nrm2`. - * ![](media://NDArray/norm.png) */ public norm!: () => number; /** * Returns each element of current array to the exponent power, that is, element^exponent. - * ![](media://NDArray/pow.png) */ public pow!: (exponent: number) => this; /** * Hadamard product of current matrix and `x` - * ![](media://NDArray/product.png) */ public product!: (y: NDArray) => this; /** * Equivalent to `TypedArray.prototype.reduce`. - * ![](media://NDArray/reduce.png) */ public reduce!: ( f: (acc: number, value: number, i: number, src: TypedArray) => number, @@ -594,26 +502,22 @@ export class NDArray implements INDArray { /** * Reshapes current array - * ![](media://NDArray/reshape.png) */ - public reshape!: (s: number[]) => this; + public reshape!: (...shape: number[]) => this; /** * Returns the value of each element of current array rounded to the nearest integer. - * ![](media://NDArray/round.png) */ public round!: () => this; /** * Multiplies all elements of current array with a specified `scalar`. * Accelerated with BLAS `?scal`. - * ![](media://NDArray/scale.png) */ public scale!: (scalar: number) => this; /** * Sets the element at `i, j, ..., n` to `value`. - * ![](media://NDArray/set.png) */ public set!: (...args: number[]) => void; @@ -622,57 +526,48 @@ export class NDArray implements INDArray { /** * Returns the sign of each element of current array, indicating * whether it is positive, negative or zero. - * ![](media://NDArray/sign.png) */ public sign!: () => this; /** * Returns the sine of each element of current array. - * ![](media://NDArray/sin.png) */ public sin!: () => this; /** * Returns the hyperbolic sine of each element of current array. - * ![](media://NDArray/sinh.png) */ public sinh!: () => this; /** * Slices the current array in the corresponding dimension - * ![](media://NDArray/slice.png) */ public slice!: (start?: number, step?: number, end?: number) => this; /** * Returns the positive square root of each element of current array. - * ![](media://NDArray/sqrt.png) */ public sqrt!: () => this; /** * Subtracts `x` from the current array. * Accelerated with BLAS `?axpy`. - * ![](media://NDArray/subtract.png) */ public subtract!: (y: NDArray) => this; /** * Returns the tangent of each element of current array. - * ![](media://NDArray/tan.png) */ public tan!: () => this; /** * Returns the hyperbolic tangent of each element of current array. - * ![](media://NDArray/tanh.png) */ public tanh!: () => this; /** * Returns the integer part of each element of current array, * removing any fractional digits. - * ![](media://NDArray/trunc.png) */ public trunc!: () => this; diff --git a/src/NDArray/reshape.bench.ts b/src/NDArray/reshape.bench.ts index e02d0197..49d2e93b 100644 --- a/src/NDArray/reshape.bench.ts +++ b/src/NDArray/reshape.bench.ts @@ -11,9 +11,9 @@ bench( 'reshape', (n: number): [NDArray, number] => [r(n), n], (x: NDArray, n: number): void => { - x.reshape([n]); + x.reshape(n); }, (x: NDArray, n: number): void => { - NDArray.reshape(x, [n]); + NDArray.reshape(x, n); } ); diff --git a/src/NDArray/reshape.spec.ts b/src/NDArray/reshape.spec.ts index 5e7517d6..1c1846c6 100644 --- a/src/NDArray/reshape.spec.ts +++ b/src/NDArray/reshape.spec.ts @@ -10,7 +10,7 @@ describe('(NDArray) reshape', () => { const f32: Float32Array = new Float32Array([1, 2, 3, 4]); const x: NDArray = new NDArray(f32); - throws(() => { x.reshape([1, 2]); }, Error); + throws(() => { x.reshape(1, 2); }, Error); }); it('should be able to create row vector of column vector', () => { @@ -18,7 +18,7 @@ describe('(NDArray) reshape', () => { const x: NDArray = new NDArray(f32, { shape: [1, 4] }); deepStrictEqual(x.shape, [1, 4]); - x.reshape([4, 1]); + x.reshape(4, 1); deepStrictEqual(x.shape, [4, 1]); }); @@ -27,6 +27,6 @@ describe('(NDArray) reshape', () => { const x: NDArray = new NDArray(f32, { shape: [1, 4] }); deepStrictEqual(x.shape, [1, 4]); - deepStrictEqual(NDArray.reshape(x, [4, 1]).shape, [4, 1]); + deepStrictEqual(NDArray.reshape(x, 4, 1).shape, [4, 1]); }); }); diff --git a/src/NDArray/reshape.ts b/src/NDArray/reshape.ts index 7c043904..1f14ccdf 100644 --- a/src/NDArray/reshape.ts +++ b/src/NDArray/reshape.ts @@ -1,8 +1,8 @@ import { NDArray } from './'; -NDArray.reshape = (x: T, shape: number[]): T => x.copy().reshape(shape); +NDArray.reshape = (x: T, ...shape: number[]): T => x.copy().reshape(...shape); -NDArray.prototype.reshape = function(this: T, shape: number[]): T { +NDArray.prototype.reshape = function(this: T, ...shape: number[]): T { const { length } = this; if (shape.reduce((sum: number, dim: number) => sum * dim, 1) !== length) { throw new Error(`shape ${shape} does not match length ${length}`); diff --git a/src/NDArray/slice.ts b/src/NDArray/slice.ts index 29a8c007..39c7705e 100644 --- a/src/NDArray/slice.ts +++ b/src/NDArray/slice.ts @@ -29,7 +29,7 @@ NDArray.prototype.slice = function( this.length = l2; this.data = d2; - this.reshape(s2); + this.reshape(...s2); return this; }; diff --git a/src/Vector/index.ts b/src/Vector/index.ts index eaa316b8..76ba6394 100644 --- a/src/Vector/index.ts +++ b/src/Vector/index.ts @@ -3,13 +3,11 @@ import { NDArray } from '../NDArray'; export class Vector extends NDArray { /** * Determines the angle between the `x` and `y` - * ![](media://Vector/angle.png) */ public static angle: (x: Vector, y: Vector) => number; /** * Combines the vector `x` with `y` - * ![](media://Vector/combine.png) */ public static combine: (x: Vector, y: Vector) => Vector; @@ -18,49 +16,41 @@ export class Vector extends NDArray { * This operation can only calculated for vectors with three components. * Otherwise it throws an exception. * The method returns a new (result) vector. - * ![](media://Vector/cross.png) */ public static cross: (x: Vector, y: Vector) => Vector; /** * Normalizes `x`. - * ![](media://Vector/normalize.png) */ public static normalize: (x: Vector) => Vector; /** * Projects the `y` onto `x` using the projection formula `(y * (x * y / y * y))`. - * ![](media://Vector/project.png) */ public static project: (x: Vector, y: Vector) => Vector; /** * Pushes a new `value` into `x`. - * ![](media://Vector/push.png) */ public static push: (x: Vector, value: number) => Vector; /** * Converts `x` into a JavaScript array. - * ![](media://Vector/toArray.png) */ public static toArray: (x: Vector) => number[]; /** * Converts `x` into a readable formatted string. - * ![](media://Vector/toString.png) */ public static toString: (x: Vector) => string; /** * Determines the angle between the current vector and `x`. - * ![](media://Vector/angle.png) */ public angle!: (x: Vector) => number; /** * Combines the current vector with `x` - * ![](media://Vector/combine.png) */ public combine!: (x: Vector) => this; @@ -69,37 +59,31 @@ export class Vector extends NDArray { * This operation can only be calculated for vectors with three components. * Otherwise it throws an exception. * The method returns a new (result) vector. - * ![](media://Vector/cross.png) */ public cross!: (x: Vector) => this; /** * Normalizes current vector. - * ![](media://Vector/normalize.png) */ public normalize!: () => this; /** * Projects the current vector onto `x` using the projection formula `(y * (x * y / y * y))`. - * ![](media://Vector/project.png) */ public project!: (x: Vector) => this; /** * Pushes a new `value` into current vector. - * ![](media://Vector/push.png) */ public push!: (value: number) => this; /** * Converts current vector into a JavaScript array. - * ![](media://Vector/toArray.png) */ public toArray!: () => number[]; /** * Converts current vector into a readable formatted string. - * ![](media://Vector/toString.png) */ public toString!: () => string; diff --git a/src/bench.ts b/src/bench.ts index 0543d34d..8c689d1e 100644 --- a/src/bench.ts +++ b/src/bench.ts @@ -13,8 +13,8 @@ export const bench: ( setup: (n: number) => any[], ...funcs: Array<(...args: any[]) => void> ): typeof benchmark => { - execSync(`mkdir -p docs/media/${group}`); - const filename: string = `docs/media/${group}/${name}.png`; + execSync(`mkdir -p benchmarks/${group}`); + const filename: string = `benchmarks/${group}/${name}.png`; const xs: number[] = [4, 16, 64, 256, 1024]; let ys: number[] = [];