C# Class numl.Math.LinearAlgebra.MatrixExtensions

A matrix extensions.
Afficher le fichier Open project: sethjuarez/numl Class Usage Examples

Méthodes publiques

Méthode Description
Cholesky ( this m ) : Matrix

A Matrix extension method that choleskies the given m.

Correlation ( this source, VectorType t = VectorType.Col ) : Matrix

A Matrix extension method that correlations.

Covariance ( this source, VectorType t = VectorType.Col ) : Matrix

A Matrix extension method that covariances.

CovarianceDiag ( this source, VectorType t = VectorType.Col ) : Vector

A Matrix extension method that covariance diagram.

Det ( this m ) : double

computes matrix determinant NOTE: currently using cholesky factorization to save time so non symmetric positive semi-definite matrices will cause problems...

Diag ( this m ) : Vector

A Matrix extension method that diagrams the given m.

Each ( this m, double>.Func fnElementWiseOp ) : Matrix

Performs an element-wise operation on the input Matrix.

Each ( this m, Func fnElementWiseOp ) : Matrix

Performs an element wise operation on the input Matrix.

Each ( this m1, Matrix m2, Func fnElementWiseOp ) : Matrix

Performs an element-wise operation on the input Matrices.

Eigs ( this m ) : Matrix>.Tuple

A Matrix extension method that eigs the given m.

Extract ( this m, int x, int y, int width, int height, bool safe = true ) : Matrix

A Matrix extension method that extracts this object.

Indices ( this source, bool>.Func f ) : IEnumerable

Enumerates indices in this collection.

Indices ( this source, bool>.Func f, VectorType t ) : IEnumerable

Enumerates indices in this collection.

Max ( this source, VectorType t ) : Vector

Returns a vector of the maximum values for each row/column.

Max ( this source ) : double

A Matrix extension method that determines the maximum of the given parameters.

Mean ( this source, VectorType t ) : Vector

A Matrix extension method that determines the mean of the given parameters.

Median ( this source, VectorType t ) : Vector

Returns a vector of the median values for each row or column.

Min ( this source, VectorType t ) : Vector

Returns a vector of the minimum values for each row/column.

Min ( this source ) : double

A Matrix extension method that determines the minimum of the given parameters.

Norm ( this m ) : double

A Matrix extension method that normals.

Norm ( this m, double p ) : double

A Matrix extension method that normals.

Reverse ( this source, VectorType t = VectorType.Row ) : IEnumerable

Enumerates reverse in this collection.

Round ( this m, int decimals ) : Matrix

A Matrix extension method that rounds.

SVD ( this m ) : Tuple

A Matrix extension method that svds the given m.

Slice ( this m, IEnumerable indices ) : Matrix

A Matrix extension method that slices.

Slice ( this m, IEnumerable indices, VectorType t ) : Matrix

A Matrix extension method that slices.

Slice ( this m, int minIndex, int maxIndex, VectorType t = VectorType.Row ) : Matrix

Slices the input matrix using starting and stopping positions.

Sort ( this m, double>.Func keySelector, VectorType t, bool isAscending = true ) : Matrix

Sorts the given Matrix by the specified row or column and returns the new Matrix.

Sort ( this m, double>.Func keySelector, VectorType t, bool isAscending, Vector &indices ) : Matrix

Sorts the given Matrix by the specified row or column index and returns the new Matrix along with the original indices.

Stack ( this m, Matrix t ) : Matrix

A Matrix extension method that stacks.

Stats ( this m ) : Matrix[]

A Matrix extension method that statistics.

Stats ( this m, VectorType t ) : Matrix[]

A Matrix extension method that statistics.

StdDev ( this source, VectorType t ) : Vector

Computes the standard deviation of the given matrix

Sum ( this m, VectorType t ) : Vector

Computes the sum of either the rows or columns of a matrix and returns a vector.

Sum ( Matrix m, int i, VectorType t ) : double

Computes the sum of either the rows or columns of a matrix and returns a vector.

Sum ( this m ) : double

Computes the entire sum of every element in the Matrix.

ToBinary ( this m, bool>.Func fnPredicate, double trueValue = 1.0, double falseValue = 0.0 ) : Matrix

Converts a matrix to a binary indicator matrix based on the specified predicate.

Trace ( this m ) : double

Computes the trace of a matrix.

Unshape ( this m ) : Vector

Unrolls the matrix into an n x 1 vector.

VStack ( this m, Matrix t ) : Matrix

A Matrix extension method that stacks.

Method Details

