shared3p_matrix.sc

shared3p_matrix.sc

Module with functions for manipulating matrices and vectors (shared3p protection domain)

Functions:

borderingInverse

Function for finding the inverse of a matrix using bordering.

Detailed Description

D - shared3p protection domain

Supported types - float32 / float64

This function can only be applied to positive-definite Hermitian matrices.

Parameters

x

- matrix

returns the inverse of x

None

Function Overloads

D float32 borderingInverse(D float32[[2]] x)

D float64 borderingInverse(D float64[[2]] x)

cholesky

Function for finding the Cholesky decomposition of a matrix.

Detailed Description

D - shared3p protection domain

Supported types - float32 / float64

The Cholesky decomposition can only be applied to positive-definite Hermitian matrices.

Parameters

x

- matrix

returns matrix L such that x = L L^T

None

Function Overloads

D float32 cholesky(D float32[[2]] x)

D float64 cholesky(D float64[[2]] x)

choleskyInverse

Function for finding the inverse of a matrix using Cholesky decomposition.

Detailed Description

D - shared3p protection domain

Supported types - float32 / float64

This function can only be applied to positive-definite Hermitian matrices.

Parameters

x

- matrix

returns the inverse of x

None

Function Overloads

D float32 choleskyInverse(D float32[[2]] x)

D float64 choleskyInverse(D float64[[2]] x)

colSums

Function for summarizing the columns of a matrix.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

When adding boolean values, the numerical value of boolean is used

Parameters

mat

- a matrix of supported type

returns a vector with the sums of each column in the input matrix

None

Function Overloads

D uint colSums(D bool[[2]] mat)

D uint8 colSums(D uint8[[2]] mat)

D uint16 colSums(D uint16[[2]] mat)

D uint32 colSums(D uint32[[2]] mat)

D uint colSums(D uint[[2]] mat)

D int8 colSums(D int8[[2]] mat)

D int16 colSums(D int16[[2]] mat)

D int32 colSums(D int32[[2]] mat)

D int colSums(D int[[2]] mat)

D float32 colSums(D float32[[2]] mat)

D float64 colSums(D float64[[2]] mat)

D fix32 colSums(D fix32[[2]] mat)

D fix64 colSums(D fix64[[2]] mat)

rowSums

Function for summarizing the rows of a matrix.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

When adding boolean values, the numerical value of boolean is used

Parameters

mat

- a matrix of supported type

returns a vector with the sums of each row in the input matrix

None

Function Overloads

D uint rowSums(D bool[[2]] mat)

D uint8 rowSums(D uint8[[2]] mat)

D uint16 rowSums(D uint16[[2]] mat)

D uint32 rowSums(D uint32[[2]] mat)

D uint rowSums(D uint[[2]] mat)

D int8 rowSums(D int8[[2]] mat)

D int16 rowSums(D int16[[2]] mat)

D int32 rowSums(D int32[[2]] mat)

D int rowSums(D int[[2]] mat)

D float32 rowSums(D float32[[2]] mat)

D float64 rowSums(D float64[[2]] mat)

D fix32 rowSums(D fix32[[2]] mat)

D fix64 rowSums(D fix64[[2]] mat)

transpose

Function for transposing matrices.

Detailed Description

D - shared3p protection domain

T - any data type

Parameters

mat

- a 2-dimensional matrix

returns the transposed version of the input matrix

None

Function Overloads

D T transpose(D T[[2]] X)

unitVector

Function for finding the unit vector of the input vector.

Detailed Description

D - shared3p protection domain

Supported types - float32 / float64

Function Overloads

D float32 unitVector(D float32[[1]] x)

Parameters

x

- vector of supported type

returns the unit vector for the input vector

D float64 unitVector(D float64[[1]] x)

Parameters

x

- vector of supported type

returns the unit vector for the input vector

D float32 unitVector(D float32[[2]] x)

Parameters

x

- matrix of supported type

returns a matrix with the unit vector of each row in the input matrix

D float64 unitVector(D float64[[2]] x)

Parameters

x

- matrix of supported type

returns a matrix with the unit vector of each row in the input matrix

vecLength

Function for finding the length of a vector.

Detailed Description

D - shared3p protection domain

Supported types - float32 / float64

None

Function Overloads

D float32 vecLength(D float32[[1]] x)

Parameters

x

- vector of supported type

returns the length of the vector

D float64 vecLength(D float64[[1]] x)

Parameters

x

- vector of supported type

returns the length of the vector

D float32 vecLength(D float32[[2]] x)

Parameters

x

- matrix of supported type

returns a vector with length of each row in the matrix

D float64 vecLength(D float64[[2]] x)

Parameters

x

- matrix of supported type

returns a vector with length of each row in the matrix

crossProduct

Function for finding the cross product of two vectors/matrices.

Functions:

D - shared3p protection domain

Supported types - int8 / int16 / int32 / int / float32 / float64

crossProduct[[1]]

Function for finding the cross product of two vectors.

Detailed Description

D - shared3p protection domain

Supported types - int8 / int16 / int32 / int / float32 / float64

Parameters

x, y

- vectors of supported type

returns a vector with the cross product of the two input vectors

None

Function Overloads

D int8 crossProduct(D int8[[1]] x, D int8[[1]] y)

D int16 crossProduct(D int16[[1]] x, D int16[[1]] y)

D int32 crossProduct(D int32[[1]] x, D int32[[1]] y)

D int crossProduct(D int[[1]] x, D int[[1]] y)

D float32 crossProduct(D float32[[1]] x, D float32[[1]] y)

