Utils

object Utils
class Object
trait Matchable
class Any

Value members

Concrete methods

def aa2bdm(a: Array[Array[Double]]): DenseMatrix[Double]

Array[Array] to Breeze DenseMatrix conversion

Array[Array] to Breeze DenseMatrix conversion

Useful for unpacking matrices which have come back to Scala from R via rscala

Value Params
a

A matrix represented as an array of arrays (row-major)

Returns

A Breeze DenseMatrix representation of the matrix

def backSolve(A: DenseMatrix[Double], y: DenseVector[Double]): DenseVector[Double]

Backsolve an upper-triangular linear system with a single RHS

Backsolve an upper-triangular linear system with a single RHS

Value Params
A

An upper-triangular matrix

y

A single vector RHS

Returns

The solution, x, of the linear system A x = y

def backSolve(A: DenseMatrix[Double], Y: DenseMatrix[Double]): DenseMatrix[Double]

Backsolve an upper-triangular linear system with multiple RHSs

Backsolve an upper-triangular linear system with multiple RHSs

Value Params
A

An upper-triangular matrix

Y

A matrix with columns corresponding to RHSs

Returns

Matrix of solutions, X, to the linear system A X = Y

def bdm2aa(m: DenseMatrix[Double]): Array[Array[Double]]

Breeze DenseMatrix to Array[Array] conversion

Breeze DenseMatrix to Array[Array] conversion

Useful for sending matrices to R via rscala

Value Params
m

A Breeze DenseMatrix

Returns

The matrix as an array of arrays (row-major)

def dct(x: DenseVector[Double]): DenseVector[Double]

Discrete cosine transform (DCT) of a DenseVector

Discrete cosine transform (DCT) of a DenseVector

Normalised by a factor of 2/N

Value Params
x

An input vector

Returns

The normalised DCT-II of the input

def dct2(X: DenseMatrix[Double], inverse: Boolean): DenseMatrix[Double]

Discrete cosine transform (DCT) of a DenseMatrix

Discrete cosine transform (DCT) of a DenseMatrix

DCT applied to rows and columns

Value Params
X

An input matrix

inverse

Inverse or forward transform. Defaults to false

Returns

The normalised DCT-II of the input

def fCDF(x: Double, d1: Double, d2: Double): Double

The CDF of the f-distribution

The CDF of the f-distribution

def forwardSolve(A: DenseMatrix[Double], y: DenseVector[Double]): DenseVector[Double]

Forward solve a lower-triangular linear system with a single RHS

Forward solve a lower-triangular linear system with a single RHS

Value Params
A

A lower-triangular matrix

y

A single vector RHS

Returns

The solution, x, of the linear system A x = y

def idct(x: DenseVector[Double]): DenseVector[Double]

Inverse discrete cosine transform (DCT) of a DenseVector

Inverse discrete cosine transform (DCT) of a DenseVector

Exactly inverts dct

Value Params
x

An input vector containing a transform

Returns

The (unnormalised) DCT-III of the input

def idct2(x: DenseMatrix[Double]): DenseMatrix[Double]

dct2(x, true)

dct2(x, true)

def pairs(mat: DenseMatrix[Double], names: Seq[String]): Figure

pairs plot

pairs plot

Value Params
mat

a matrix with variables in columns and observations in rows

names

a sequence of variable names

Returns

The breeze-viz Figure object

def pairs(mat: DenseMatrix[Double]): Figure

pairs plot (for unlabeled variables)

pairs plot (for unlabeled variables)

Value Params
mat

a matrix with variables in columns and observations in rows

Returns

The breeze-viz Figure object

def tCDF(t: Double, df: Double): Double

The CDF of the t-distribution

The CDF of the t-distribution

def time[A](f: => A): A

A very simple function for timing computations - not for general use

A very simple function for timing computations - not for general use