Cholesky() public static méthode

A Matrix extension method that choleskies the given m.
public static Cholesky ( this m ) : Matrix
m this Matrix.
Résultat Matrix

Correlation() public static méthode

A Matrix extension method that correlations.
public static Correlation ( this source, VectorType t = VectorType.Col ) : Matrix
source this The source to act on.
t VectorType (Optional) Row or Column sum.
Résultat Matrix

Covariance() public static méthode

A Matrix extension method that covariances.
public static Covariance ( this source, VectorType t = VectorType.Col ) : Matrix
source this The source to act on.
t VectorType (Optional) Row or Column sum.
Résultat Matrix

CovarianceDiag() public static méthode

A Matrix extension method that covariance diagram.
public static CovarianceDiag ( this source, VectorType t = VectorType.Col ) : Vector
source this The source to act on.
t VectorType (Optional) Row or Column sum.
Résultat Vector

Det() public static méthode

computes matrix determinant NOTE: currently using cholesky factorization to save time so non symmetric positive semi-definite matrices will cause problems...
public static Det ( this m ) : double
m this Matrix.
Résultat double

Diag() public static méthode

A Matrix extension method that diagrams the given m.
public static Diag ( this m ) : Vector
m this Matrix.
Résultat Vector

Each() public static méthode

Performs an element-wise operation on the input Matrix.
public static Each ( this m, double>.Func fnElementWiseOp ) : Matrix
m this Matrix.
fnElementWiseOp double>.Func Function to apply.
Résultat Matrix

Each() public static méthode

Performs an element wise operation on the input Matrix.
public static Each ( this m, Func fnElementWiseOp ) : Matrix
m this Matrix.
fnElementWiseOp Func Function to apply to each cell specified by the value and cell coordinates.
Résultat Matrix

Each() public static méthode

Performs an element-wise operation on the input Matrices.
public static Each ( this m1, Matrix m2, Func fnElementWiseOp ) : Matrix
m1 this First Matrix.
m2 Matrix Second Matrix.
fnElementWiseOp Func Operation to perform on the value from the first and second matrices.
Résultat Matrix

Eigs() public static méthode

A Matrix extension method that eigs the given m.
public static Eigs ( this m ) : Matrix>.Tuple
m this Matrix.
Résultat Matrix>.Tuple

Extract() public static méthode

A Matrix extension method that extracts this object.
public static Extract ( this m, int x, int y, int width, int height, bool safe = true ) : Matrix
m this Matrix.
x int The x coordinate.
y int The y coordinate.
width int The width.
height int The height.
safe bool (Optional) true to safe.
Résultat Matrix

Indices() public static méthode

Enumerates indices in this collection.
public static Indices ( this source, bool>.Func f ) : IEnumerable
source this The source to act on.
f bool>.Func The Func<Vector,bool> to process.
Résultat IEnumerable

Indices() public static méthode

Enumerates indices in this collection.
public static Indices ( this source, bool>.Func f, VectorType t ) : IEnumerable
source this The source to act on.
f bool>.Func The Func<Vector,bool> to process.
t VectorType Row or Column sum.
Résultat IEnumerable

Max() public static méthode

Returns a vector of the maximum values for each row/column.
public static Max ( this source, VectorType t ) : Vector
source this
t VectorType
Résultat Vector

Max() public static méthode

A Matrix extension method that determines the maximum of the given parameters.
public static Max ( this source ) : double
source this The source to act on.
Résultat double

Mean() public static méthode

A Matrix extension method that determines the mean of the given parameters.
public static Mean ( this source, VectorType t ) : Vector
source this The source to act on.
t VectorType Row or Column sum.
Résultat Vector

Median() public static méthode

Returns a vector of the median values for each row or column.
public static Median ( this source, VectorType t ) : Vector
source this
t VectorType
Résultat Vector

Min() public static méthode

Returns a vector of the minimum values for each row/column.
public static Min ( this source, VectorType t ) : Vector
source this
t VectorType
Résultat Vector

Min() public static méthode

A Matrix extension method that determines the minimum of the given parameters.
public static Min ( this source ) : double
source this The source to act on.
Résultat double

Norm() public static méthode

A Matrix extension method that normals.
public static Norm ( this m ) : double
m this Matrix.
Résultat double

Norm() public static méthode

A Matrix extension method that normals.
public static Norm ( this m, double p ) : double
m this Matrix.
p double The double to process.
Résultat double

Reverse() public static méthode

