Function
Static Public Summary | ||
public |
Pointwise Math.abs(x) |
|
public |
Pointwise Math.acos(x) |
|
public |
add(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise add |
|
public |
and(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise and |
|
public |
Pointwise Math.asin(x) |
|
public |
Pointwise Math.atan(x) |
|
public |
atan2(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise Math.atan2(x, y) |
|
public |
band(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise band |
|
public |
Pointwise Math.bnot(x) |
|
public |
Pointwise bor |
|
public |
Pointwise bxor |
|
public |
Pointwise Math.ceil(x) |
|
public |
Pointwise clone(x) |
|
public |
Pointwise Math.cos(x) |
|
public |
Determinant of matix |
|
public |
Create diagonal matrix from vector |
|
public |
Get Array dimensions |
|
public |
div(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise div |
|
public |
dot(x: Array | Number, y: Array | Number): Array | Number |
|
public |
eig(A: any, maxiter: any): * Eigenvalues of real matrices |
|
public |
eq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise eq |
|
public |
Pointwise Math.exp(x) |
|
public |
fft(m: any): * Fast Fourier transform |
|
public |
Pointwise Math.floor(x) |
|
public |
geq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise geq |
|
public |
Extract a block from a matrix |
|
public |
|
|
public |
gt(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise gt |
|
public |
Generate identity matrix of given size |
|
public |
ifft(m: any): * Inverse FFT |
|
public |
Inverse of an matrix |
|
public |
leq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise leq |
|
public |
Generate evenly spaced values |
|
public |
Pointwise Math.log(x) |
|
public |
lshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise lshift |
|
public |
lt(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise lt |
|
public |
mod(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise mod |
|
public |
mul(m1: Number | Array | Complex | Sparse | Object, m2: Number | Array | Complex | Sparse | Object): Number | Array | Complex | Sparse Pointwise mul |
|
public |
Pointwise Math.neg(x) |
|
public |
negtranspose(x: any): * neg transpose |
|
public |
neq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise neq |
|
public |
Square root of the sum of the squares of the entries of x |
|
public |
Pointwise Math.not(x) |
|
public |
nrom2Squared(x: Array | Number): Number Sum of the squares of the entries of x |
|
public |
or(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise or |
|
public |
Create a pointwise function |
|
public |
pointwise2(fun: Function): Function Create a pointwise function of two arguments |
|
public |
pow(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise Math.pow(x, y) |
|
public |
Create an Array of random numbers |
|
public |
reciprocal(): * |
|
public |
Create an Array by duplicating values |
|
public |
Pointwise Math.round(x) |
|
public |
rrshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise rrshift |
|
public |
rshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise rshift |
|
public |
|
|
public |
Set a block of a matrix |
|
public |
Pointwise Math.sin(x) |
|
public |
spPointwise(fun: Function): Function Create pointwise function for sparse matrix operating on none zero arguments |
|
public |
spPointwise2(fun: *): * |
|
public |
Pointwise Math.sqrt(x) |
|
public |
sub(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse Pointwise sub |
|
public |
sup(x: *, s: *, k: *): * |
|
public |
Pointwise Math.tan(x) |
|
public |
Tensor product ret[i][j] = x[i]*y[j] |
|
public |
Matrix transpose |
Static Public
public abs(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import abs from 'mathlab/src/abs.js'
Pointwise Math.abs(x)
Example:
abs(-1) // 1
abs([1, -2]) // [1, 2]
abs([[-1,2],[1,-3]]) // [[1,2],[1,3]]
public acos(m: Number | Array | Sparse): Number | Array | Sparse source
import acos from 'mathlab/src/acos.js'
Pointwise Math.acos(x)
Example:
acos(1) // Math.acos(1)
acos([1, 2]) // [Math.acos(1), Math.acos(2)]
acos([[1,2],[1,3]]) // [ [Math.acos(1), Math.acos(2)], [Math.acos(1), Math.acos(3)] ]
public add(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import add from 'mathlab/src/add.js'
Pointwise add
Example:
add(1, 2) // 3
add([1, 2], [2, 2]) // [3, 4]
add([[2,1], [1,2]], [[2, 2], [2, 2]])) // [ [2 + 2, 1 + 2], [1 + 2, 2 + 2] ]
public and(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import and from 'mathlab/src/and.js'
Pointwise and
Example:
and(1, 0) // 0
and([1, 1], [1, 0]) // [1, 0]
and([[1,1], [1,1]], [[1,0], [0,0]])) // [[1,0], [0,0]]
public asin(m: Number | Array | Sparse): Number | Array | Sparse source
import asin from 'mathlab/src/asin.js'
Pointwise Math.asin(x)
Example:
asin(1) // Math.asin(1)
asin([1, 2]) // [Math.asin(1), Math.asin(2)]
asin([[1,2],[1,3]]) // [ [Math.asin(1), Math.asin(2)], [Math.asin(1), Math.asin(3)] ]
public atan(m: Number | Array | Sparse): Number | Array | Sparse source
import atan from 'mathlab/src/atan.js'
Pointwise Math.atan(x)
Example:
atan(1) // Math.atan(1)
atan([1, 2]) // [Math.atan(1), Math.atan(2)]
atan([[1,2],[1,3]]) // [ [Math.atan(1), Math.atan(2)], [Math.atan(1), Math.atan(3)] ]
public atan2(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import atan2 from 'mathlab/src/atan2.js'
Pointwise Math.atan2(x, y)
Example:
atan2(1, 2) // Math.atan2(1, 2)
atan2([1, 2], [2, 2]) // [Math.atan2(1, 2), Math.atan2(2, 2)]
atan2([[2,1], [1,2]], [[2, 2], [2, 2]])) // [ [Math.atan2(2, 2), Math.atan2(1, 2)], [Math.atan2(1, 2), Math.atan2(2, 2)] ]
public band(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import band from 'mathlab/src/band.js'
Pointwise band
Example:
band(1, 2) // 1 & 2
band([1, 2], [2, 2]) // [1 & 2, 2 & 2]
band([[2,1], [1,2]], [[2, 2], [2, 2]])) // [ [2 & 2, 1 & 2], [1 & 2, 2 & 2] ]
public bnot(m: Number | Array | Sparse): Number | Array | Sparse source
import bnot from 'mathlab/src/bnot.js'
Pointwise Math.bnot(x)
Example:
bnot(1) // ~1
bnot([1, 2]) // [~1, ~2]
bnot([[1,2],[1,3]]) // [[~1,~2],[~1,~3]]
public bor(m1: Number | Array | Sparse, m2: Number | Array | Sparse): Number | Array | Sparse source
import bor from 'mathlab/src/bor.js'
Pointwise bor
Example:
bor(1, 2) // 1 | 2
bor([1, 2], [2, 2]) // [1 | 2, 2 | 2]
bor([[2,1], [1,2]], [[2, 2], [2, 2]])) // [ [2 | 2, 1 | 2], [1 | 2, 2 | 2] ]
public bxor(m1: Number | Array | Sparse, m2: Number | Array | Sparse): Number | Array | Sparse source
import bxor from 'mathlab/src/bxor.js'
Pointwise bxor
Example:
bxor(1, 2) // 1 ^ 2
bxor([1, 2], [2, 2]) // [1 ^ 2, 2 ^ 2]
bxor([[2,1], [1,2]], [[2, 2], [2, 2]])) // [ [2 ^ 2, 1 ^ 2], [1 ^ 2, 2 ^ 2] ]
public ceil(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import ceil from 'mathlab/src/ceil.js'
Pointwise Math.ceil(x)
Example:
ceil(1) // Math.ceil(1)
ceil([1, 2]) // [Math.ceil(1), Math.ceil(2)]
ceil([[1,2],[1,3]]) // [ [Math.ceil(1), Math.ceil(2)], [Math.ceil(1), Math.ceil(3)] ]
public clone(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import clone from 'mathlab/src/clone.js'
Pointwise clone(x)
Example:
clone([[1,2],[1,3]]) // [[1,2],[1,3]]
public cos(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import cos from 'mathlab/src/cos.js'
Pointwise Math.cos(x)
Example:
cos(1)
// returns Math.cos(1)
cos([1, 2])
// returns [Math.cos(1), Math.cos(2)]
cos([[1,2],[1,3]])
// returns [ [Math.cos(1), Math.cos(2)], [Math.cos(1), Math.cos(3)] ]
public det(x: Array): Number source
import det from 'mathlab/src/det.js'
Determinant of matix
Params:
Name | Type | Attribute | Description |
x | Array |
Example:
det([[1, 2], [1, 2]])
// 0
public diag(d: Array): Array source
import diag from 'mathlab/src/diag.js'
Create diagonal matrix from vector
Params:
Name | Type | Attribute | Description |
d | Array |
Example:
diag([1, 2])
// [[1, 0],
// [0, 2]]
public dim(x: Array): Array source
import dim from 'mathlab/src/dim.js'
Get Array dimensions
Params:
Name | Type | Attribute | Description |
x | Array |
Example:
dim([[1, 2, 3], [1, 2, 2]])
// [2, 3]
public div(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import div from 'mathlab/src/div.js'
Pointwise div
Example:
div(1, 2)
// returns 1 / 2
div([1, 2], [2, 2])
// returns [1 / 2, 2 / 2]
div([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 / 2, 1 / 2], [1 / 2, 2 / 2] ]
public dot(x: Array | Number, y: Array | Number): Array | Number source
import dot from 'mathlab/src/dot.js'
Params:
Name | Type | Attribute | Description |
x | Array | Number | ||
y | Array | Number |
Return:
Array | Number |
Example:
dot([[1, 1], [2, 1]], [1, 2])
// [3, 4]
dot([1, 2], 4)
// [4, 8]
public eig(A: any, maxiter: any): * source
import eig from 'mathlab/src/eig.js'
Eigenvalues of real matrices
Params:
Name | Type | Attribute | Description |
A | any | ||
maxiter | any |
Return:
* |
public eq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import eq from 'mathlab/src/eq.js'
Pointwise eq
Example:
eq(1, 2)
// returns 1 === 2
eq([1, 2], [2, 2])
// returns [1 === 2, 2 === 2]
eq([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 === 2, 1 === 2], [1 === 2, 2 === 2] ]
public exp(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import exp from 'mathlab/src/exp.js'
Pointwise Math.exp(x)
Example:
exp(1)
// returns Math.exp(1)
exp([1, 2])
// returns [Math.exp(1), Math.exp(2)]
exp([[1,2],[1,3]])
// returns [ [Math.exp(1), Math.exp(2)], [Math.exp(1), Math.exp(3)] ]
public fft(m: any): * source
import {fft} from 'mathlab/src/fft.js'
Fast Fourier transform
Params:
Name | Type | Attribute | Description |
m | any |
Return:
* |
public floor(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import floor from 'mathlab/src/floor.js'
Pointwise Math.floor(x)
Example:
floor(1)
// returns Math.floor(1)
floor([1, 2])
// returns [Math.floor(1), Math.floor(2)]
floor([[1,2],[1,3]])
// returns [ [Math.floor(1), Math.floor(2)], [Math.floor(1), Math.floor(3)] ]
public geq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import geq from 'mathlab/src/geq.js'
Pointwise geq
Example:
geq(1, 2)
// returns 1 >= 2
geq([1, 2], [2, 2])
// returns [1 >= 2, 2 >= 2]
geq([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 >= 2, 1 >= 2], [1 >= 2, 2 >= 2] ]
public getBlock(x: Array, from: Array, to: Array): Array source
import getBlock from 'mathlab/src/getBlock.js'
Extract a block from a matrix
Example:
getBlock([[1,2,3],
[3,4,5]], [0,0], [1,1])
// [[1, 2],
[3, 4]]
public getDiag(A: Array): Array source
import getDiag from 'mathlab/src/getDiag.js'
Get the diagonal of a matrix
Params:
Name | Type | Attribute | Description |
A | Array |
Example:
getDiag([[1, 3], [0, 2]])
// [1, 2]
public gt(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import gt from 'mathlab/src/gt.js'
Pointwise gt
Example:
gt(1, 2)
// returns 1 > 2
gt([1, 2], [2, 2])
// returns [1 > 2, 2 > 2]
gt([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 > 2, 1 > 2], [1 > 2, 2 > 2] ]
public identity(n: Number): Array source
import identity from 'mathlab/src/identity.js'
Generate identity matrix of given size
Params:
Name | Type | Attribute | Description |
n | Number |
Example:
identity(2)
// [[1, 0], [0, 1]]
public ifft(m: any): * source
import {ifft} from 'mathlab/src/fft.js'
Inverse FFT
Params:
Name | Type | Attribute | Description |
m | any |
Return:
* |
public inv(x: Array): Array source
import inv from 'mathlab/src/inv.js'
Inverse of an matrix
Params:
Name | Type | Attribute | Description |
x | Array |
Example:
inv([[1,2],[3,4]])
// [[ -2, 1],
// [ 1.5, -0.5]]
public leq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import leq from 'mathlab/src/leq.js'
Pointwise leq
Example:
leq(1, 2)
// returns 1 <= 2
leq([1, 2], [2, 2])
// returns [1 <= 2, 2 <= 2]
leq([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 <= 2, 1 <= 2], [1 <= 2, 2 <= 2] ]
public linspace(a: Number, b: Number, n: Number): Array source
import linspace from 'mathlab/src/linspace.js'
Generate evenly spaced values
Example:
linspace(1, 2, 3)
// [1, 1.5, 2]
public log(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import log from 'mathlab/src/log.js'
Pointwise Math.log(x)
Example:
log(1)
// returns Math.log(1)
log([1, 2])
// returns [Math.log(1), Math.log(2)]
log([[1,2],[1,3]])
// returns [ [Math.log(1), Math.log(2)], [Math.log(1), Math.log(3)] ]
public lshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import lshift from 'mathlab/src/lshift.js'
Pointwise lshift
Example:
lshift(1, 2)
// returns 1 << 2
lshift([1, 2], [2, 2])
// returns [1 << 2, 2 << 2]
lshift([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 << 2, 1 << 2], [1 << 2, 2 << 2] ]
public lt(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import lt from 'mathlab/src/lt.js'
Pointwise lt
Example:
lt(1, 2)
// returns 1 < 2
lt([1, 2], [2, 2])
// returns [1 < 2, 2 < 2]
lt([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 < 2, 1 < 2], [1 < 2, 2 < 2] ]
public mod(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import mod from 'mathlab/src/mod.js'
Pointwise mod
Example:
mod(1, 2)
// returns 1 % 2
mod([1, 2], [2, 2])
// returns [1 % 2, 2 % 2]
mod([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 % 2, 1 % 2], [1 % 2, 2 % 2] ]
public mul(m1: Number | Array | Complex | Sparse | Object, m2: Number | Array | Complex | Sparse | Object): Number | Array | Complex | Sparse source
import mul from 'mathlab/src/mul.js'
Pointwise mul
Example:
mul(1, 2)
// returns 1 * 2
mul([1, 2], [2, 2])
// returns [1 * 2, 2 * 2]
mul([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 * 2, 1 * 2], [1 * 2, 2 * 2] ]
public neg(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import neg from 'mathlab/src/neg.js'
Pointwise Math.neg(x)
Example:
neg(1)
// returns Math.neg(1)
neg([1, 2])
// returns [Math.neg(1), Math.neg(2)]
neg([[1,2],[1,3]])
// returns [ [Math.neg(1), Math.neg(2)], [Math.neg(1), Math.neg(3)] ]
public negtranspose(x: any): * source
import negtranspose from 'mathlab/src/negtranspose.js'
neg transpose
Params:
Name | Type | Attribute | Description |
x | any |
Return:
* |
public neq(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import neq from 'mathlab/src/neq.js'
Pointwise neq
Example:
neq(1, 2)
// returns 1 !== 2
neq([1, 2], [2, 2])
// returns [1 !== 2, 2 !== 2]
neq([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 !== 2, 1 !== 2], [1 !== 2, 2 !== 2] ]
public norm2(x: Array | Number): Number source
import norm2 from 'mathlab/src/norm2.js'
Square root of the sum of the squares of the entries of x
Example:
norm2(2)
// 2
norm2([2,2])
// 2.828
public not(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import not from 'mathlab/src/not.js'
Pointwise Math.not(x)
Example:
not(1)
// returns Math.not(1)
not([1, 2])
// returns [Math.not(1), Math.not(2)]
not([[1,2],[1,3]])
// returns [ [Math.not(1), Math.not(2)], [Math.not(1), Math.not(3)] ]
public nrom2Squared(x: Array | Number): Number source
import nrom2Squared from 'mathlab/src/norm2Squared.js'
Sum of the squares of the entries of x
Example:
norm2Squared(2)
// 4
norm2Squared([2,2])
// 8
public or(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import or from 'mathlab/src/or.js'
Pointwise or
Example:
or(1, 2)
// returns 1 || 2
or([1, 2], [2, 2])
// returns [1 || 2, 2 || 2]
or([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 || 2, 1 || 2], [1 || 2, 2 || 2] ]
public pointwise(fun: Function): Function source
import pointwise from 'mathlab/src/pointwise.js'
Create a pointwise function
Params:
Name | Type | Attribute | Description |
fun | Function |
Example:
function _inc (x) {
return x + 1
}
const inc = pointwise(inc)
inc(1) // 2
inc([1, 2]) // [2, 3]
inc([[1, 2], [1, 3]]) // [[2, 3], [2, 4]]
public pointwise2(fun: Function): Function source
import pointwise2 from 'mathlab/src/pointwise2.js'
Create a pointwise function of two arguments
Params:
Name | Type | Attribute | Description |
fun | Function |
Example:
function _add (x, y) {
return x + y
}
const add = pointwise(_add)
add(1, 2) // 3
add([1, 2], [1, 2]) // [2, 4]
add([[1, 2], [1, 2]], [[1, 2], [1, 2]]) //[[2, 4], [2, 4]]
public pow(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import pow from 'mathlab/src/pow.js'
Pointwise Math.pow(x, y)
Example:
pow(1, 2)
// returns Math.pow(1, 2)
pow([1, 2], [2, 2])
// returns [Math.pow(1, 2), Math.pow(2, 2)]
pow([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [Math.pow(2, 2), Math.pow(1, 2)], [Math.pow(1, 2), Math.pow(2, 2)] ]
public random(size: Array): Array source
import random from 'mathlab/src/random.js'
Create an Array of random numbers
Params:
Name | Type | Attribute | Description |
size | Array | of the random matrix |
Example:
random([2, 3])
// [[0.05303,0.1537,0.7280],
[0.3839,0.08818,0.6316]]
public rep(s: Array, v: Array): Array source
import rep from 'mathlab/src/rep.js'
Create an Array by duplicating values
Example:
rep([2,3], 0)
// [[0,0,0],
[0,0,0]]
rep([3], 5)
// [5,5,5]
public round(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import round from 'mathlab/src/round.js'
Pointwise Math.round(x)
Example:
round(1)
// returns Math.round(1)
round([1, 2])
// returns [Math.round(1), Math.round(2)]
round([[1,2],[1,3]])
// returns [ [Math.round(1), Math.round(2)], [Math.round(1), Math.round(3)] ]
public rrshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import rrshift from 'mathlab/src/rrshift.js'
Pointwise rrshift
Example:
rrshift(1, 2)
// returns 1 >>> 2
rrshift([1, 2], [2, 2])
// returns [1 >>> 2, 2 >>> 2]
rrshift([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 >>> 2, 1 >>> 2], [1 >>> 2, 2 >>> 2] ]
public rshift(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import rshift from 'mathlab/src/rshift.js'
Pointwise rshift
Example:
rshift(1, 2)
// returns 1 >> 2
rshift([1, 2], [2, 2])
// returns [1 >> 2, 2 >> 2]
rshift([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 >> 2, 1 >> 2], [1 >> 2, 2 >> 2] ]
public same(x: Array, y: Array): Boolean source
import same from 'mathlab/src/same.js'
x and y are entrywise identical
Example:
same([1,2], [1,2,3]) // false
same([1, 2], [1, 2]) // true
public setBlock(x: Array, from: Array, to: Array, B: Array): Array source
import setBlock from 'mathlab/src/setBlock.js'
Set a block of a matrix
Example:
setBlock([[1,2,3], [3,4,5]], [0,0], [1,1],[[2,2],[2,2]])
// [[2,2,3],[2,2,5]]
public sin(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import sin from 'mathlab/src/sin.js'
Pointwise Math.sin(x)
Example:
sin(1)
// returns Math.sin(1)
sin([1, 2])
// returns [Math.sin(1), Math.sin(2)]
sin([[1,2],[1,3]])
// returns [ [Math.sin(1), Math.sin(2)], [Math.sin(1), Math.sin(3)] ]
public spPointwise(fun: Function): Function source
import spPointwise from 'mathlab/src/spPointwise.js'
Create pointwise function for sparse matrix operating on none zero arguments
Params:
Name | Type | Attribute | Description |
fun | Function |
Example:
function _inc (x) {
return x + 1
}
const inc = spPointwise(_inc)
inc(new Sparse([1,0],[0,0])) // new Sparse([2,0],[0,0])
public spPointwise2(fun: *): * source
import spPointwise2 from 'mathlab/src/spPointwise2.js'
Params:
Name | Type | Attribute | Description |
fun | * |
Return:
* |
public sqrt(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import sqrt from 'mathlab/src/sqrt.js'
Pointwise Math.sqrt(x)
Example:
sqrt(1)
// returns Math.sqrt(1)
sqrt([1, 2])
// returns [Math.sqrt(1), Math.sqrt(2)]
sqrt([[1,2],[1,3]])
// returns [ [Math.sqrt(1), Math.sqrt(2)], [Math.sqrt(1), Math.sqrt(3)] ]
public sub(m1: Number | Array | Complex | Sparse, m2: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import sub from 'mathlab/src/sub.js'
Pointwise sub
Example:
sub(1, 2)
// returns 1 - 2
sub([1, 2], [2, 2])
// returns [1 - 2, 2 - 2]
sub([[2,1], [1,2]], [[2, 2], [2, 2]]))
// returns [ [2 - 2, 1 - 2], [1 - 2, 2 - 2] ]
public sup(x: *, s: *, k: *): * source
import sup from 'mathlab/src/sup.js'
Params:
Name | Type | Attribute | Description |
x | * | ||
s | * | ||
k | * |
Return:
* |
public tan(m: Number | Array | Complex | Sparse): Number | Array | Complex | Sparse source
import tan from 'mathlab/src/tan.js'
Pointwise Math.tan(x)
Example:
tan(1)
// returns Math.tan(1)
tan([1, 2])
// returns [Math.tan(1), Math.tan(2)]
tan([[1,2],[1,3]])
// returns [ [Math.tan(1), Math.tan(2)], [Math.tan(1), Math.tan(3)] ]