Home Reference Source
public class | source

Matrix

Extends:

KonpeitoIntegerKonpeitoFloat → Matrix

Complex matrix class. (immutable)

Static Member Summary

Static Public Members
public static get

E: Matrix: *

E, Napier's constant.

public static get

HALF: Matrix: *

0.5

public static get

0.5 * PI.

public static get

I: Matrix: *

i, j

public static get

LN10: Matrix: *

log_e(10)

public static get

LN2: Matrix: *

log_e(2)

public static get

log_10(e)

public static get

log_2(e)

public static get

-1

public static get

Negative Infinity.

public static get

NaN: Matrix: *

Not a Number.

public static get

ONE: Matrix: *

1

public static get

PI: Matrix: *

PI.

public static get

Positive infinity.

public static get

0.25 * PI.

public static get

sqrt(0.5)

public static get

sqrt(2)

public static get

TEN: Matrix: *

10

public static get

TWO: Matrix: *

2

public static get

2 * PI.

public static get

ZERO: Matrix: *

0

Static Method Summary

Static Public Methods
public static

Create row vector with specified initial value, step value, end condition.

public static

Create an entity object of this class.

public static

createMatrixDoEachCalculation(eachfunc: function(prm1: number, prm2: number): ?Object, dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix

Create Matrix with specified initialization for each element in matrix.

public static

eye(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix

Return identity matrix.

public static

Hamming window.

public static

hann(size: KMatrixInputData, periodic: string | number): Matrix

Hann (Hanning) window.

public static

memset(number: KMatrixInputData, dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix

Creates a matrix composed of the specified number.

public static

ones(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix

Create a matrix of all ones.

public static

rand(dimension: KMatrixInputData, column_length: KMatrixInputData, random: Random): Matrix

Generate a matrix composed of random values [0, 1) with uniform random numbers.

public static

randn(dimension: KMatrixInputData, column_length: KMatrixInputData, random: Random): Matrix

Generate a matrix composed of random values with normal distribution.

public static

Convert number to Matrix type.

public static

window(name: string, size: KMatrixInputData, periodic: string | number): Matrix

Create window function for signal processing.

public static

zeros(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix

Create zero matrix.

Constructor Summary

Public Constructor
public

Create a complex matrix.

Member Summary

Public Members
public get

Boolean value of the first element of the matrix.

public get

Real value of first element of the matrix.

public get

Number of rows in matrix.

public get

Integer value of the first element of the matrix.

public get

Maximum size of rows or columns in the matrix.

public get

1-norm.

public get

2-norm.

public get

First element of this matrix.

public get

Number of columns in the matrix.

Method Summary

Public Methods
public

T(): Matrix

Hermitian transpose.

public

abs(): Matrix

Absolute value.

public

Arc cosine function.

public

Inverse hyperbolic cosine function.

public

Inverse cotangent function.

public

Inverse hyperbolic cotangent function.

public

Inverse cosecant function.

public

Inverse hyperbolic cosecant function.

public

Add.

public

Logical AND.

public

arg(): Matrix

The argument of each element of matrix.

public

Reverse secant function.

public

Inverse hyperbolic secant function.

public

Arc sine function.

public

Inverse hyperbolic sine function.

public

Atan (arc tangent) function.

public

Atan (arc tangent) function.

public

Inverse hyperbolic tangent function.

public

Beta function.

public

Cumulative distribution function (CDF) of beta distribution.

public

Incomplete beta function.

public

Inverse function of cumulative distribution function (CDF) of beta distribution.

public

Probability density function (PDF) of beta distribution.

public

Cumulative distribution function (CDF) of binomial distribution.

public

Inverse function of cumulative distribution function (CDF) of binomial distribution.

public

Probability density function (PDF) of binomial distribution.

public

Cube root.

public

Ceil.

public

Cumulative distribution function (CDF) of chi-square distribution.

public

Inverse function of cumulative distribution function (CDF) of chi-square distribution.

public

Probability density function (PDF) of chi-square distribution.

public

Circular shift.

public

Clip each element of matrix to specified range.

public

Deep copy.

public

Perform the same process on all elements in the matrix.

public

Compare values.

public

Compare values.

public

Combine matrix to the bottom of this matrix.

public

Combine matrix to the right of this matrix.

public

Condition number of the matrix

public

Complex conjugate matrix.

public

Convolution integral, Polynomial multiplication.

public

Correlation matrix or Correlation coefficient.

public

cos(): Matrix

Cosine function.

public

Hyperbolic cosine function.

public

cot(): Matrix

Cotangent function.

public

Hyperbolic cotangent function.

public

Covariance matrix or Covariance value.

public

csc(): Matrix

Cosecant function.

public

Hyperbolic cosecant function.

public

Hermitian transpose.

public

Discrete cosine transform (DCT-II, DCT).

public

Discrete two-dimensional cosine transform (2D DCT).

public

deleteColumn(delete_column_index: KMatrixInputData): Matrix

Remove the column in this matrix.

public

deleteRow(delete_row_index: KMatrixInputData): Matrix

Remove the row in this matrix.

public

det(): Matrix

Determinant.

public

If matrix, generate diagonal column vector.

public

Divide.

public

Divide.

public

Division for each element of matrix.

public

Inverse of each element of matrix.

public

Multiplication for each element of matrix.

public

Power function for each element of the matrix.

public

eachVector(array_function: function(prm1: Array<Complex>): Array<Complex>, dimension: string | number): Matrix

Treat the rows and columns of the matrix as vectors and perform the same processing.

public

eachVectorAuto(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix

Treat the columns of the matrix as vectors and execute the same process.

public

eachVectorBoth(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix

Treat the rows and columns of the matrix as vectors and perform the same processing.

public

eachVectorColumn(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix

Treat the columns of the matrix as vectors and execute the same process.

public

eachVectorRow(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix

Treat the rows of the matrix as vectors and execute the same process.

public

eig(): {V: Matrix, D: Matrix}

Eigendecomposition of symmetric matrix.

public

Equals.

public

erf(): Matrix

Error function.

public

Complementary error function.

public

Inverse function of Complementary error function.

public

Inverse function of Error function.

public

exchangeColumn(exchange_column_index1: KMatrixInputData, exchange_column_index2: KMatrixInputData): Matrix

Swap columns in the matrix.

public

exchangeRow(exchange_row_index1: KMatrixInputData, exchange_row_index2: KMatrixInputData): Matrix

Swap rows in the matrix.

public

exp(): Matrix

Exponential function.

public

e^x - 1

public

Extended Euclidean algorithm.

public

factor(): Matrix[]

Factorization.

public

Factorial function, x!.

public

Cumulative distribution function (CDF) of F-distribution.

public

Discrete Fourier transform (DFT).

public

Discrete two-dimensional Fourier transform (2D DFT).

public

FFT shift.

public

Inverse function of cumulative distribution function (CDF) of F-distribution.

public

fix(): Matrix

To integer rounded down to the nearest.

public

Flip this matrix.

public

Flip this matrix left and right.

public

Flip this matrix up and down.

public

Floor.

public

Probability density function (PDF) of F-distribution.

public

Fraction.

public

Cumulative distribution function (CDF) of gamma distribution.

public

Inverse function of cumulative distribution function (CDF) of gamma distribution.

public

Gamma function.

public

Incomplete gamma function.

public

Log-gamma function.

public

Probability density function (PDF) of the gamma distribution.

public

Euclidean algorithm.

public

Geometric mean.

public

Returns the specified element in the matrix.

public

Complex array of complex numbers of each element of the matrix.

public

Extract the specified part of the matrix.

public

Array of real parts of elements in matrix.

public

Inverse discrete cosine transform (DCT-III, IDCT).

public

Inverse discrete two-dimensional cosine transform (2D IDCT).

public

Inverse discrete Fourier transform (IDFT).

public

Inverse discrete two-dimensional Fourier transform (2D IDFT).

public

Imaginary part of each element of the matrix.

public

Index sort.

public

Inner product/Dot product.

public

inv(): Matrix

Inverse matrix of this matrix.

public

Return true if the matrix is column vector.

public

Return true if the matrix is complex matrix.

public

Returns true if the vallue is complex integer (including normal integer).

public

Return true if the matrix is diagonal matrix.

public

Return true if the value is finite number.

public

Return true if the matrix is hermitian matrix.

public

Return true if the matrix is identity matrix.

public

this === Infinity or -Infinity

  • Use only the first element.
public

Return true if the value is integer.

public

Return true if the value is not scalar.

public

this === NaN

  • Use only the first element.
public

this < 0

  • Use only the first element.
public

this === -Infinity

  • Use only the first element.
public

this >= 0

  • Use only the first element.
public

this === 1

  • Use only the first element.
public

Return true if the matrix is orthogonal matrix.

public

Return true if the matrix is permutation matrix.

public

this > 0

  • Use only the first element.
public

this === Infinity

  • Use only the first element.
public

Return true if the value is prime number.

public

Return true if the value is prime number by Miller-Labin prime number determination method.

public

Return true if the matrix is real matrix.

public

Return true if the matrix is regular matrix.

public

Return true if the matrix is row vector.

public

Return true if the matrix is scalar.

public

Return true if the matrix is square matrix.

public

Return true if the matrix is symmetric matrix.

public

Return true if the matrix is lower triangular matrix.

public

Return true if the matrix is upper triangular matrix.

public

Return true if the matrix is tridiagonal matrix.

public

Return true if the matrix is unitary matrix.

public

Return true if the matrix is vector.

public

this === 0

  • Use only the first element.
public

Return true if the matrix is zero matrix.

public

Least common multiple.

public

Solving a system of linear equations to be Ax = B

public

log(): Matrix

Logarithmic function.

public

log_10(x)

public

ln(1 + x)

public

log_2(x)

public

Logit function.

public

lu(): {L: Matrix, U: Matrix}

LU decomposition.

public

lup(): {P: Matrix, L: Matrix, U: Matrix}

LUP decomposition.

public

mad(algorithm: string | ?number, type: KMatrixSettings): Matrix

Mean absolute deviation.

public

Maximum number.

public

Arithmetic average.

public

Median.

public

Minimum number.

public

Modulo, positive remainder of division for each element of matrix.

public

Modular multiplicative inverse.

public

Modular exponentiation.

public

Mode.

public

moment(nth_order: number, type: KMatrixSettings): Matrix

Moment.

public

Multiply.

public

Multiply.

public

Binomial coefficient, number of all combinations, nCk.

public
this method was deprecated. use the dotdiv.

Division for each element of matrix.

public

this * -1

public

Next prime.

public
this method was deprecated. use the dotinv.

Inverse of each element of matrix.

public
this method was deprecated. use the dotmul.

Multiplication for each element of matrix.

public

p-norm.

public

Cumulative distribution function (CDF) of normal distribution.

public

Inverse function of cumulative distribution function (CDF) of normal distribution.

public

Probability density function (PDF) of normal distribution.

public

not(): Matrix

Logical Not.

public
this method was deprecated. use the dotpow.

Power function for each element of the matrix.

public

Logical OR.

public

Pseudo-inverse matrix.

public

Cumulative distribution function (CDF) of Poisson distribution.

public

Inverse function of cumulative distribution function (CDF) of Poisson distribution.

public

Probability density function (PDF) of Poisson distribution.

public

Power function.

public

Power spectral density.

public

Product of array elements.

public

qr(): {Q: Matrix, R: Matrix}

QR decomposition.

public

Rank.

public

Inverse condition number.

public

Real part of each element.

public

Modulo, positive remainder of division for each element of matrix.

public

Remainder of division.

public

reshape(row_length: KMatrixInputData, column_length: KMatrixInputData): Matrix

Change the shape of the matrix.

public

resize(row_length: KMatrixInputData, column_length: KMatrixInputData): Matrix

Change the size of the matrix.

public

Circular shift.

public

rot90(rot_90_count: KMatrixInputData): Matrix

Rotate matrix 90 degrees clockwise.

public

Rounding to the nearest integer.

public

Reciprocal square root.

public

Multiply a multiple of ten.

public

sec(): Matrix

Secant function.

public

Hyperbolic secant function.

public

Change specified element in matrix.

public

this << n

  • Calculated as an integer.
public

The positive or negative signs of each element of the matrix.

public

The positive or negative sign of this number.

public

sin(): Matrix

Sine function.

public

Normalized sinc function.

public

Hyperbolic sine function.

public

size(dimension: string | ?number): Matrix

Number of rows and columns of matrix.

public

Skewness.

public

sort(order: string, type: KMatrixSettings): Matrix

Sort.

public

Square root.

public

Square.

public

The samples are standardize to a mean value of 0, standard deviation of 1.

public

Standard deviation.

public

Subtract.

public

Subtract.

public

Sum.

public

svd(): {U: Matrix, S: Matrix, V: Matrix}

Singular Value Decomposition (SVD).

public

tan(): Matrix

Tangent function.

public

Hyperbolic tangent function.

public

Cumulative distribution function (CDF) of Student's t-distribution.

  • Calculate from real values.
public

Cumulative distribution function (CDF) of Student's t-distribution that can specify tail.

  • Calculate from real values.
public

Test if each element of the matrix is complex.

public

Test if each element of the matrix is complex integer.

public

Test if each element of the matrix is finite.

public

Test if each element of the matrix is infinite.

public

Test if each element of the matrix is integer.

public

Test if each element of the matrix is NaN.

public

real(this) < 0

  • 1 if true, 0 if false.
public

Test if each element of the matrix is negative infinite.

public

real(this) >= 0

  • 1 if true, 0 if false.
public

real(this) === 1

  • 1 if true, 0 if false.
public

real(this) > 0

  • 1 if true, 0 if false.
public

Test if each element of the matrix is positive infinite.

public

Test if each element of the matrix is prime number.

public

Test if each element of the matrix is prime number by Miller-Labin prime number determination method.

public

Test if each element of the matrix is real.

public

real(this) === 0

  • 1 if true, 0 if false.
public

Inverse of cumulative distribution function (CDF) of Student's t-distribution.

  • Calculate from real values.
public

Inverse of cumulative distribution function (CDF) of Student's t-distribution in two-sided test.

  • Calculate from real values.
public

return BigDecimal.

public

return BigInteger.

public

return Complex.

public

return Fraction.

public

Convert to JSON.

public

return Matrix.

public

Convert to string in one line.

public

Convert to string.

public

Probability density function (PDF) of Student's t-distribution.

  • Calculate from real values.
public

Trace of a matrix.

public

Transpose a matrix.

public

Tridiagonalization of symmetric matrix.

public

To integer rounded down to the nearest.

public

Variance.

public

ACF(Autocorrelation function), cros-correlation function.

public

Logical Exclusive-OR.

Private Methods
private

Delete cache.

private

Combine matrix to the bottom of this matrix.

private

_deleteColumn(delete_column_index: KMatrixInputData): Matrix

Remove the column in this matrix.

private

_deleteRow(delete_row_index: KMatrixInputData): Matrix

Remove the row in this matrix.

private

_rot90(rot_90_count: KMatrixInputData): Matrix

Rotate matrix 90 degrees clockwise.

Inherited Summary

From class KonpeitoInteger
public static get

-1

public static get

Negative Infinity.

public static get

Not a Number.

public static get

1

public static get

Positive infinity.

public static get

10

public static get

2

public static get

0

public static

create(number: any): KonpeitoInteger

Create an entity object of this class.

public static

valueOf(number: any): KonpeitoInteger

Create number.

public get

boolean value.

public get

floating point.

public get

integer value.

public

Absolute value.

public

add(number: any): KonpeitoInteger

Add.

public

and(number: any): KonpeitoInteger

Logical AND.

public

Ceil.

public

Deep copy.

public

compareTo(number: any): number

Compare values.

public

div(number: any): KonpeitoInteger

Divide.

public

divide(number: any): KonpeitoInteger

Divide.

public

equals(number: any): boolean

Equals.

public

extgcd(number: any): KonpeitoInteger[]

Extended Euclidean algorithm.

public

Factorization.

public

Factorial function, x!.

public

To integer rounded down to the nearest.

public

Floor.

public

Fraction.

public

gcd(number: any): KonpeitoInteger

Euclidean algorithm.

public

Inverse number of this value.

public

Return true if the value is finite number.

public

this === Infinity or -Infinity

public

this === NaN

public

this < 0

public

this === -Infinity

public

this >= 0

public

this === 1

public

this > 0

public

this === Infinity

public

Return true if the value is prime number.

public

isProbablePrime(certainty: any): boolean

Return true if the value is prime number by Miller-Labin prime number determination method.

public

this === 0

public

lcm(number: any): KonpeitoInteger

Least common multiple.

public

mod(number: any): KonpeitoInteger

Modulo, positive rem of division.

public

Modular multiplicative inverse.

public

modPow(exponent: any, m: any): KonpeitoInteger

Modular exponentiation.

public

mul(number: any): KonpeitoInteger

Multiply.

public

multiply(number: any): KonpeitoInteger

Multiply.

public

this * -1

public

nextProbablePrime(certainty: any, search_max: any): KonpeitoInteger

Next prime.

public

Logical Not.

public

or(number: any): KonpeitoInteger

Logical OR.

public

pow(exponent: any): KonpeitoInteger

Power function.

public

rem(number: any): KonpeitoInteger

Remainder of division.

public

remainder(number: any): KonpeitoInteger

Remainder of division.

public

Rounding to the nearest integer.

public

Multiply a multiple of ten.

public

this << n

public

sign(): any

The positive or negative sign of this number.

public

signum(): any

The positive or negative sign of this number.

public

Square.

public

sub(number: any): KonpeitoInteger

Subtract.

public

subtract(number: any): KonpeitoInteger

Subtract.

public

return BigDecimal.

public

return BigInteger.

public

return Complex.

public

return Fraction.

public

Convert to JSON.

public

return Matrix.

public

Convert to string.

public

xor(number: any): KonpeitoInteger

Logical Exclusive-OR.

From class KonpeitoFloat
public static get

E, Napier's constant.

public static get

0.5

public static get

0.5 * PI.

public static get

log_e(10)

public static get

log_e(2)

public static get

log_10(e)

public static get

log_2(e)

public static get

PI.

public static get

0.25 * PI.

public static get

sqrt(0.5)

public static get

sqrt(2)

public static get

2 * PI.

public

Arc cosine function.

public

Inverse hyperbolic cosine function.

public

Inverse cotangent function.

public

Inverse hyperbolic cotangent function.

public

Inverse cosecant function.

public

Inverse hyperbolic cosecant function.

public

Reverse secant function.

public

Inverse hyperbolic secant function.

public

Arc sine function.

public

Inverse hyperbolic sine function.

public

Atan (arc tangent) function.

public

atan2(number: any): KonpeitoFloat

Atan (arc tangent) function.

public

Inverse hyperbolic tangent function.

public

Cube root.

public

Cosine function.

public

Hyperbolic cosine function.

public

Cotangent function.

public

Hyperbolic cotangent function.

public

Cosecant function.

public

Hyperbolic cosecant function.

public

Exponential function.

public

e^x - 1

public

Logarithmic function.

public

log_10(x)

public

ln(1 + x)

public

log_2(x)

public

Logit function.

public

Reciprocal square root.

public

Secant function.

public

Hyperbolic secant function.

public

Sine function.

public

Normalized sinc function.

public

Hyperbolic sine function.

public

Square root.

public

Tangent function.

public

Hyperbolic tangent function.

Static Public Members

public static get E: Matrix: * source

E, Napier's constant.

Override:

KonpeitoFloat#E

Return:

Matrix

2.71...

public static get HALF: Matrix: * source

0.5

Override:

KonpeitoFloat#HALF

Return:

Matrix

0.5

public static get HALF_PI: Matrix: * source

0.5 * PI.

Override:

KonpeitoFloat#HALF_PI

Return:

Matrix

1.57...

public static get I: Matrix: * source

i, j

Return:

Matrix

i

public static get LN10: Matrix: * source

log_e(10)

Override:

KonpeitoFloat#LN10

Return:

Matrix

ln(10)

public static get LN2: Matrix: * source

log_e(2)

Override:

KonpeitoFloat#LN2

Return:

Matrix

ln(2)

public static get LOG10E: Matrix: * source

log_10(e)

Override:

KonpeitoFloat#LOG10E

Return:

Matrix

log_10(e)

public static get LOG2E: Matrix: * source

log_2(e)

Override:

KonpeitoFloat#LOG2E

Return:

Matrix

log_2(e)

public static get MINUS_ONE: Matrix: * source

-1

Override:

KonpeitoInteger#MINUS_ONE

Return:

Matrix

1

public static get NEGATIVE_INFINITY: Matrix: * source

Negative Infinity.

Override:

KonpeitoInteger#NEGATIVE_INFINITY

Return:

Matrix

Infinity

public static get NaN: Matrix: * source

Not a Number.

Override:

KonpeitoInteger#NaN

Return:

Matrix

NaN

public static get ONE: Matrix: * source

1

Override:

KonpeitoInteger#ONE

Return:

Matrix

1

public static get PI: Matrix: * source

PI.

Override:

KonpeitoFloat#PI

Return:

Matrix

3.14...

public static get POSITIVE_INFINITY: Matrix: * source

Positive infinity.

Override:

KonpeitoInteger#POSITIVE_INFINITY

Return:

Matrix

Infinity

public static get QUARTER_PI: Matrix: * source

0.25 * PI.

Override:

KonpeitoFloat#QUARTER_PI

Return:

Matrix

0.78...

public static get SQRT1_2: Matrix: * source

sqrt(0.5)

Override:

KonpeitoFloat#SQRT1_2

Return:

Matrix

sqrt(0.5)

public static get SQRT2: Matrix: * source

sqrt(2)

Override:

KonpeitoFloat#SQRT2

Return:

Matrix

sqrt(2)

public static get TEN: Matrix: * source

10

Override:

KonpeitoInteger#TEN

Return:

Matrix

10

public static get TWO: Matrix: * source

2

Override:

KonpeitoInteger#TWO

Return:

Matrix

2

public static get TWO_PI: Matrix: * source

2 * PI.

Override:

KonpeitoFloat#TWO_PI

Return:

Matrix

6.28...

public static get ZERO: Matrix: * source

0

Override:

KonpeitoInteger#ZERO

Return:

Matrix

0

Static Public Methods

public static arange(start_or_stop: KMatrixInputData, stop: KMatrixInputData, step: KMatrixInputData): Matrix source

Create row vector with specified initial value, step value, end condition.

Params:

NameTypeAttributeDescription
start_or_stop KMatrixInputData
stop KMatrixInputData
  • optional
step KMatrixInputData
  • optional
  • default: 1

Return:

Matrix

public static create(number: KMatrixInputData): Matrix source

Create an entity object of this class.

Override:

KonpeitoInteger#create

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

public static createMatrixDoEachCalculation(eachfunc: function(prm1: number, prm2: number): ?Object, dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Create Matrix with specified initialization for each element in matrix.

Params:

NameTypeAttributeDescription
eachfunc function(prm1: number, prm2: number): ?Object

Function(row, col)

dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional
  • default: dimension

Number of columns.

Return:

Matrix

Matrix after function processing.

public static eye(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Return identity matrix.

Params:

NameTypeAttributeDescription
dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

Return:

Matrix

public static hamming(size: KMatrixInputData, periodic: string | number): Matrix source

Hamming window.

Params:

NameTypeAttributeDescription
size KMatrixInputData

Window length

periodic string | number
  • optional
  • default: "symmetric"

0/"symmetric" (default) , 1/"periodic"

Return:

Matrix

Column vector.

public static hann(size: KMatrixInputData, periodic: string | number): Matrix source

Hann (Hanning) window.

Params:

NameTypeAttributeDescription
size KMatrixInputData

Window length

periodic string | number
  • optional
  • default: "symmetric"

0/"symmetric" (default) , 1/"periodic"

Return:

Matrix

Column vector.

public static memset(number: KMatrixInputData, dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Creates a matrix composed of the specified number.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Value after initialization.

dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

Return:

Matrix

public static ones(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Create a matrix of all ones.

Params:

NameTypeAttributeDescription
dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

Return:

Matrix

public static rand(dimension: KMatrixInputData, column_length: KMatrixInputData, random: Random): Matrix source

Generate a matrix composed of random values [0, 1) with uniform random numbers.

Params:

NameTypeAttributeDescription
dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

random Random
  • optional

Class for creating random numbers.

Return:

Matrix

public static randn(dimension: KMatrixInputData, column_length: KMatrixInputData, random: Random): Matrix source

Generate a matrix composed of random values with normal distribution.

Params:

NameTypeAttributeDescription
dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

random Random
  • optional

Class for creating random numbers.

Return:

Matrix

public static valueOf(number: KMatrixInputData): Matrix source

Convert number to Matrix type.

Override:

KonpeitoInteger#valueOf

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

public static window(name: string, size: KMatrixInputData, periodic: string | number): Matrix source

Create window function for signal processing. The following window functions are available.

  • "rectangle": Rectangular window
  • "hann": Hann/Hanning window.
  • "hamming": Hamming window.
  • "blackman": Blackman window.
  • "blackmanharris": Blackman-Harris window.
  • "blackmannuttall": Blackman-Nuttall window.
  • "flattop": Flat top window.
  • "sin", Half cycle sine window.
  • "vorbis", Vorbis window.

Params:

NameTypeAttributeDescription
name string

Window function name.

size KMatrixInputData

Window length

periodic string | number
  • optional
  • default: "symmetric"

0/"symmetric" (default) , 1/"periodic"

Return:

Matrix

Column vector.

public static zeros(dimension: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Create zero matrix.

Params:

NameTypeAttributeDescription
dimension KMatrixInputData

Number of dimensions or rows.

column_length KMatrixInputData
  • optional

Number of columns.

Return:

Matrix

Public Constructors

public constructor(number: KMatrixInputData) source

Create a complex matrix. Initialization can be performed as follows.

  • 10, "10", "3 + 4j", "[ 1 ]", "[1, 2, 3]", "[1 2 3]", [1, 2, 3],
  • [[1, 2], [3, 4]], "[1 2; 3 4]", "[1+2i 3+4i]",
  • "[1:10]", "[1:2:3]" (MATLAB / Octave / Scilab compatible).

Override:

KonpeitoFloat#constructor

Params:

NameTypeAttributeDescription
number KMatrixInputData

Complex matrix. See how to use the function.

Public Members

public get booleanValue: boolean: * source

Boolean value of the first element of the matrix.

Override:

KonpeitoInteger#booleanValue

Return:

boolean

public get doubleValue: number: * source

Real value of first element of the matrix.

Override:

KonpeitoInteger#doubleValue

Return:

number

public get height: number: * source

Number of rows in matrix.

Return:

number

public get intValue: number: * source

Integer value of the first element of the matrix.

Override:

KonpeitoInteger#intValue

Return:

number

public get length: number: * source

Maximum size of rows or columns in the matrix.

Return:

number

public get norm1: number: * source

1-norm.

Return:

number

public get norm2: number: * source

2-norm.

Return:

number

public get scalar: Complex: * source

First element of this matrix.

Return:

Complex

public get width: number: * source

Number of columns in the matrix.

Return:

number

Public Methods

public T(): Matrix source

Hermitian transpose.

Return:

Matrix

A^T

public abs(): Matrix source

Absolute value.

Override:

KonpeitoInteger#abs

Return:

Matrix

abs(A)

public acos(): Matrix source

Arc cosine function.

Override:

KonpeitoFloat#acos

Return:

Matrix

acos(A)

public acosh(): Matrix source

Inverse hyperbolic cosine function.

Override:

KonpeitoFloat#acosh

Return:

Matrix

acosh(A)

public acot(): Matrix source

Inverse cotangent function.

Override:

KonpeitoFloat#acot

Return:

Matrix

acot(A)

public acoth(): Matrix source

Inverse hyperbolic cotangent function.

Override:

KonpeitoFloat#acoth

Return:

Matrix

acoth(A)

public acsc(): Matrix source

Inverse cosecant function.

Override:

KonpeitoFloat#acsc

Return:

Matrix

acsc(A)

public acsch(): Matrix source

Inverse hyperbolic cosecant function.

Override:

KonpeitoFloat#acsch

Return:

Matrix

acsch(A)

public add(number: KMatrixInputData): Matrix source

Add.

Override:

KonpeitoInteger#add

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A + B

public and(number: KMatrixInputData): Matrix source

Logical AND.

  • Calculated as an integer.

Override:

KonpeitoInteger#and

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A & B

public arg(): Matrix source

The argument of each element of matrix.

Return:

Matrix

arg(A)

public asec(): Matrix source

Reverse secant function.

Override:

KonpeitoFloat#asec

Return:

Matrix

asec(A)

public asech(): Matrix source

Inverse hyperbolic secant function.

Override:

KonpeitoFloat#asech

Return:

Matrix

asech(A)

public asin(): Matrix source

Arc sine function.

Override:

KonpeitoFloat#asin

Return:

Matrix

asin(A)

public asinh(): Matrix source

Inverse hyperbolic sine function.

Override:

KonpeitoFloat#asinh

Return:

Matrix

asinh(A)

public atan(): Matrix source

Atan (arc tangent) function.

  • Return the values of [-PI/2, PI/2].

Override:

KonpeitoFloat#atan

Return:

Matrix

atan(A)

public atan2(number: KMatrixInputData): Matrix source

Atan (arc tangent) function.

  • Return the values of [-PI, PI].
  • Supports only real numbers.

Override:

KonpeitoFloat#atan2

Params:

NameTypeAttributeDescription
number KMatrixInputData

X

Return:

Matrix

atan2(Y, X)

public atanh(): Matrix source

Inverse hyperbolic tangent function.

Override:

KonpeitoFloat#atanh

Return:

Matrix

atanh(A)

public beta(y: KMatrixInputData): Matrix source

Beta function.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
y KMatrixInputData

Return:

Matrix

public betacdf(a: KMatrixInputData, b: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of beta distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
a KMatrixInputData
b KMatrixInputData

Return:

Matrix

public betainc(a: KMatrixInputData, b: KMatrixInputData, tail: string): Matrix source

Incomplete beta function.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
a KMatrixInputData
b KMatrixInputData
tail string
  • optional
  • default: "lower"

lower (default) , "upper"

Return:

Matrix

public betainv(a: KMatrixInputData, b: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of beta distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
a KMatrixInputData
b KMatrixInputData

Return:

Matrix

public betapdf(a: KMatrixInputData, b: KMatrixInputData): Matrix source

Probability density function (PDF) of beta distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
a KMatrixInputData
b KMatrixInputData

Return:

Matrix

public binocdf(n: KMatrixInputData, p: KMatrixInputData, tail: string): Matrix source

Cumulative distribution function (CDF) of binomial distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
n KMatrixInputData
p KMatrixInputData
tail string
  • optional
  • default: "lower"

lower (default) , "upper"

Return:

Matrix

public binoinv(n: KMatrixInputData, p: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of binomial distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
n KMatrixInputData
p KMatrixInputData

Return:

Matrix

public binopdf(n: KMatrixInputData, p: KMatrixInputData): Matrix source

Probability density function (PDF) of binomial distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
n KMatrixInputData
p KMatrixInputData

Return:

Matrix

public cbrt(): Matrix source

Cube root.

Override:

KonpeitoFloat#cbrt

Return:

Matrix

sqrt(A)

public ceil(): Matrix source

Ceil.

Override:

KonpeitoInteger#ceil

Return:

Matrix

ceil(A)

public chi2cdf(k: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of chi-square distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public chi2inv(k: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of chi-square distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public chi2pdf(k: KMatrixInputData): Matrix source

Probability density function (PDF) of chi-square distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public circshift(shift_size: KMatrixInputData, type: KMatrixSettings): Matrix source

Circular shift.

Params:

NameTypeAttributeDescription
shift_size KMatrixInputData
type KMatrixSettings
  • optional

Return:

Matrix

Matrix after function processing.

public clip(min: KMatrixInputData, max: KMatrixInputData): Matrix source

Clip each element of matrix to specified range.

Params:

NameTypeAttributeDescription
min KMatrixInputData
max KMatrixInputData

Return:

Matrix

min(max(x, min), max)

public clone(): Matrix source

Deep copy.

Override:

KonpeitoInteger#clone

Return:

Matrix

public cloneMatrixDoEachCalculation(eachfunc: function(prm1: Complex, prm2: number, prm3: number): ?Object): Matrix source

Perform the same process on all elements in the matrix.

Params:

NameTypeAttributeDescription
eachfunc function(prm1: Complex, prm2: number, prm3: number): ?Object

Function(num, row, col)

Return:

Matrix

Matrix after function processing.

public compareTo(number: KMatrixInputData, tolerance: KMatrixInputData): number source

Compare values.

  • Use compareToMatrix if you want to compare matrices.

Override:

KonpeitoInteger#compareTo

Params:

NameTypeAttributeDescription
number KMatrixInputData
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

number

A > B ? 1 : (A === B ? 0 : -1)

public compareToMatrix(number: KMatrixInputData, tolerance: KMatrixInputData): Matrix source

Compare values.

  • Use compareTo if you want to compare scalar values.

Params:

NameTypeAttributeDescription
number KMatrixInputData
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

A > B ? 1 : (A === B ? 0 : -1)

public concatBottom(bottom_matrix: KMatrixInputData): Matrix source

Combine matrix to the bottom of this matrix.

Params:

NameTypeAttributeDescription
bottom_matrix KMatrixInputData

Matrix to combine.

Return:

Matrix

Matrix after function processing.

public concatRight(left_matrix: KMatrixInputData): Matrix source

Combine matrix to the right of this matrix.

Params:

NameTypeAttributeDescription
left_matrix KMatrixInputData

Matrix to combine.

Return:

Matrix

Matrix after function processing.

public cond(p: KMatrixInputData): number source

Condition number of the matrix

Params:

NameTypeAttributeDescription
p KMatrixInputData
  • optional
  • default: 2

Return:

number

public conj(): Matrix source

Complex conjugate matrix.

Return:

Matrix

real(A) - imag(A)j

public conv(number: KMatrixInputData): Matrix source

Convolution integral, Polynomial multiplication.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

public corrcoef(y_or_type: KMatrixSettings | KMatrixInputData, type: KMatrixSettings): Matrix source

Correlation matrix or Correlation coefficient.

  • Get a correlation matrix from 1 matrix.
  • Get a correlation coefficient from 2 vectors.

Params:

NameTypeAttributeDescription
y_or_type KMatrixSettings | KMatrixInputData
  • optional
type KMatrixSettings
  • optional

Return:

Matrix

public cos(): Matrix source

Cosine function.

Override:

KonpeitoFloat#cos

Return:

Matrix

cos(A)

public cosh(): Matrix source

Hyperbolic cosine function.

Override:

KonpeitoFloat#cosh

Return:

Matrix

cosh(A)

public cot(): Matrix source

Cotangent function.

Override:

KonpeitoFloat#cot

Return:

Matrix

cot(A)

public coth(): Matrix source

Hyperbolic cotangent function.

Override:

KonpeitoFloat#coth

Return:

Matrix

coth(A)

public cov(y_or_type: KMatrixSettings | KMatrixInputData, type: KMatrixSettings): Matrix source

Covariance matrix or Covariance value.

  • Get a variance-covariance matrix from 1 matrix.
  • Get a covariance from 2 vectors.

Params:

NameTypeAttributeDescription
y_or_type KMatrixSettings | KMatrixInputData
  • optional
type KMatrixSettings
  • optional

Return:

Matrix

public csc(): Matrix source

Cosecant function.

Override:

KonpeitoFloat#csc

Return:

Matrix

csc(A)

public csch(): Matrix source

Hyperbolic cosecant function.

Override:

KonpeitoFloat#csch

Return:

Matrix

csch(A)

public ctranspose(): Matrix source

Hermitian transpose.

Return:

Matrix

A^T

public dct(type: KMatrixSettings): Matrix source

Discrete cosine transform (DCT-II, DCT).

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

dct(x)

public dct2(): Matrix source

Discrete two-dimensional cosine transform (2D DCT).

Return:

Matrix

public deleteColumn(delete_column_index: KMatrixInputData): Matrix source

Remove the column in this matrix.

Params:

NameTypeAttributeDescription
delete_column_index KMatrixInputData

Number of column of matrix to delete.

Return:

Matrix

Matrix after function processing.

public deleteRow(delete_row_index: KMatrixInputData): Matrix source

Remove the row in this matrix.

Params:

NameTypeAttributeDescription
delete_row_index KMatrixInputData

Number of row of matrix to delete.

Return:

Matrix

Matrix after function processing.

public det(): Matrix source

Determinant.

Return:

Matrix

|A|

public diag(): Matrix source

If matrix, generate diagonal column vector. If vector, generate a matrix with diagonal elements.

Return:

Matrix

Matrix or vector created. See how to use the function.

public div(number: KMatrixInputData): Matrix source

Divide.

  • Use dotdiv if you want to use div for each element.

Override:

KonpeitoInteger#div

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A / B

public divide(number: KMatrixInputData): Matrix source

Divide.

Override:

KonpeitoInteger#divide

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

fix(A / B)

public dotdiv(number: KMatrixInputData): Matrix source

Division for each element of matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A ./ B

public dotinv(): Matrix source

Inverse of each element of matrix.

Return:

Matrix

1 ./ A

public dotmul(number: KMatrixInputData): Matrix source

Multiplication for each element of matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .* B

public dotpow(number: KMatrixInputData): Matrix source

Power function for each element of the matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .^ B

public eachVector(array_function: function(prm1: Array<Complex>): Array<Complex>, dimension: string | number): Matrix source

Treat the rows and columns of the matrix as vectors and perform the same processing. The arguments of the method can switch the direction of the matrix to be executed.

Params:

NameTypeAttributeDescription
array_function function(prm1: Array<Complex>): Array<Complex>

Function(array)

dimension string | number
  • optional
  • default: "auto"

0/"auto", 1/"row", 2/"column", 3/"both"

Return:

Matrix

Matrix after function processing.

public eachVectorAuto(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix source

Treat the columns of the matrix as vectors and execute the same process.

  • If the matrix is a row vector, it performs the same processing for the row vector.

Params:

NameTypeAttributeDescription
array_function function(prm1: Array<Complex>): Array<Complex>

Function(array)

Return:

Matrix

Matrix after function processing.

public eachVectorBoth(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix source

Treat the rows and columns of the matrix as vectors and perform the same processing.

  1. First run the same process for the row.
  2. Finally perform the same processing for the column.

Params:

NameTypeAttributeDescription
array_function function(prm1: Array<Complex>): Array<Complex>

Function(array)

Return:

Matrix

Matrix after function processing.

public eachVectorColumn(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix source

Treat the columns of the matrix as vectors and execute the same process.

Params:

NameTypeAttributeDescription
array_function function(prm1: Array<Complex>): Array<Complex>

Function(array)

Return:

Matrix

Matrix after function processing.

public eachVectorRow(array_function: function(prm1: Array<Complex>): Array<Complex>): Matrix source

Treat the rows of the matrix as vectors and execute the same process.

Params:

NameTypeAttributeDescription
array_function function(prm1: Array<Complex>): Array<Complex>

Function(array)

Return:

Matrix

Matrix after function processing.

public eig(): {V: Matrix, D: Matrix} source

Eigendecomposition of symmetric matrix.

  • Don't support complex numbers.
  • VDV'=A.
  • V is orthonormal matrix. and columns of V are the right eigenvectors.
  • D is a matrix containing the eigenvalues on the diagonal component.

Return:

{V: Matrix, D: Matrix}

{D, V}

public equals(number: KMatrixInputData, tolerance: KMatrixInputData): boolean source

Equals.

Override:

KonpeitoInteger#equals

Params:

NameTypeAttributeDescription
number KMatrixInputData
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

A === B

public erf(): Matrix source

Error function.

  • Calculate from real values.

Return:

Matrix

public erfc(): Matrix source

Complementary error function.

  • Calculate from real values.

Return:

Matrix

public erfcinv(): Matrix source

Inverse function of Complementary error function.

  • Calculate from real values.

Return:

Matrix

public erfinv(): Matrix source

Inverse function of Error function.

  • Calculate from real values.

Return:

Matrix

public exchangeColumn(exchange_column_index1: KMatrixInputData, exchange_column_index2: KMatrixInputData): Matrix source

Swap columns in the matrix.

Params:

NameTypeAttributeDescription
exchange_column_index1 KMatrixInputData

Number 1 of column of matrix to exchange.

exchange_column_index2 KMatrixInputData

Number 2 of column of matrix to exchange.

Return:

Matrix

Matrix after function processing.

public exchangeRow(exchange_row_index1: KMatrixInputData, exchange_row_index2: KMatrixInputData): Matrix source

Swap rows in the matrix.

Params:

NameTypeAttributeDescription
exchange_row_index1 KMatrixInputData

Number 1 of row of matrix to exchange.

exchange_row_index2 KMatrixInputData

Number 2 of row of matrix to exchange.

Return:

Matrix

Matrix after function processing.

public exp(): Matrix source

Exponential function.

Override:

KonpeitoFloat#exp

Return:

Matrix

exp(A)

public expm1(): Matrix source

e^x - 1

Override:

KonpeitoFloat#expm1

Return:

Matrix

expm1(A)

public extgcd(number: KMatrixInputData): Array<Matrix> source

Extended Euclidean algorithm.

  • Calculated as an integer.

Override:

KonpeitoInteger#extgcd

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Array<Matrix>

[a, b, gcd(x, y)], Result of calculating ax + by = gcd(x, y).

public factor(): Matrix[] source

Factorization.

  • Use only the first element.
  • Calculated as an integer.
  • Calculate up to 9007199254740991.

Override:

KonpeitoInteger#factor

Return:

Matrix[]

factor

public factorial(): Matrix source

Factorial function, x!.

  • Calculate from real values.

Override:

KonpeitoInteger#factorial

Return:

Matrix

public fcdf(d1: KMatrixInputData, d2: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of F-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
d1 KMatrixInputData

The degree of freedom of the molecules.

d2 KMatrixInputData

The degree of freedom of the denominator

Return:

Matrix

public fft(type: KMatrixSettings): Matrix source

Discrete Fourier transform (DFT).

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

fft(x)

public fft2(): Matrix source

Discrete two-dimensional Fourier transform (2D DFT).

Return:

Matrix

public fftshift(type: KMatrixSettings): Matrix source

FFT shift. Circular shift beginning at the center of the signal.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public finv(d1: KMatrixInputData, d2: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of F-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
d1 KMatrixInputData

The degree of freedom of the molecules.

d2 KMatrixInputData

The degree of freedom of the denominator

Return:

Matrix

public fix(): Matrix source

To integer rounded down to the nearest.

Override:

KonpeitoInteger#fix

Return:

Matrix

fix(A), trunc(A)

public flip(type: KMatrixSettings): Matrix source

Flip this matrix.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

Matrix after function processing.

public fliplr(): Matrix source

Flip this matrix left and right.

Return:

Matrix

Matrix after function processing.

public flipud(): Matrix source

Flip this matrix up and down.

Return:

Matrix

Matrix after function processing.

public floor(): Matrix source

Floor.

Override:

KonpeitoInteger#floor

Return:

Matrix

floor(A)

public fpdf(d1: KMatrixInputData, d2: KMatrixInputData): Matrix source

Probability density function (PDF) of F-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
d1 KMatrixInputData

The degree of freedom of the molecules.

d2 KMatrixInputData

The degree of freedom of the denominator

Return:

Matrix

public fract(): Matrix source

Fraction.

Override:

KonpeitoInteger#fract

Return:

Matrix

fract(A)

public gamcdf(k: KMatrixInputData, s: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of gamma distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

Shape parameter.

s KMatrixInputData

Scale parameter.

Return:

Matrix

public gaminv(k: KMatrixInputData, s: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of gamma distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

Shape parameter.

s KMatrixInputData

Scale parameter.

Return:

Matrix

public gamma(): Matrix source

Gamma function.

  • Calculate from real values.

Return:

Matrix

public gammainc(a: KMatrixInputData, tail: string): Matrix source

Incomplete gamma function.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
a KMatrixInputData
tail string
  • optional
  • default: "lower"

lower (default) , "upper"

Return:

Matrix

public gammaln(): Matrix source

Log-gamma function.

  • Calculate from real values.

Return:

Matrix

public gampdf(k: KMatrixInputData, s: KMatrixInputData): Matrix source

Probability density function (PDF) of the gamma distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

Shape parameter.

s KMatrixInputData

Scale parameter.

Return:

Matrix

public gcd(number: KMatrixInputData): Matrix source

Euclidean algorithm.

  • Calculated as an integer.

Override:

KonpeitoInteger#gcd

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

gcd(x, y)

public geomean(type: KMatrixSettings): Matrix source

Geometric mean.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public getComplex(row_or_pos: KMatrixInputData, col: KMatrixInputData): Complex source

Returns the specified element in the matrix. Each element of the matrix is composed of complex numbers.

Params:

NameTypeAttributeDescription
row_or_pos KMatrixInputData

If this is a matrix, the row number. If this is a vector, the address.

col KMatrixInputData
  • optional

If this is a matrix, the column number.

Return:

Complex

public getComplexMatrixArray(): Array<Array<Complex>> source

Complex array of complex numbers of each element of the matrix.

Return:

Array<Array<Complex>>

public getMatrix(row: KMatrixInputData, col: KMatrixInputData, isUpOffset: boolean): Matrix source

Extract the specified part of the matrix.

Params:

NameTypeAttributeDescription
row KMatrixInputData

A vector containing the row numbers to extract from this matrix. If you specify ":" select all rows.

col KMatrixInputData

A vector containing the column numbers to extract from this matrix. If you specify ":" select all columns.

isUpOffset boolean
  • optional
  • default: false

Set offset of matrix position to 1 with true.

Return:

Matrix

public getNumberMatrixArray(): Array<Array<number>> source

Array of real parts of elements in matrix.

Return:

Array<Array<number>>

public idct(type: KMatrixSettings): Matrix source

Inverse discrete cosine transform (DCT-III, IDCT).

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

idct(x)

public idct2(): Matrix source

Inverse discrete two-dimensional cosine transform (2D IDCT).

Return:

Matrix

public ifft(type: KMatrixSettings): Matrix source

Inverse discrete Fourier transform (IDFT).

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

ifft(x)

public ifft2(): Matrix source

Inverse discrete two-dimensional Fourier transform (2D IDFT).

Return:

Matrix

public imag(): Matrix source

Imaginary part of each element of the matrix.

Return:

Matrix

imag(A)

public indexsort(v: KMatrixInputData): Matrix source

Index sort.

  • Sorts by row when setting index by row vector to the argument.
  • Sorts by column when setting index by column vector to the argument.

Params:

NameTypeAttributeDescription
v KMatrixInputData

Vector with index. (See the description of this function)

Return:

Matrix

Matrix after function processing.

public inner(number: KMatrixInputData, dimension: KMatrixInputData): Matrix source

Inner product/Dot product.

Params:

NameTypeAttributeDescription
number KMatrixInputData
dimension KMatrixInputData
  • optional
  • default: 1

Dimension of matrix used for calculation. (1 or 2)

Return:

Matrix

A・B

public inv(): Matrix source

Inverse matrix of this matrix.

  • Use dotinv if you want to use inv for each element.

Override:

KonpeitoInteger#inv

Return:

Matrix

A^-1

public isColumn(): boolean source

Return true if the matrix is column vector.

Return:

boolean

public isComplex(tolerance: KMatrixInputData): boolean source

Return true if the matrix is complex matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isComplexInteger(tolerance: KMatrixInputData): boolean source

Returns true if the vallue is complex integer (including normal integer).

  • Use only the first element.
  • Use testFinite if you want to test the elements of a matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

real(A) === integer && imag(A) === integer

public isDiagonal(tolerance: KMatrixInputData): boolean source

Return true if the matrix is diagonal matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isFinite(): boolean source

Return true if the value is finite number.

  • Use only the first element.
  • Use testFinite if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isFinite

Return:

boolean

!isNaN(A) && !isInfinite(A)

public isHermitian(tolerance: KMatrixInputData): boolean source

Return true if the matrix is hermitian matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isIdentity(tolerance: KMatrixInputData): boolean source

Return true if the matrix is identity matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isInfinite(): boolean source

this === Infinity or -Infinity

  • Use only the first element.
  • Use testInfinite if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isInfinite

Return:

boolean

isPositiveInfinity(A) || isNegativeInfinity(A)

public isInteger(tolerance: KMatrixInputData): boolean source

Return true if the value is integer.

  • Use only the first element.
  • Use testFinite if you want to test the elements of a matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isMatrix(): boolean source

Return true if the value is not scalar.

Return:

boolean

public isNaN(): boolean source

this === NaN

  • Use only the first element.
  • Use testNaN if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isNaN

Return:

boolean

isNaN(A)

public isNegative(): boolean source

this < 0

  • Use only the first element.
  • Use testNegative if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isNegative

Return:

boolean

public isNegativeInfinity(): boolean source

this === -Infinity

  • Use only the first element.
  • Use testNegativeInfinity if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isNegativeInfinity

Return:

boolean

isNegativeInfinity(A)

public isNotNegative(): boolean source

this >= 0

  • Use only the first element.
  • Use testNotNegative if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isNotNegative

Return:

boolean

public isOne(tolerance: KMatrixInputData): boolean source

this === 1

  • Use only the first element.
  • Use testOne if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isOne

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isOrthogonal(tolerance: KMatrixInputData): boolean source

Return true if the matrix is orthogonal matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isPermutation(tolerance: KMatrixInputData): boolean source

Return true if the matrix is permutation matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isPositive(): boolean source

this > 0

  • Use only the first element.
  • Use testPositive if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isPositive

Return:

boolean

public isPositiveInfinity(): boolean source

this === Infinity

  • Use only the first element.
  • Use testPositiveInfinity if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isPositiveInfinity

Return:

boolean

isPositiveInfinity(A)

public isPrime(): boolean source

Return true if the value is prime number.

  • Calculated as an integer.
  • Calculate up to 2251799813685248(=2^51).
  • Use only the first element.
  • Use testPrime if you want to test the elements of a matrix.

Override:

KonpeitoInteger#isPrime

Return:

boolean

If the calculation range is exceeded, null is returned.

public isProbablePrime(certainty: KMatrixInputData): boolean source

Return true if the value is prime number by Miller-Labin prime number determination method.

  • Use only the first element.
  • Use testProbablePrime if you want to test the elements of a matrix.

Attention : it takes a very long time to process.

  • Calculated as an integer.

Override:

KonpeitoInteger#isProbablePrime

Params:

NameTypeAttributeDescription
certainty KMatrixInputData
  • optional
  • default: 100

Repeat count (prime precision).

Return:

boolean

public isReal(tolerance: KMatrixInputData): boolean source

Return true if the matrix is real matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isRegular(tolerance: KMatrixInputData): boolean source

Return true if the matrix is regular matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isRow(): boolean source

Return true if the matrix is row vector.

Return:

boolean

public isScalar(): boolean source

Return true if the matrix is scalar.

Return:

boolean

public isSquare(): boolean source

Return true if the matrix is square matrix.

Return:

boolean

public isSymmetric(tolerance: KMatrixInputData): boolean source

Return true if the matrix is symmetric matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isTriangleLower(tolerance: KMatrixInputData): boolean source

Return true if the matrix is lower triangular matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isTriangleUpper(tolerance: KMatrixInputData): boolean source

Return true if the matrix is upper triangular matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isTridiagonal(tolerance: KMatrixInputData): boolean source

Return true if the matrix is tridiagonal matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isUnitary(tolerance: KMatrixInputData): boolean source

Return true if the matrix is unitary matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isVector(): boolean source

Return true if the matrix is vector.

Return:

boolean

public isZero(tolerance: KMatrixInputData): boolean source

this === 0

  • Use only the first element.
  • Use testZero if you want to test the elements of a matrix.
  • Use isZeros to check for a zero matrix.

Override:

KonpeitoInteger#isZero

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public isZeros(tolerance: KMatrixInputData): boolean source

Return true if the matrix is zero matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

boolean

public lcm(number: KMatrixInputData): Matrix source

Least common multiple.

  • Calculated as an integer.

Override:

KonpeitoInteger#lcm

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

lcm(x, y)

public linsolve(number: KMatrixInputData): Matrix source

Solving a system of linear equations to be Ax = B

Params:

NameTypeAttributeDescription
number KMatrixInputData

B

Return:

Matrix

x

public log(): Matrix source

Logarithmic function.

Override:

KonpeitoFloat#log

Return:

Matrix

log(A)

public log10(): Matrix source

log_10(x)

Override:

KonpeitoFloat#log10

Return:

Matrix

log10(A)

public log1p(): Matrix source

ln(1 + x)

Override:

KonpeitoFloat#log1p

Return:

Matrix

log1p(A)

public log2(): Matrix source

log_2(x)

Override:

KonpeitoFloat#log2

Return:

Matrix

log2(A)

public logit(): Matrix source

Logit function.

Override:

KonpeitoFloat#logit

Return:

Matrix

logit(A)

public lu(): {L: Matrix, U: Matrix} source

LU decomposition.

  • L*U=A
  • L is lower triangular matrix.
  • U is upper triangular matrix.

Return:

{L: Matrix, U: Matrix}

{L, U}

public lup(): {P: Matrix, L: Matrix, U: Matrix} source

LUP decomposition.

  • P'LU=A
  • P is permutation matrix.
  • L is lower triangular matrix.
  • U is upper triangular matrix.

Return:

{P: Matrix, L: Matrix, U: Matrix}

{L, U, P}

public mad(algorithm: string | ?number, type: KMatrixSettings): Matrix source

Mean absolute deviation.

  • The "algorithm" can choose "0/mean"(default) and "1/median".

Params:

NameTypeAttributeDescription
algorithm string | ?number
  • optional
  • nullable: true
type KMatrixSettings
  • optional

Return:

Matrix

public max(type: KMatrixSettings): Matrix source

Maximum number.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

max([A, B])

public mean(type: KMatrixSettings): Matrix source

Arithmetic average.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public median(type: KMatrixSettings): Matrix source

Median.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public min(type: KMatrixSettings): Matrix source

Minimum number.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

min([A, B])

public mod(number: KMatrixInputData): Matrix source

Modulo, positive remainder of division for each element of matrix.

  • Result has same sign as the Divisor.

Override:

KonpeitoInteger#mod

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .mod B

public modInverse(m: KMatrixInputData): Matrix source

Modular multiplicative inverse.

  • Calculated as an integer.

Override:

KonpeitoInteger#modInverse

Params:

NameTypeAttributeDescription
m KMatrixInputData

Return:

Matrix

A^(-1) mod m

public modPow(exponent: KMatrixInputData, m: KMatrixInputData): Matrix source

Modular exponentiation.

  • Calculated as an integer.

Override:

KonpeitoInteger#modPow

Params:

NameTypeAttributeDescription
exponent KMatrixInputData
m KMatrixInputData

Return:

Matrix

A^B mod m

public mode(type: KMatrixSettings): Matrix source

Mode.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public moment(nth_order: number, type: KMatrixSettings): Matrix source

Moment.

  • Moment of order n. Equivalent to the definition of variance at 2.

Params:

NameTypeAttributeDescription
nth_order number
type KMatrixSettings
  • optional

Return:

Matrix

public mul(number: KMatrixInputData): Matrix source

Multiply.

  • Use dotmul if you want to use mul for each element.

Override:

KonpeitoInteger#mul

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A * B

public multiply(number: KMatrixInputData): Matrix source

Multiply.

Override:

KonpeitoInteger#multiply

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A * B

public nchoosek(k: KMatrixInputData): Matrix source

Binomial coefficient, number of all combinations, nCk.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
k KMatrixInputData

Return:

Matrix

public ndiv(number: KMatrixInputData): Matrix source

this method was deprecated. use the dotdiv.

Division for each element of matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A ./ B

public negate(): Matrix source

this * -1

Override:

KonpeitoInteger#negate

Return:

Matrix

A

public nextProbablePrime(certainty: KMatrixInputData, search_max: KMatrixInputData): Matrix source

Next prime.

Override:

KonpeitoInteger#nextProbablePrime

Params:

NameTypeAttributeDescription
certainty KMatrixInputData
  • optional
  • default: 100

Repeat count (prime precision).

search_max KMatrixInputData
  • optional
  • default: 100000

Search range of next prime.

Return:

Matrix

public ninv(): Matrix source

this method was deprecated. use the dotinv.

Inverse of each element of matrix.

Return:

Matrix

1 ./ A

public nmul(number: KMatrixInputData): Matrix source

this method was deprecated. use the dotmul.

Multiplication for each element of matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .* B

public norm(p: KMatrixInputData): number source

p-norm.

Params:

NameTypeAttributeDescription
p KMatrixInputData
  • optional
  • default: 2

Return:

number

public normcdf(u: KMatrixInputData, s: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of normal distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
u KMatrixInputData
  • optional
  • default: 0.0

Average value.

s KMatrixInputData
  • optional
  • default: 1.0

Variance value.

Return:

Matrix

public norminv(u: KMatrixInputData, s: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of normal distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
u KMatrixInputData
  • optional
  • default: 0.0

Average value.

s KMatrixInputData
  • optional
  • default: 1.0

Variance value.

Return:

Matrix

public normpdf(u: KMatrixInputData, s: KMatrixInputData): Matrix source

Probability density function (PDF) of normal distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
u KMatrixInputData
  • optional
  • default: 0.0

Average value.

s KMatrixInputData
  • optional
  • default: 1.0

Variance value.

Return:

Matrix

public not(): Matrix source

Logical Not. (mutable)

  • Calculated as an integer.

Override:

KonpeitoInteger#not

Return:

Matrix

!A

public npow(number: KMatrixInputData): Matrix source

this method was deprecated. use the dotpow.

Power function for each element of the matrix.

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .^ B

public or(number: KMatrixInputData): Matrix source

Logical OR.

  • Calculated as an integer.

Override:

KonpeitoInteger#or

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A | B

public pinv(): Matrix source

Pseudo-inverse matrix.

Return:

Matrix

A^+

public poisscdf(lambda: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of Poisson distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
lambda KMatrixInputData

Return:

Matrix

public poissinv(lambda: KMatrixInputData): Matrix source

Inverse function of cumulative distribution function (CDF) of Poisson distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
lambda KMatrixInputData

Return:

Matrix

public poisspdf(lambda: KMatrixInputData): Matrix source

Probability density function (PDF) of Poisson distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
lambda KMatrixInputData

Return:

Matrix

public pow(number: KMatrixInputData): Matrix source

Power function.

  • Unless the matrix is a scalar value, only integers are supported.
  • Use dotpow if you want to use pow for each element. A real number can be specified.

Override:

KonpeitoInteger#pow

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

pow(A, B)

public powerfft(type: KMatrixSettings): Matrix source

Power spectral density.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

abs(fft(x)).^2

public prod(type: KMatrixSettings): Matrix source

Product of array elements.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public qr(): {Q: Matrix, R: Matrix} source

QR decomposition.

  • Q*R=A
  • Q is orthonormal matrix.
  • R is upper triangular matrix.

Return:

{Q: Matrix, R: Matrix}

{Q, R}

public rank(tolerance: KMatrixInputData): number source

Rank.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

number

rank(A)

public rcond(): number source

Inverse condition number.

Return:

number

public real(): Matrix source

Real part of each element.

Return:

Matrix

real(A)

public rem(number: KMatrixInputData): Matrix source

Modulo, positive remainder of division for each element of matrix.

  • Result has same sign as the Dividend.

Override:

KonpeitoInteger#rem

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A .rem B

public remainder(number: KMatrixInputData): Matrix source

Remainder of division.

  • Result has same sign as the Dividend.

Override:

KonpeitoInteger#remainder

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A % B

public reshape(row_length: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Change the shape of the matrix. The number of elements in the matrix doesn't increase or decrease.

Params:

NameTypeAttributeDescription
row_length KMatrixInputData

Number of rows of matrix to reshape.

column_length KMatrixInputData

Number of columns of matrix to reshape.

Return:

Matrix

Matrix after function processing.

public resize(row_length: KMatrixInputData, column_length: KMatrixInputData): Matrix source

Change the size of the matrix. Initialized with 0 when expanding.

Params:

NameTypeAttributeDescription
row_length KMatrixInputData

Number of rows of matrix to resize.

column_length KMatrixInputData

Number of columns of matrix to resize.

Return:

Matrix

Matrix after function processing.

public roll(shift_size: KMatrixInputData, type: KMatrixSettings): Matrix source

Circular shift.

Params:

NameTypeAttributeDescription
shift_size KMatrixInputData
type KMatrixSettings
  • optional

Return:

Matrix

Matrix after function processing.

public rot90(rot_90_count: KMatrixInputData): Matrix source

Rotate matrix 90 degrees clockwise.

Params:

NameTypeAttributeDescription
rot_90_count KMatrixInputData

Number of times rotated by 90 degrees.

Return:

Matrix

Matrix after function processing.

public round(): Matrix source

Rounding to the nearest integer.

Override:

KonpeitoInteger#round

Return:

Matrix

round(A)

public rsqrt(): Matrix source

Reciprocal square root.

Override:

KonpeitoFloat#rsqrt

Return:

Matrix

rsqrt(A)

public scaleByPowerOfTen(n: KMatrixInputData): Matrix source

Multiply a multiple of ten.

Override:

KonpeitoInteger#scaleByPowerOfTen

Params:

NameTypeAttributeDescription
n KMatrixInputData

Return:

Matrix

x * 10^n

public sec(): Matrix source

Secant function.

Override:

KonpeitoFloat#sec

Return:

Matrix

sec(A)

public sech(): Matrix source

Hyperbolic secant function.

Override:

KonpeitoFloat#sech

Return:

Matrix

sech(A)

public setMatrix(row: KMatrixInputData, col: KMatrixInputData, replace: KMatrixInputData, isUpOffset: boolean): Matrix source

Change specified element in matrix.

Params:

NameTypeAttributeDescription
row KMatrixInputData

A vector containing the row numbers to replace in this matrix. If you specify ":" select all rows.

col KMatrixInputData

A vector containing the column numbers to replace in this matrix. If you specify ":" select all columns.

replace KMatrixInputData

Matrix to be replaced.

isUpOffset boolean
  • optional
  • default: false

Set offset of matrix position to 1 with true.

Return:

Matrix

public shift(n: KMatrixInputData): Matrix source

this << n

  • Calculated as an integer.

Override:

KonpeitoInteger#shift

Params:

NameTypeAttributeDescription
n KMatrixInputData

Return:

Matrix

A << n

public sign(): Matrix source

The positive or negative signs of each element of the matrix.

  • +1 if positive, -1 if negative, 0 if 0, norm if complex number.

Override:

KonpeitoInteger#sign

Return:

Matrix

public signum(): Matrix source

The positive or negative sign of this number.

  • +1 if positive, -1 if negative, 0 if 0.

Override:

KonpeitoInteger#signum

Return:

Matrix

public sin(): Matrix source

Sine function.

Override:

KonpeitoFloat#sin

Return:

Matrix

sin(A)

public sinc(): Matrix source

Normalized sinc function.

Override:

KonpeitoFloat#sinc

Return:

Matrix

sinc(A)

public sinh(): Matrix source

Hyperbolic sine function.

Override:

KonpeitoFloat#sinh

Return:

Matrix

sinh(A)

public size(dimension: string | ?number): Matrix source

Number of rows and columns of matrix.

Params:

NameTypeAttributeDescription
dimension string | ?number
  • optional
  • nullable: true

direction. 1/"row", 2/"column"

Return:

Matrix

[row_length, column_length]

public skewness(type: KMatrixSettings): Matrix source

Skewness.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public sort(order: string, type: KMatrixSettings): Matrix source

Sort.

  • The "order" can choose "ascend"(default) and "descend".

Params:

NameTypeAttributeDescription
order string
  • optional
type KMatrixSettings
  • optional

Return:

Matrix

public sqrt(): Matrix source

Square root.

Override:

KonpeitoFloat#sqrt

Return:

Matrix

sqrt(A)

public square(): Matrix source

Square.

  • Unless the matrix is a scalar value, only integers are supported.

Override:

KonpeitoInteger#square

Return:

Matrix

pow(A, 2)

public standardization(type: KMatrixSettings): Matrix source

The samples are standardize to a mean value of 0, standard deviation of 1.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public std(type: KMatrixSettings): Matrix source

Standard deviation.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public sub(number: KMatrixInputData): Matrix source

Subtract.

Override:

KonpeitoInteger#sub

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A - B

public subtract(number: KMatrixInputData): Matrix source

Subtract.

Override:

KonpeitoInteger#subtract

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A - B

public sum(type: KMatrixSettings): Matrix source

Sum.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public svd(): {U: Matrix, S: Matrix, V: Matrix} source

Singular Value Decomposition (SVD).

  • USV'=A
  • U and V are orthonormal matrices.
  • S is a matrix with singular values in the diagonal.

Return:

{U: Matrix, S: Matrix, V: Matrix}

USV'=A

public tan(): Matrix source

Tangent function.

Override:

KonpeitoFloat#tan

Return:

Matrix

tan(A)

public tanh(): Matrix source

Hyperbolic tangent function.

Override:

KonpeitoFloat#tanh

Return:

Matrix

tanh(A)

public tcdf(v: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of Student's t-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
v KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public tdist(v: KMatrixInputData, tails: KMatrixInputData): Matrix source

Cumulative distribution function (CDF) of Student's t-distribution that can specify tail.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
v KMatrixInputData

The degrees of freedom. (DF)

tails KMatrixInputData

Tail. (1 = the one-tailed distribution, 2 = the two-tailed distribution.)

Return:

Matrix

public testComplex(tolerance: KMatrixInputData): Matrix source

Test if each element of the matrix is complex.

  • 1 if true, 0 if false.
  • Use isComplex to test whether a matrix contains complex numbers.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testComplexInteger(tolerance: KMatrixInputData): Matrix source

Test if each element of the matrix is complex integer.

  • 1 if true, 0 if false.
  • Use isComplexInteger if you want to test first element.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testFinite(): Matrix source

Test if each element of the matrix is finite.

  • 1 if true, 0 if false.
  • Use isFinite if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testInfinite(): Matrix source

Test if each element of the matrix is infinite.

  • 1 if true, 0 if false.
  • Use isInfinite if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testInteger(tolerance: KMatrixInputData): Matrix source

Test if each element of the matrix is integer.

  • 1 if true, 0 if false.
  • Use isInteger if you want to test first element.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testNaN(): Matrix source

Test if each element of the matrix is NaN.

  • 1 if true, 0 if false.
  • Use isNaN if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testNegative(): Matrix source

real(this) < 0

  • 1 if true, 0 if false.
  • Use isNegative if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testNegativeInfinity(): Matrix source

Test if each element of the matrix is negative infinite.

  • 1 if true, 0 if false.
  • Use isNegativeInfinity if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testNotNegative(): Matrix source

real(this) >= 0

  • 1 if true, 0 if false.
  • Use isNotNegative if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testOne(tolerance: KMatrixInputData): Matrix source

real(this) === 1

  • 1 if true, 0 if false.
  • Use isOne if you want to test first element.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testPositive(): Matrix source

real(this) > 0

  • 1 if true, 0 if false.
  • Use isPositive if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testPositiveInfinity(): Matrix source

Test if each element of the matrix is positive infinite.

  • 1 if true, 0 if false.
  • Use isPositiveInfinity if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testPrime(): Matrix source

Test if each element of the matrix is prime number.

  • 1 if true, 0 if false.
  • Calculated as an integer.
  • Calculate up to 2251799813685248(=2^51).
  • Use isPrime if you want to test first element.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testProbablePrime(certainty: KMatrixInputData): Matrix source

Test if each element of the matrix is prime number by Miller-Labin prime number determination method.

  • 1 if true, 0 if false.
  • Use isProbablePrime if you want to test first element.

Attention : it takes a very long time to process.

  • Calculated as an integer.

Params:

NameTypeAttributeDescription
certainty KMatrixInputData
  • optional
  • default: 100

Repeat count (prime precision).

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testReal(tolerance: KMatrixInputData): Matrix source

Test if each element of the matrix is real.

  • 1 if true, 0 if false.
  • Use isReal to test for complex numbers in matrices.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public testZero(tolerance: KMatrixInputData): Matrix source

real(this) === 0

  • 1 if true, 0 if false.
  • Use isZero if you want to test first element.
  • Use isZeros to check for a zero matrix.

Params:

NameTypeAttributeDescription
tolerance KMatrixInputData
  • optional

Calculation tolerance of calculation.

Return:

Matrix

Matrix with elements of the numerical value of 1 or 0.

public tinv(v: KMatrixInputData): Matrix source

Inverse of cumulative distribution function (CDF) of Student's t-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
v KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public tinv2(v: KMatrixInputData): Matrix source

Inverse of cumulative distribution function (CDF) of Student's t-distribution in two-sided test.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
v KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public toBigDecimal(mc: MathContext): BigDecimal source

return BigDecimal.

Override:

KonpeitoInteger#toBigDecimal

Params:

NameTypeAttributeDescription
mc MathContext
  • optional

MathContext setting after calculation.

Return:

BigDecimal

public toBigInteger(): BigInteger source

return BigInteger.

Override:

KonpeitoInteger#toBigInteger

Return:

BigInteger

public toComplex(): Complex source

return Complex.

Override:

KonpeitoInteger#toComplex

Return:

Complex

public toFraction(): Fraction source

return Fraction.

Override:

KonpeitoInteger#toFraction

Return:

Fraction

public toJSON(): string source

Convert to JSON.

Override:

KonpeitoInteger#toJSON

Return:

string

public toMatrix(): Matrix source

return Matrix.

Override:

KonpeitoInteger#toMatrix

Return:

Matrix

public toOneLineString(): string source

Convert to string in one line.

Return:

string

public toString(): string source

Convert to string.

Override:

KonpeitoInteger#toString

Return:

string

public tpdf(v: KMatrixInputData): Matrix source

Probability density function (PDF) of Student's t-distribution.

  • Calculate from real values.

Params:

NameTypeAttributeDescription
v KMatrixInputData

The degrees of freedom. (DF)

Return:

Matrix

public trace(): Complex source

Trace of a matrix. Sum of diagonal elements.

Return:

Complex

trace(A)

public transpose(): Matrix source

Transpose a matrix.

Return:

Matrix

A^T

public tridiagonalize(): {P: Matrix, H: Matrix} source

Tridiagonalization of symmetric matrix.

  • Don't support complex numbers.
  • PHP'=A
  • P is orthonormal matrix.
  • H is tridiagonal matrix.
  • The eigenvalues of H match the eigenvalues of A.

Return:

{P: Matrix, H: Matrix}

{P, H}

public trunc(): Matrix source

To integer rounded down to the nearest.

Return:

Matrix

fix(A), trunc(A)

public var(type: KMatrixSettings): Matrix source

Variance.

Params:

NameTypeAttributeDescription
type KMatrixSettings
  • optional

Return:

Matrix

public xcorr(number: KMatrixInputData): Matrix source

ACF(Autocorrelation function), cros-correlation function.

  • If the argument is omitted, it is calculated by the autocorrelation function.

Params:

NameTypeAttributeDescription
number KMatrixInputData
  • optional

Matrix to calculate the correlation.

Return:

Matrix

public xor(number: KMatrixInputData): Matrix source

Logical Exclusive-OR.

  • Calculated as an integer.

Override:

KonpeitoInteger#xor

Params:

NameTypeAttributeDescription
number KMatrixInputData

Return:

Matrix

A ^ B

Private Methods

private _clearCash() source

Delete cache.

private _concatBottom(bottom_matrix: KMatrixInputData): Matrix source

Combine matrix to the bottom of this matrix. (mutable)

Params:

NameTypeAttributeDescription
bottom_matrix KMatrixInputData

Matrix to combine.

Return:

Matrix

Matrix after function processing. (this)

private _deleteColumn(delete_column_index: KMatrixInputData): Matrix source

Remove the column in this matrix. (mutable)

Params:

NameTypeAttributeDescription
delete_column_index KMatrixInputData

Number of column of matrix to delete.

Return:

Matrix

Matrix after function processing. (this)

private _deleteRow(delete_row_index: KMatrixInputData): Matrix source

Remove the row in this matrix. (mutable)

Params:

NameTypeAttributeDescription
delete_row_index KMatrixInputData

Number of row of matrix to delete.

Return:

Matrix

Matrix after function processing. (this)

private _rot90(rot_90_count: KMatrixInputData): Matrix source

Rotate matrix 90 degrees clockwise. (mutable)

Params:

NameTypeAttributeDescription
rot_90_count KMatrixInputData

Number of times rotated by 90 degrees.

Return:

Matrix

Matrix after function processing. (this)