Enumerates reverse in this collection.
public static Reverse ( this source, VectorType t = VectorType.Row ) : IEnumerable
source this The source to act on.
t VectorType (Optional) Row or Column sum.
Résultat IEnumerable

Round() public static méthode

A Matrix extension method that rounds.
public static Round ( this m, int decimals ) : Matrix
m this Matrix.
decimals int (Optional) the decimals.
Résultat Matrix

SVD() public static méthode

A Matrix extension method that svds the given m.
public static SVD ( this m ) : Tuple
m this Matrix.
Résultat Tuple

Slice() public static méthode

A Matrix extension method that slices.
public static Slice ( this m, IEnumerable indices ) : Matrix
m this Matrix.
indices IEnumerable The indices.
Résultat Matrix

Slice() public static méthode

A Matrix extension method that slices.
public static Slice ( this m, IEnumerable indices, VectorType t ) : Matrix
m this Matrix.
indices IEnumerable The indices.
t VectorType Row or Column sum.
Résultat Matrix

Slice() public static méthode

Slices the input matrix using starting and stopping positions.
public static Slice ( this m, int minIndex, int maxIndex, VectorType t = VectorType.Row ) : Matrix
m this Source matrix.
minIndex int Minimum index to slice from.
maxIndex int Maximum index to slice.
t VectorType
Résultat Matrix

Sort() public static méthode

Sorts the given Matrix by the specified row or column and returns the new Matrix.
public static Sort ( this m, double>.Func keySelector, VectorType t, bool isAscending = true ) : Matrix
m this The Matrix
keySelector double>.Func Property selector to sort by.
t VectorType Specifies whether to sort horizontally () or vertically ().
isAscending bool Determines whether to sort ascending or descending (Default: True)
Résultat Matrix

Sort() public static méthode

Sorts the given Matrix by the specified row or column index and returns the new Matrix along with the original indices.
public static Sort ( this m, double>.Func keySelector, VectorType t, bool isAscending, Vector &indices ) : Matrix
m this The Matrix
keySelector double>.Func Property selector to sort by.
t VectorType Specifies whether to sort horizontally () or vertically ().
isAscending bool Determines whether to sort ascending or descending (Default: True)
indices Vector Vector of the original () indices before the sort operation.
Résultat Matrix

Stack() public static méthode

A Matrix extension method that stacks.
public static Stack ( this m, Matrix t ) : Matrix
m this Matrix.
t Matrix Row or Column sum.
Résultat Matrix

Stats() public static méthode

A Matrix extension method that statistics.
public static Stats ( this m ) : Matrix[]
m this Matrix.
Résultat Matrix[]

Stats() public static méthode

A Matrix extension method that statistics.
public static Stats ( this m, VectorType t ) : Matrix[]
m this Matrix.
t VectorType Row or Column sum.
Résultat Matrix[]

StdDev() public static méthode

Computes the standard deviation of the given matrix
public static StdDev ( this source, VectorType t ) : Vector
source this
t VectorType Return a Row or Column vector
Résultat Vector

Sum() public static méthode

Computes the sum of either the rows or columns of a matrix and returns a vector.
public static Sum ( this m, VectorType t ) : Vector
m this Matrix.
t VectorType Row or Column sum.
Résultat Vector

Sum() public static méthode

Computes the sum of either the rows or columns of a matrix and returns a vector.
public static Sum ( Matrix m, int i, VectorType t ) : double
m Matrix Matrix.
i int Zero-based index of the.
t VectorType Row or Column sum.
Résultat double

Sum() public static méthode

Computes the entire sum of every element in the Matrix.
public static Sum ( this m ) : double
m this Matrix.
Résultat double

ToBinary() public static méthode

Converts a matrix to a binary indicator matrix based on the specified predicate.
public static ToBinary ( this m, bool>.Func fnPredicate, double trueValue = 1.0, double falseValue = 0.0 ) : Matrix
m this Matrix.
fnPredicate bool>.Func Function to test each Value.
trueValue double (Optional) Value to set when condition () returns True
falseValue double (Optional) Value to set when condition () returns False
Résultat Matrix

Trace() public static méthode

Computes the trace of a matrix.
public static Trace ( this m ) : double
m this Matrix.
Résultat double

Unshape() public static méthode

Unrolls the matrix into an n x 1 vector.
public static Unshape ( this m ) : Vector
m this
Résultat Vector

VStack() public static méthode

A Matrix extension method that stacks.
public static VStack ( this m, Matrix t ) : Matrix
m this Matrix.
t Matrix Row or Column sum.
Résultat Matrix