smile.math

package smile.math

Mathematical and statistical functions.

Attributes

Members list

Packages

Distance functions.

Distance functions.

Attributes

Type members

Classlikes

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait MatrixExpression

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class MatrixLift(A: Matrix) extends MatrixExpression

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
class MatrixOrderOptimization(dims: Array[Int]) extends LazyLogging

Optimizes the order of matrix multiplication chain. Matrix multiplication is associative. However, the complexity of matrix multiplication chain is not associative.

Optimizes the order of matrix multiplication chain. Matrix multiplication is associative. However, the complexity of matrix multiplication chain is not associative.

Value parameters

dims

Matrix A[i] has dimension dims[i-1] x dims[i] for i = 1..n

Attributes

Supertypes
trait LazyLogging
class Object
trait Matchable
class Any

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Slice(start: Int, end: Int, step: Int)

Python like slicing.

Python like slicing.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait VectorExpression

Vector Expression.

Vector Expression.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class VectorLift(x: Array[Double]) extends VectorExpression

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

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

Attributes

def chisqtest(x: Array[Int], prob: Array[Double], constraints: Int): ChiSqTest

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.

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.

Attributes

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

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.

Attributes

def chisqtest2(x: Array[Int], y: Array[Int], constraints: Int): ChiSqTest

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.

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.

Attributes

def cholesky(A: Array[Array[Double]]): Cholesky

Cholesky decomposition.

Cholesky decomposition.

Attributes

def cholesky(A: Matrix): Cholesky

Cholesky decomposition.

Cholesky decomposition.

Attributes

def cholesky(A: MatrixExpression): Cholesky

Cholesky decomposition.

Cholesky decomposition.

Attributes

def det(A: Matrix): Double

Returns the determinant of matrix.

Returns the determinant of matrix.

Attributes

Returns the determinant of matrix.

Returns the determinant of matrix.

Attributes

def diag(A: Matrix): Array[Double]

Returns the diagonal elements of matrix.

Returns the diagonal elements of matrix.

Attributes

def digamma(x: Double): Double

The digamma function is defined as the logarithmic derivative of the gamma function.

The digamma function is defined as the logarithmic derivative of the gamma function.

Attributes

def eig(A: Array[Array[Double]]): EVD

Returns eigen values.

Returns eigen values.

Attributes

def eig(A: Matrix): EVD

Returns eigen values.

Returns eigen values.

Attributes

def eig(A: MatrixExpression): EVD

Returns eigen values.

Returns eigen values.

Attributes

def eigen(A: Array[Array[Double]]): EVD

Eigen decomposition.

Eigen decomposition.

Attributes

def eigen(A: Matrix): EVD

Eigen decomposition.

Eigen decomposition.

Attributes

def eigen(A: MatrixExpression): EVD

Eigen decomposition.

Eigen decomposition.

Attributes

def eigen(A: IMatrix, k: Int): EVD

Returns k largest eigenvectors.

Returns k largest eigenvectors.

Attributes

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. It is defined as:

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.

Attributes

def erfc(x: Double): Double

The complementary error function.

The complementary error function.

Attributes

def erfcc(x: Double): Double

The complementary error function with fractional error everywhere less than 1.2 × 10-7. This concise routine is faster than erfc.

The complementary error function with fractional error everywhere less than 1.2 × 10-7. This concise routine is faster than erfc.

Attributes

def eye(n: Int): Matrix

Returns an n-by-n identity matrix.

Returns an n-by-n identity matrix.

Attributes

def eye(m: Int, n: Int): Matrix

Returns an m-by-n identity matrix.

Returns an m-by-n identity matrix.

Attributes

def ftest(x: Array[Double], y: Array[Double]): FTest

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.

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.

Attributes

def gamma(x: Double): Double

Gamma function. Lanczos approximation (6 terms).

Gamma function. Lanczos approximation (6 terms).

Attributes

def inv(A: Matrix): Matrix

Returns the inverse of matrix.

