package math
Mathematical and statistical functions.
- Alphabetic
- By Inheritance
- math
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class AbsMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class AbsVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class AcosMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class AcosVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class AsinMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class AsinVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class AtanMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class AtanVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Ax(A: MatrixExpression, x: VectorExpression) extends VectorExpression with Product with Serializable
- case class CbrtMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class CbrtVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class CeilMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class CeilVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class ExpMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class ExpVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Expm1Matrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class Expm1Vector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class FloorMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class FloorVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Log10Matrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class Log10Vector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Log1pMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class Log1pVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Log2Matrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class Log2Vector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class LogMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class LogVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class MatrixAddMatrix(A: MatrixExpression, B: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class MatrixAddValue(A: MatrixExpression, x: Double) extends MatrixExpression with Product with Serializable
- case class MatrixDivMatrix(A: MatrixExpression, B: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class MatrixDivValue(A: MatrixExpression, x: Double) extends MatrixExpression with Product with Serializable
- sealed trait MatrixExpression extends AnyRef
- case class MatrixLift(A: Matrix) extends MatrixExpression with Product with Serializable
- case class MatrixMulMatrix(A: MatrixExpression, B: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class MatrixMulValue(A: MatrixExpression, x: Double) extends MatrixExpression with Product with Serializable
- case class MatrixMultiplication(A: MatrixExpression, B: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class MatrixMultiplicationChain(A: Seq[MatrixExpression]) extends MatrixExpression with Product with Serializable
- class MatrixOrderOptimization extends LazyLogging
Optimizes the order of matrix multiplication chain.
Optimizes the order of matrix multiplication chain. Matrix multiplication is associative. However, the complexity of matrix multiplication chain is not associative.
- case class MatrixSubMatrix(A: MatrixExpression, B: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class MatrixSubValue(A: MatrixExpression, x: Double) extends MatrixExpression with Product with Serializable
- case class MatrixTranspose(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class RoundMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class RoundVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class SinMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class SinVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class Slice(start: Int, end: Int, step: Int = 1) extends Product with Serializable
Python like slicing.
- case class SqrtMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class SqrtVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class TanMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class TanVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class TanhMatrix(A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class TanhVector(x: VectorExpression) extends VectorExpression with Product with Serializable
- case class ValueAddMatrix(x: Double, A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class ValueAddVector(y: Double, x: VectorExpression) extends VectorExpression with Product with Serializable
- case class ValueDivMatrix(x: Double, A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class ValueDivVector(y: Double, x: VectorExpression) extends VectorExpression with Product with Serializable
- case class ValueMulMatrix(x: Double, A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class ValueMulVector(y: Double, x: VectorExpression) extends VectorExpression with Product with Serializable
- case class ValueSubMatrix(x: Double, A: MatrixExpression) extends MatrixExpression with Product with Serializable
- case class ValueSubVector(y: Double, x: VectorExpression) extends VectorExpression with Product with Serializable
- case class VectorAddValue(x: VectorExpression, y: Double) extends VectorExpression with Product with Serializable
- case class VectorAddVector(x: VectorExpression, y: VectorExpression) extends VectorExpression with Product with Serializable
- case class VectorDivValue(x: VectorExpression, y: Double) extends VectorExpression with Product with Serializable
- case class VectorDivVector(x: VectorExpression, y: VectorExpression) extends VectorExpression with Product with Serializable
- sealed trait VectorExpression extends AnyRef
Vector Expression.
- case class VectorLift(x: Array[Double]) extends VectorExpression with Product with Serializable
- case class VectorMulValue(x: VectorExpression, y: Double) extends VectorExpression with Product with Serializable
- case class VectorMulVector(x: VectorExpression, y: VectorExpression) extends VectorExpression with Product with Serializable
- case class VectorSubValue(x: VectorExpression, y: Double) extends VectorExpression with Product with Serializable
- case class VectorSubVector(x: VectorExpression, y: VectorExpression) extends VectorExpression with Product with Serializable
Value Members
- def abs(x: MatrixExpression): AbsMatrix
- def abs(x: VectorExpression): AbsVector
- def acos(x: MatrixExpression): AcosMatrix
- def acos(x: VectorExpression): AcosVector
- implicit def array2Matrix(data: Array[Array[Double]]): Matrix
- implicit def array2Matrix(data: Array[Double]): Matrix
- implicit def array2VectorExpression(x: Array[Double]): VectorLift
- def asin(x: MatrixExpression): AsinMatrix
- def asin(x: VectorExpression): AsinVector
- def atan(x: MatrixExpression): AtanMatrix
- def atan(x: VectorExpression): AtanVector
- def beta(x: Double, y: Double): Double
The beta function, also called the Euler integral of the first kind.
The beta function, also called the Euler integral of the first kind.
B(x, y) = ∫01 tx-1 (1-t)y-1dt
for x, y > 0 and the integration is over [0,1].The beta function is symmetric, i.e. B(x,y) = B(y,x).
- def cbrt(x: MatrixExpression): CbrtMatrix
- def cbrt(x: VectorExpression): CbrtVector
- def ceil(x: MatrixExpression): CeilMatrix
- def ceil(x: VectorExpression): CeilVector
- def chisqtest(table: Array[Array[Int]]): ChiSqTest
Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence.
Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence. The rows of contingency table are labels by the values of one nominal variable, the columns are labels by the values of the other nominal variable, and whose entries are non-negative integers giving the number of observed events for each combination of row and column. Continuity correction will be applied when computing the test statistic for 2x2 tables: one half is subtracted from all |O-E| differences. The correlation coefficient is calculated as Cramer's V.
- def chisqtest(x: Array[Int], prob: Array[Double], constraints: Int = 1): ChiSqTest
One-sample chisq test.
One-sample chisq test. Given the array x containing the observed numbers of events, and an array prob containing the expected probabilities of events, and given the number of constraints (normally one), a small value of p-value indicates a significant difference between the distributions.
- def chisqtest2(x: Array[Int], y: Array[Int], constraints: Int = 1): ChiSqTest
Two-sample chisq test.
Two-sample chisq test. Given the arrays x and y, containing two sets of binned data, and given one constraint, a small value of p-value indicates a significant difference between two distributions.
- def cholesky(A: MatrixExpression): Cholesky
Cholesky decomposition.
- def cholesky(A: Matrix): Cholesky
Cholesky decomposition.
- def cholesky(A: Array[Array[Double]]): Cholesky
Cholesky decomposition.
- def det(A: MatrixExpression): Double
Returns the determinant of matrix.
- def det(A: Matrix): Double
Returns the determinant of matrix.
- def diag(A: Matrix): Array[Double]
Returns the diagonal elements of matrix.
- def digamma(x: Double): Double
The digamma function is defined as the logarithmic derivative of the gamma function.
- def eig(A: MatrixExpression): EVD
Returns eigen values.
- def eig(A: Matrix): EVD
Returns eigen values.
- def eig(A: Array[Array[Double]]): EVD
Returns eigen values.
- def eigen(A: IMatrix, k: Int): EVD
Returns k largest eigenvectors.
- def eigen(A: MatrixExpression): EVD
Eigen decomposition.
- def eigen(A: Matrix): EVD
Eigen decomposition.
- def eigen(A: Array[Array[Double]]): EVD
Eigen decomposition.
- def erf(x: Double): Double
The error function (also called the Gauss error function) is a special function of sigmoid shape which occurs in probability, statistics, materials science, and partial differential equations.
The error function (also called the Gauss error function) is a special function of sigmoid shape which occurs in probability, statistics, materials science, and partial differential equations. It is defined as:
erf(x) = ∫0x e-t2dt
The complementary error function, denoted erfc, is defined as erfc(x) = 1 - erf(x). The error function and complementary error function are special cases of the incomplete gamma function.
- def erfc(x: Double): Double
The complementary error function.
- def erfcc(x: Double): Double
The complementary error function with fractional error everywhere less than 1.2 × 10-7.
The complementary error function with fractional error everywhere less than 1.2 × 10-7. This concise routine is faster than erfc.
- def exp(x: MatrixExpression): ExpMatrix
- def exp(x: VectorExpression): ExpVector
- def expm1(x: MatrixExpression): Expm1Matrix
- def expm1(x: VectorExpression): Expm1Vector
- def eye(m: Int, n: Int): Matrix
Returns an m-by-n identity matrix.
- def eye(n: Int): Matrix
Returns an n-by-n identity matrix.
- def floor(x: MatrixExpression): FloorMatrix
- def floor(x: VectorExpression): FloorVector
- def ftest(x: Array[Double], y: Array[Double]): FTest
Test if the arrays x and y have significantly different variances.
Test if the arrays x and y have significantly different variances. Small values of p-value indicate that the two arrays have significantly different variances.
- def gamma(x: Double): Double
Gamma function.
Gamma function. Lanczos approximation (6 terms).
- def inv(A: MatrixExpression): Matrix
Returns the inverse of matrix.
- def inv(A: Matrix): Matrix
Returns the inverse of matrix.
- def inverf(p: Double): Double
The inverse error function.
- def inverfc(p: Double): Double
The inverse complementary error function.
- def kendalltest(x: Array[Double], y: Array[Double]): CorTest
Kendall rank correlation test.
Kendall rank correlation test. The Kendall Tau Rank Correlation Coefficient is used to measure the degree of correspondence between sets of rankings where the measures are not equidistant. It is used with non-parametric data. The p-value is calculated by approximation, which is good for n > 10.
- def kstest(x: Array[Double], y: Array[Double]): KSTest
The two-sample KS test for the null hypothesis that the data sets are drawn from the same distribution.
The two-sample KS test for the null hypothesis that the data sets are drawn from the same distribution. Small values of p-value show that the cumulative distribution function of x is significantly different from that of y. The arrays x and y are modified by being sorted into ascending order.
- def kstest(x: Array[Double], y: Distribution): KSTest
The one-sample KS test for the null hypothesis that the data set x is drawn from the given distribution.
The one-sample KS test for the null hypothesis that the data set x is drawn from the given distribution. Small values of p-value show that the cumulative distribution function of x is significantly different from the given distribution. The array x is modified by being sorted into ascending order.
- def lgamma(x: Double): Double
log of the Gamma function.
log of the Gamma function. Lanczos approximation (6 terms)
- def log(x: MatrixExpression): LogMatrix
- def log(x: VectorExpression): LogVector
- def log10(x: MatrixExpression): Log10Matrix
- def log10(x: VectorExpression): Log10Vector
- def log1p(x: MatrixExpression): Log1pMatrix
- def log1p(x: VectorExpression): Log1pVector
- def log2(x: MatrixExpression): Log2Matrix
- def log2(x: VectorExpression): Log2Vector
- def lu(A: MatrixExpression): LU
LU decomposition.
- def lu(A: Matrix): LU
LU decomposition.
- def lu(A: Array[Array[Double]]): LU
LU decomposition.
- implicit def matrix2MatrixExpression(x: Matrix): MatrixLift
- implicit def matrixExpression2Array(exp: MatrixExpression): Matrix
- implicit def matrixOps(matrix: Matrix): MatrixOps
- def ones(m: Int, n: Int): Matrix
Returns an m-by-n matrix of all ones.
- def ones(n: Int): Matrix
Returns an n-by-n matrix of all ones.
- def pearsontest(x: Array[Double], y: Array[Double]): CorTest
Pearson correlation coefficient test.
- implicit def pimpArray2D(data: Array[Array[Double]]): PimpedArray2D
- implicit def pimpDouble(x: Double): PimpedDouble
- implicit def pimpDoubleArray(data: Array[Double]): PimpedDoubleArray
- implicit def pimpInt(x: Int): PimpedInt
- implicit def pimpIntArray(data: Array[Int]): PimpedArray[Int]
- def qr(A: MatrixExpression): QR
QR decomposition.
- def qr(A: Matrix): QR
QR decomposition.
- def qr(A: Array[Array[Double]]): QR
QR decomposition.
- def rand(m: Int, n: Int, lo: Double = 0.0, hi: Double = 1.0): Matrix
Returns an m-by-n matrix of uniform distributed random numbers.
- def randn(m: Int, n: Int, mu: Double = 0.0, sigma: Double = 1.0): Matrix
Returns an m-by-n matrix of normally distributed random numbers.
- def rank(A: MatrixExpression): Int
Returns the rank of matrix.
- def rank(A: Matrix): Int
Returns the rank of matrix.
- def round(x: MatrixExpression): RoundMatrix
- def round(x: VectorExpression): RoundVector
- def sin(x: MatrixExpression): SinMatrix
- def sin(x: VectorExpression): SinVector
- def spearmantest(x: Array[Double], y: Array[Double]): CorTest
Spearman rank correlation coefficient test.
Spearman rank correlation coefficient test. The Spearman Rank Correlation Coefficient is a form of the Pearson coefficient with the data converted to rankings (ie. when variables are ordinal). It can be used when there is non-parametric data and hence Pearson cannot be used.
The raw scores are converted to ranks and the differences between the ranks of each observation on the two variables are calculated.
The p-value is calculated by approximation, which is good for n > 10.
- def sqrt(x: MatrixExpression): SqrtMatrix
- def sqrt(x: VectorExpression): SqrtVector
- def svd(A: IMatrix, k: Int): SVD
Returns k largest singular vectors.
- def svd(A: MatrixExpression): SVD
SVD decomposition.
- def svd(A: Matrix): SVD
SVD decomposition.
- def svd(A: Array[Array[Double]]): SVD
SVD decomposition.
- def tan(x: MatrixExpression): TanMatrix
- def tan(x: VectorExpression): TanVector
- def tanh(x: MatrixExpression): TanhMatrix
- def tanh(x: VectorExpression): TanhVector
- def trace(A: Matrix): Double
Returns the trace of matrix.
- def ttest(x: Array[Double], y: Array[Double]): TTest
Given the paired arrays x and y, test if they have significantly different means.
Given the paired arrays x and y, test if they have significantly different means. Small values of p-value indicate that the two arrays have significantly different means.
- def ttest(x: Array[Double], mean: Double): TTest
Independent one-sample t-test whether the mean of a normally distributed population has a value specified in a null hypothesis.
Independent one-sample t-test whether the mean of a normally distributed population has a value specified in a null hypothesis. Small values of p-value indicate that the array has significantly different mean.
- def ttest2(x: Array[Double], y: Array[Double], equalVariance: Boolean = false): TTest
Test if the arrays x and y have significantly different means.
Test if the arrays x and y have significantly different means. Small values of p-value indicate that the two arrays have significantly different means.
- equalVariance
true if the data arrays are assumed to be drawn from populations with the same true variance. Otherwise, The data arrays are allowed to be drawn from populations with unequal variances.
- implicit def vectorExpression2Array(exp: VectorExpression): Array[Double]
- def zeros(m: Int, n: Int): Matrix
Returns an m-by-n zero matrix.
- def zeros(n: Int): Matrix
Returns an n-by-n zero matrix.
Smile (Statistical Machine Intelligence and Learning Engine) is a fast and comprehensive machine learning, NLP, linear algebra, graph, interpolation, and visualization system in Java and Scala. With advanced data structures and algorithms, Smile delivers state-of-art performance.
Smile covers every aspect of machine learning, including classification, regression, clustering, association rule mining, feature selection, manifold learning, multidimensional scaling, genetic algorithms, missing value imputation, efficient nearest neighbor search, etc.