D float64 crossProduct(D float64[[1]] x, D float64[[1]] y)

crossProduct[[2]]

Function for finding the cross product of two matrices.

Detailed Description

D - shared3p protection domain

Supported types - int8 / int16 / int32 / int / float32 / float64

Parameters

x, y

- matrices of supported type

returns a matrix with the cross product of each row of the two input matrices

None

Function Overloads

D int8 crossProduct(D int8[[2]] x, D int8[[2]] y)

D int16 crossProduct(D int16[[2]] x, D int16[[2]] y)

D int32 crossProduct(D int32[[2]] x, D int32[[2]] y)

D int crossProduct(D int[[2]] x, D int[[2]] y)

D float32 crossProduct(D float32[[2]] x, D float32[[2]] y)

D float64 crossProduct(D float64[[2]] x, D float64[[2]] y)

dotProduct

Function for finding the dot product of two vectors/matrices.

Functions:

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

dotProduct[[1]]

Function for finding the dot product of two vectors.

Detailed Description

D - shared3p domain

Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

x, y

- input vectors

returns a scalar with the dot product of the two input vectors

None

Function Overloads

D uint8 dotProduct(D uint8[[1]] x, D uint8[[1]] y)

D uint16 dotProduct(D uint16[[1]] x, D uint16[[1]] y)

D uint32 dotProduct(D uint32[[1]] x, D uint32[[1]] y)

D uint dotProduct(D uint[[1]] x, D uint[[1]] y)

D int8 dotProduct(D int8[[1]] x, D int8[[1]] y)

D int16 dotProduct(D int16[[1]] x, D int16[[1]] y)

D int32 dotProduct(D int32[[1]] x, D int32[[1]] y)

D int dotProduct(D int[[1]] x, D int[[1]] y)

D float32 dotProduct(D float32[[1]] x, D float32[[1]] y)

D float64 dotProduct(D float64[[1]] x, D float64[[1]] y)

dotProduct[[2]]

Function for finding the dot product of two matrices.

Detailed Description

D - shared3p protection domain

Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

Parameters

x, y

- matrices of supported type

returns a vector with the dot product of each row of the two input matrices

None

Function Overloads

D uint8 dotProduct(D uint8[[2]] x, D uint8[[2]] y)

D uint16 dotProduct(D uint16[[2]] x, D uint16[[2]] y)

D uint32 dotProduct(D uint32[[2]] x, D uint32[[2]] y)

D uint dotProduct(D uint[[2]] x, D uint[[2]] y)

D int8 dotProduct(D int8[[2]] x, D int8[[2]] y)

D int16 dotProduct(D int16[[2]] x, D int16[[2]] y)

D int32 dotProduct(D int32[[2]] x, D int32[[2]] y)

D int dotProduct(D int[[2]] x, D int[[2]] y)

D float32 dotProduct(D float32[[2]] x, D float32[[2]] y)

D float64 dotProduct(D float64[[2]] x, D float64[[2]] y)

matrixMultiplication

Function for multiplying two matrices.

Functions:

D - shared3p protection domain

Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

matrixMultiplication[[2]]

Function for multiplying two matrices.

Detailed Description

D - shared3p protection domain

Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

no. of columns of x must equal no. of rows of y

Parameters

x, y

- 2-dimensional matrices of supported type and shape

returns the matrix of x*y

None

Function Overloads

D uint8 matrixMultiplication(D uint8[[2]] x, D uint8[[2]] y)

D uint16 matrixMultiplication(D uint16[[2]] x, D uint16[[2]] y)

D uint32 matrixMultiplication(D uint32[[2]] x, D uint32[[2]] y)

D uint matrixMultiplication(D uint[[2]] x, D uint[[2]] y)

D int8 matrixMultiplication(D int8[[2]] x, D int8[[2]] y)

D int16 matrixMultiplication(D int16[[2]] x, D int16[[2]] y)

D int32 matrixMultiplication(D int32[[2]] x, D int32[[2]] y)

D int matrixMultiplication(D int[[2]] x, D int[[2]] y)

D float32 matrixMultiplication(D float32[[2]] x, D float32[[2]] y)

D float64 matrixMultiplication(D float64[[2]] x, D float64[[2]] y)

D fix32 matrixMultiplication(D fix32[[2]] x, D fix32[[2]] y)

D fix64 matrixMultiplication(D fix64[[2]] x, D fix64[[2]] y)

matrixMultiplication[[3]]

Function for multiplying two matrices.

Detailed Description

D - shared3p protection domain

Supported types - uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64

no. of columns of x must equal no. of rows of y. Also, there should be an equal no. of matrices in both structures

Parameters

x, y

- 3-dimensional matrices of supported type and shape

We multiply across the last two dimensions and return a vector of product matrices

None

Function Overloads

D uint8 matrixMultiplication(D uint8[[3]] x, D uint8[[3]] y)

D uint16 matrixMultiplication(D uint16[[3]] x, D uint16[[3]] y)

D uint32 matrixMultiplication(D uint32[[3]] x, D uint32[[3]] y)

D uint matrixMultiplication(D uint[[3]] x, D uint[[3]] y)

D int8 matrixMultiplication(D int8[[3]] x, D int8[[3]] y)

D int16 matrixMultiplication(D int16[[3]] x, D int16[[3]] y)

D int32 matrixMultiplication(D int32[[3]] x, D int32[[3]] y)

D int matrixMultiplication(D int[[3]] x, D int[[3]] y)

D float32 matrixMultiplication(D float32[[3]] x, D float32[[3]] y)

D float64 matrixMultiplication(D float64[[3]] x, D float64[[3]] y)