Returns the inverse of matrix.

Attributes

def inv(A: MatrixExpression): Matrix

Returns the inverse of matrix.

Returns the inverse of matrix.

Attributes

def inverf(p: Double): Double

The inverse error function.

The inverse error function.

Attributes

def inverfc(p: Double): Double

The inverse complementary error function.

The inverse complementary error function.

Attributes

def kendalltest(x: Array[Double], y: Array[Double]): CorTest

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.

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.

Attributes

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

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.

Attributes

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

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.

Attributes

def lgamma(x: Double): Double

log of the Gamma function. Lanczos approximation (6 terms)

log of the Gamma function. Lanczos approximation (6 terms)

Attributes

def lu(A: Array[Array[Double]]): LU

LU decomposition.

LU decomposition.

Attributes

def lu(A: Matrix): LU

LU decomposition.

LU decomposition.

Attributes

def lu(A: MatrixExpression): LU

LU decomposition.

LU decomposition.

Attributes

def ones(n: Int): Matrix

Returns an n-by-n matrix of all ones.

Returns an n-by-n matrix of all ones.

Attributes

def ones(m: Int, n: Int): Matrix

Returns an m-by-n matrix of all ones.

Returns an m-by-n matrix of all ones.

Attributes

def pearsontest(x: Array[Double], y: Array[Double]): CorTest

Pearson correlation coefficient test.

Pearson correlation coefficient test.

Attributes

def qr(A: Array[Array[Double]]): QR

QR decomposition.

QR decomposition.

Attributes

def qr(A: Matrix): QR

QR decomposition.

QR decomposition.

Attributes

def qr(A: MatrixExpression): QR

QR decomposition.

QR decomposition.

Attributes

def rand(m: Int, n: Int, lo: Double, hi: Double): Matrix

Returns an m-by-n matrix of uniform distributed random numbers.

Returns an m-by-n matrix of uniform distributed random numbers.

Attributes

def randn(m: Int, n: Int, mu: Double, sigma: Double): Matrix

Returns an m-by-n matrix of normally distributed random numbers.

Returns an m-by-n matrix of normally distributed random numbers.

Attributes

def rank(A: Matrix): Int

Returns the rank of matrix.

Returns the rank of matrix.

Attributes

Returns the rank of matrix.

Returns the rank of matrix.

Attributes

def spearmantest(x: Array[Double], y: Array[Double]): CorTest

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.

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.

Attributes

def svd(A: Array[Array[Double]]): SVD

SVD decomposition.

SVD decomposition.

Attributes

def svd(A: Matrix): SVD

SVD decomposition.

SVD decomposition.

Attributes

def svd(A: MatrixExpression): SVD

SVD decomposition.

SVD decomposition.

Attributes

def svd(A: IMatrix, k: Int): SVD

Returns k largest singular vectors.

Returns k largest singular vectors.

Attributes

def trace(A: Matrix): Double

Returns the trace of matrix.

Returns the trace of matrix.

Attributes

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. Small values of p-value indicate that the array has significantly different mean.

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.

Attributes

def ttest(x: Array[Double], y: Array[Double]): TTest

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.

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.

Attributes

def ttest2(x: Array[Double], y: Array[Double], equalVariance: Boolean): TTest

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.

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.

Value parameters

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.

Attributes

def zeros(n: Int): Matrix

Returns an n-by-n zero matrix.

Returns an n-by-n zero matrix.

Attributes

def zeros(m: Int, n: Int): Matrix

Returns an m-by-n zero matrix.

Returns an m-by-n zero matrix.

Attributes

Implicits

Implicits

implicit def array2Matrix(data: Array[Double]): Matrix
implicit def array2Matrix(data: Array[Array[Double]]): Matrix
implicit def matrix2MatrixExpression(x: Matrix): MatrixLift
implicit def matrixExpression2Array(exp: MatrixExpression): Matrix
implicit def matrixOps(matrix: Matrix): MatrixOps
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]