C# Class YAMP.MatrixValue

The class for representing a matrix value.
Inheritance: NumericValue, IFunction, ISetFunction
Afficher le fichier Open project: FlorianRappl/YAMP Class Usage Examples

Méthodes publiques

Méthode Description
Abs ( ) : ScalarValue

Computes the L2-Norm of the matrix (seen as a vector).

AddColumn ( Value value ) : MatrixValue

Adds a column specified by the type of the value to add-in. If it is a scalar value, then it is quite simple. For a matrix the geometry is important.

AddMM ( Value left, Value right ) : MatrixValue

Matrix + Matrix

AddMS ( Value left, Value right ) : MatrixValue

Matrix + Scalar

AddRow ( Value value ) : MatrixValue

Creates a new matrix with another row. The row is either simply a number (in this case the value is just inserted) or a matrix (then the geometry is important).

AddSM ( Value left, Value right ) : MatrixValue

Scalar + Matrix

Adjungate ( ) : MatrixValue

Computes the adjungated (transposed + c.c.) matrix.

Clear ( ) : void

Clears all entries.

Clone ( ) : MatrixValue

Creates a deep copy of the matrix.

ComplexDot ( MatrixValue w ) : ScalarValue

Produces a complex dot (this operand is c.c.) product of the given instance (seen as a vector) with another vector.

ComputeLargestStringContent ( ParseContext context ) : Int32

Gets the maximum length of any cell of the matrix by considering the given context.

Copy ( ) : Value

Creates a deep copy of the matrix.

Create ( Value value ) : MatrixValue

Creates a new matrix with the help of a specified value.

DeleteColumns ( int index, int count = 1 ) : void

Deletes the specified number of columns of the matrix.

DeleteRows ( int index, int count = 1 ) : void

Deletes the specified number of rows of the matrix.

Deserialize ( Byte content ) : Value

Creates a new matrix instance from the given content.

Det ( ) : ScalarValue

Computes the determinant of the matrix.

DivideMM ( Value left, Value right ) : MatrixValue

Matrix / Matrix

DivideMS ( Value left, Value right ) : MatrixValue

Matrix / Scalar

DivideSM ( Value left, Value right ) : MatrixValue

Scalar / Matrix

Dot ( MatrixValue w ) : ScalarValue

Produces a dot product of the given instance (seen as a vector) with another vector.

Equals ( object obj ) : bool

Takes a close look if two matrices are equivalent.

ForEach ( ScalarValue>.Func f ) : MatrixValue

Performs the operation f on each element of the matrix, creating a new matrix B where each entry is given by B_jk = f(A_jk).

FrobeniusNorm ( ) : double

Computes the Frobenius-norm of the matrix.

The Frobenius-norm of a matrix the square root of the sum of the squares of all the elements. In the case of a row or column vector, this reduces to the Euclidean vector norm.

GetColumnVector ( int i ) : MatrixValue

Gets the i-th column vector, i.e. a vector which is spanned over all rows of one column.

GetComplexMatrix ( ) : YAMP.ScalarValue[][]

Gets a real matrix of the complete matrix.

GetHashCode ( ) : int

Gives a first hint if two matrices can be equivalent.

GetRealMatrix ( ) : double[][]

Gets a real matrix of the complete matrix.

GetRealVector ( ) : double[]

Gets a real vector of the complete matrix.

GetRealVector ( int yoffset, int ylength, int xoffset, int xlength ) : double[]

Gets a real vector of a submatrix.

GetRowVector ( int j ) : MatrixValue

Gets the j-th row vector, i.e. a vector which is spanned over all columns of one row.

GetSubMatrix ( int y, int xoffset, int xfinal ) : MatrixValue

Creates a sub matrix of the given instance.

GetSubMatrix ( int yoffset, int yfinal, int xoffset, int xfinal ) : MatrixValue

Creates a sub matrix of the given instance.

InfinityNorm ( ) : double

Computes the ∞-norm of the matrix.

The ∞-norm of a matrix is the largest row sum.

Inverse ( ) : MatrixValue

Computes the inverse (if it exists).

MatrixValue ( ) : System

Constructs a new matrix.

MatrixValue ( ScalarValue>.Dictionary values, Int32 rows, Int32 cols ) : System

Constructs a new matrix with the provided values and dimension.

MatrixValue ( Double values ) : System

Constructs a new matrix based on the given two dimensional array.

MatrixValue ( Double values, Int32 rows, Int32 cols ) : System

Constructs a new matrix based on the jagged double array.

MatrixValue ( Int32 rows, Int32 cols ) : System

Constructs a new matrix with the given dimension.

MatrixValue ( Int32 rows, Int32 cols, ScalarValue filling ) : System

Constructs a new matrix with the given dimension and sets each entry to the given value.

MatrixValue ( ScalarValue values, Int32 rows, Int32 cols ) : System

Constructs a new matrix based on the jagged double array.

Max ( ) : MatrixIndex

Gets the index for the maximum entry in the matrix.

Min ( ) : MatrixIndex

Gets the index for the minimum entry in the matrix.

ModuloMS ( Value left, Value right ) : MatrixValue

Matrix % Scalar

ModuloSM ( Value left, Value right ) : MatrixValue

Scalar % Matrix

MultiplyMM ( Value left, Value right ) : Value

Matrix * Matrix

MultiplyMS ( Value left, Value right ) : MatrixValue

Matrix * Scalar

MultiplySM ( Value left, Value right ) : MatrixValue

Scalar * Matrix

One ( int dimension ) : MatrixValue

Creates a new identity matrix of the given dimension.

One ( int rows, int columns ) : MatrixValue

Creates a new identity matrix of the given dimension.

OneNorm ( ) : double

Computes the 1-norm of the matrix.

The 1-norm of a matrix is the largest column sum.

Ones ( int rows, int cols ) : MatrixValue

Creates a matrix containing only ones.

Perform ( ParseContext context, Value argument ) : Value

The method used by YAMP to get values from a matrix.

Perform ( ParseContext context, Value argument, Value values ) : Value

Method used by YAMP to set values in a matrix.

PowMS ( Value basis, Value exponent ) : MatrixValue

Matrix ^ Scalar

PowSM ( Value basis, Value exponent ) : MatrixValue

Scalar ^ Matrix

Randomize ( ) : void

Goes over all rows and columns and randomizes the values.

Serialize ( ) : Byte[]

Serializes the current instance.

SetColumnVector ( int i, MatrixValue m ) : MatrixValue

Sets the i-th column vector to be of the given matrix.

SetRowVector ( int j, MatrixValue m ) : MatrixValue

Sets the j-th row vector to be of the given matrix.

SubtractMM ( Value left, Value right ) : Value

Matrix - Matrix

SubtractMS ( Value left, Value right ) : MatrixValue

Matrix - Scalar

SubtractSM ( Value left, Value right ) : MatrixValue

Scalar - Matrix

Sum ( ) : ScalarValue

Computes the sum of all entries.

ToArray ( ) : YAMP.ScalarValue[]

Copies the internal scalar values to a 1-dim. complex array.

ToString ( ParseContext context ) : String

Creates a standard string representation of the matrix.

ToString ( ParseContext context, Int32 exponent ) : String

Creates a standard string representation of the matrix.

Trace ( ) : ScalarValue

Computes the trace (sum over all elements on the diagonal) of the matrix.

Transpose ( ) : MatrixValue

Computes the transposed matrix.

VectorSort ( ) : MatrixValue

Sorts the values of the matrix and outputs the values in a new vector.

operator ( ) : System.Boolean

Inequality.

operator ( ) : MatrixValue

Multiplication.

this ( int i ) : ScalarValue

Gets or sets the i-th element of the matrix (counted rows-first).

this ( int j, int i ) : ScalarValue

Gets the element of the j-th row and i-th column.

Méthodes protégées

Méthode Description
ContainsIndex ( MatrixIndex index ) : bool

Does the matrix contain this index? If not then the value is zero.

GetIndex ( int i ) : MatrixIndex

Gets the matrix-index (row, column) of the 1-based 1-dim. index i.

GetIndex ( MatrixIndex index ) : ScalarValue

Gets the entry of the specified matrix-index entry in the dictionary. Please check if the element is in the dictionary anyway (ContainsIndex).

RegisterOperators ( ) : void

Registers all operators that are associated with the matrix.

Private Methods

Méthode Description
DeleteFullColumns ( List indices ) : void
DeleteFullRows ( List indices ) : void
LogicalSubscripting ( MatrixValue m ) : MatrixValue
LogicalSubscripting ( MatrixValue m, List indices ) : void

Method Details

Abs() public méthode

Computes the L2-Norm of the matrix (seen as a vector).
public Abs ( ) : ScalarValue
Résultat ScalarValue

AddColumn() public méthode

Adds a column specified by the type of the value to add-in. If it is a scalar value, then it is quite simple. For a matrix the geometry is important.
public AddColumn ( Value value ) : MatrixValue
value Value The value to add in another column.
Résultat MatrixValue

AddMM() public static méthode

Matrix + Matrix
public static AddMM ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a matrix.
Résultat MatrixValue

AddMS() public static méthode

Matrix + Scalar
public static AddMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Résultat MatrixValue

AddRow() public méthode

Creates a new matrix with another row. The row is either simply a number (in this case the value is just inserted) or a matrix (then the geometry is important).
public AddRow ( Value value ) : MatrixValue
value Value The value to append as a row.
Résultat MatrixValue

AddSM() public static méthode

Scalar + Matrix
public static AddSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Résultat MatrixValue

Adjungate() public méthode

Computes the adjungated (transposed + c.c.) matrix.
public Adjungate ( ) : MatrixValue
Résultat MatrixValue

Clear() public méthode

Clears all entries.
public Clear ( ) : void
Résultat void

Clone() public méthode

Creates a deep copy of the matrix.
public Clone ( ) : MatrixValue
Résultat MatrixValue

ComplexDot() public méthode

Produces a complex dot (this operand is c.c.) product of the given instance (seen as a vector) with another vector.
public ComplexDot ( MatrixValue w ) : ScalarValue
w MatrixValue The second operand of the complex dot-product.
Résultat ScalarValue

ComputeLargestStringContent() public méthode

Gets the maximum length of any cell of the matrix by considering the given context.
public ComputeLargestStringContent ( ParseContext context ) : Int32
context ParseContext The parse context which holds the state information.
Résultat System.Int32

ContainsIndex() protected méthode

Does the matrix contain this index? If not then the value is zero.
protected ContainsIndex ( MatrixIndex index ) : bool
index MatrixIndex The matrix-index (row, column).
Résultat bool

Copy() public méthode

Creates a deep copy of the matrix.
public Copy ( ) : Value
Résultat Value

Create() public static méthode

Creates a new matrix with the help of a specified value.
public static Create ( Value value ) : MatrixValue
value Value The value to initialize the matrix with.
Résultat MatrixValue

DeleteColumns() public méthode

Deletes the specified number of columns of the matrix.
public DeleteColumns ( int index, int count = 1 ) : void
index int The column index to start (1-based).
count int The number of columns to remove.
Résultat void

DeleteRows() public méthode

Deletes the specified number of rows of the matrix.
public DeleteRows ( int index, int count = 1 ) : void
index int The row index to start (1-based).
count int The number of rows to remove.
Résultat void

Deserialize() public méthode

Creates a new matrix instance from the given content.
public Deserialize ( Byte content ) : Value
content Byte The binary content.
Résultat Value

Det() public méthode

Computes the determinant of the matrix.
public Det ( ) : ScalarValue
Résultat ScalarValue

DivideMM() public static méthode

Matrix / Matrix
public static DivideMM ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a matrix.
Résultat MatrixValue

DivideMS() public static méthode

Matrix / Scalar
public static DivideMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Résultat MatrixValue

DivideSM() public static méthode

Scalar / Matrix
public static DivideSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Résultat MatrixValue

Dot() public méthode

Produces a dot product of the given instance (seen as a vector) with another vector.
public Dot ( MatrixValue w ) : ScalarValue
w MatrixValue The second operand of the dot-product.
Résultat ScalarValue

Equals() public méthode

Takes a close look if two matrices are equivalent.
public Equals ( object obj ) : bool
obj object The other matrix (otherwise it is false).
Résultat bool

ForEach() public méthode

Performs the operation f on each element of the matrix, creating a new matrix B where each entry is given by B_jk = f(A_jk).
public ForEach ( ScalarValue>.Func f ) : MatrixValue
f ScalarValue>.Func The function to use.
Résultat MatrixValue

FrobeniusNorm() public méthode

Computes the Frobenius-norm of the matrix.

The Frobenius-norm of a matrix the square root of the sum of the squares of all the elements. In the case of a row or column vector, this reduces to the Euclidean vector norm.

public FrobeniusNorm ( ) : double
Résultat double

GetColumnVector() public méthode

Gets the i-th column vector, i.e. a vector which is spanned over all rows of one column.
public GetColumnVector ( int i ) : MatrixValue
i int The index of the column to get the vector from.
Résultat MatrixValue

GetComplexMatrix() public méthode

Gets a real matrix of the complete matrix.
public GetComplexMatrix ( ) : YAMP.ScalarValue[][]
Résultat YAMP.ScalarValue[][]

GetHashCode() public méthode

Gives a first hint if two matrices can be equivalent.
public GetHashCode ( ) : int
Résultat int

GetIndex() protected méthode

Gets the matrix-index (row, column) of the 1-based 1-dim. index i.
protected GetIndex ( int i ) : MatrixIndex
i int The 1-based index. The i-th element is requested.
Résultat MatrixIndex

GetIndex() protected méthode

Gets the entry of the specified matrix-index entry in the dictionary. Please check if the element is in the dictionary anyway (ContainsIndex).
protected GetIndex ( MatrixIndex index ) : ScalarValue
index MatrixIndex The matrix-index (row, column).
Résultat ScalarValue

GetRealMatrix() public méthode

Gets a real matrix of the complete matrix.
public GetRealMatrix ( ) : double[][]
Résultat double[][]

GetRealVector() public méthode

Gets a real vector of the complete matrix.
public GetRealVector ( ) : double[]
Résultat double[]

GetRealVector() public méthode

Gets a real vector of a submatrix.
public GetRealVector ( int yoffset, int ylength, int xoffset, int xlength ) : double[]
yoffset int The offset in rows.
ylength int The length in rows.
xoffset int The offset in columns.
xlength int The length in columns.
Résultat double[]

GetRowVector() public méthode

Gets the j-th row vector, i.e. a vector which is spanned over all columns of one row.
public GetRowVector ( int j ) : MatrixValue
j int The index of the row to get the vector from.
Résultat MatrixValue

GetSubMatrix() public méthode

Creates a sub matrix of the given instance.
public GetSubMatrix ( int y, int xoffset, int xfinal ) : MatrixValue
y int Row-indices to consider.
xoffset int Horizontal offset in columns.
xfinal int Final column-index.
Résultat MatrixValue

GetSubMatrix() public méthode

Creates a sub matrix of the given instance.
public GetSubMatrix ( int yoffset, int yfinal, int xoffset, int xfinal ) : MatrixValue
yoffset int Vertical offset in rows.
yfinal int Final row-index.
xoffset int Horizontal offset in columns.
xfinal int Final column-index.
Résultat MatrixValue

InfinityNorm() public méthode

Computes the ∞-norm of the matrix.

The ∞-norm of a matrix is the largest row sum.

public InfinityNorm ( ) : double
Résultat double

Inverse() public méthode

Computes the inverse (if it exists).
public Inverse ( ) : MatrixValue
Résultat MatrixValue

MatrixValue() public méthode

Constructs a new matrix.
public MatrixValue ( ) : System
Résultat System

MatrixValue() public méthode

Constructs a new matrix with the provided values and dimension.
public MatrixValue ( ScalarValue>.Dictionary values, Int32 rows, Int32 cols ) : System
values ScalarValue>.Dictionary The values to assign.
rows System.Int32 The number of rows in the new matrix.
cols System.Int32 The number of columns in the matrix.
Résultat System

MatrixValue() public méthode

Constructs a new matrix based on the given two dimensional array.
public MatrixValue ( Double values ) : System
values Double The values which set the dimensions and starting values of the matrix.
Résultat System

MatrixValue() public méthode

Constructs a new matrix based on the jagged double array.
public MatrixValue ( Double values, Int32 rows, Int32 cols ) : System
values Double The values to use.
rows System.Int32 The number of rows in the new matrix.
cols System.Int32 The number of columns in the matrix.
Résultat System

MatrixValue() public méthode

Constructs a new matrix with the given dimension.
public MatrixValue ( Int32 rows, Int32 cols ) : System
rows System.Int32 The number of rows.
cols System.Int32 The number of columns.
Résultat System

MatrixValue() public méthode

Constructs a new matrix with the given dimension and sets each entry to the given value.
public MatrixValue ( Int32 rows, Int32 cols, ScalarValue filling ) : System
rows System.Int32
cols System.Int32
filling ScalarValue
Résultat System

MatrixValue() public méthode

Constructs a new matrix based on the jagged double array.
public MatrixValue ( ScalarValue values, Int32 rows, Int32 cols ) : System
values ScalarValue The values to use.
rows System.Int32 The number of rows in the new matrix.
cols System.Int32 The number of columns in the matrix.
Résultat System

Max() public méthode

Gets the index for the maximum entry in the matrix.
public Max ( ) : MatrixIndex
Résultat MatrixIndex

Min() public méthode

Gets the index for the minimum entry in the matrix.
public Min ( ) : MatrixIndex
Résultat MatrixIndex

ModuloMS() public static méthode

Matrix % Scalar
public static ModuloMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Résultat MatrixValue

ModuloSM() public static méthode

Scalar % Matrix
public static ModuloSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Résultat MatrixValue

MultiplyMM() public static méthode

Matrix * Matrix
public static MultiplyMM ( Value left, Value right ) : Value
left Value Must be a matrix.
right Value Must be a matrix.
Résultat Value

MultiplyMS() public static méthode

Matrix * Scalar
public static MultiplyMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Résultat MatrixValue

MultiplySM() public static méthode

Scalar * Matrix
public static MultiplySM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Résultat MatrixValue

One() public static méthode

Creates a new identity matrix of the given dimension.
public static One ( int dimension ) : MatrixValue
dimension int The rank of the identity matrix.
Résultat MatrixValue

One() public static méthode

Creates a new identity matrix of the given dimension.
public static One ( int rows, int columns ) : MatrixValue
rows int The number of rows of the identity matrix.
columns int The number of columns of the identity matrix.
Résultat MatrixValue

OneNorm() public méthode

Computes the 1-norm of the matrix.

The 1-norm of a matrix is the largest column sum.

public OneNorm ( ) : double
Résultat double

Ones() public static méthode

Creates a matrix containing only ones.
public static Ones ( int rows, int cols ) : MatrixValue
rows int The number of rows in the new matrix.
cols int The number of columns in the new matrix.
Résultat MatrixValue

Perform() public méthode

The method used by YAMP to get values from a matrix.
public Perform ( ParseContext context, Value argument ) : Value
context ParseContext The context where this is happening.
argument Value The 1-dim or 2-dim indices.
Résultat Value

Perform() public méthode

Method used by YAMP to set values in a matrix.
public Perform ( ParseContext context, Value argument, Value values ) : Value
context ParseContext The context where this is happening.
argument Value The indices (1-dim or 2-dim).
values Value The value(s) to set.
Résultat Value

PowMS() public static méthode

Matrix ^ Scalar
public static PowMS ( Value basis, Value exponent ) : MatrixValue
basis Value Must be a matr.
exponent Value Must be a scalar.
Résultat MatrixValue

PowSM() public static méthode

Scalar ^ Matrix
public static PowSM ( Value basis, Value exponent ) : MatrixValue
basis Value Must be a scalar.
exponent Value Must be a matrix.
Résultat MatrixValue

Randomize() public méthode

Goes over all rows and columns and randomizes the values.
public Randomize ( ) : void
Résultat void

RegisterOperators() protected méthode

Registers all operators that are associated with the matrix.
protected RegisterOperators ( ) : void
Résultat void

Serialize() public méthode

Serializes the current instance.
public Serialize ( ) : Byte[]
Résultat Byte[]

SetColumnVector() public méthode

Sets the i-th column vector to be of the given matrix.
public SetColumnVector ( int i, MatrixValue m ) : MatrixValue
i int The index of the column to set the vector to.
m MatrixValue The matrix with values to set the i-th column to.
Résultat MatrixValue

SetRowVector() public méthode

Sets the j-th row vector to be of the given matrix.
public SetRowVector ( int j, MatrixValue m ) : MatrixValue
j int The index of the row to set the vector to.
m MatrixValue The matrix with values to set the j-th row to.
Résultat MatrixValue

SubtractMM() public static méthode

Matrix - Matrix
public static SubtractMM ( Value left, Value right ) : Value
left Value Must be a matrix.
right Value Must be a matrix.
Résultat Value

SubtractMS() public static méthode

Matrix - Scalar
public static SubtractMS ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a scalar.
Résultat MatrixValue

SubtractSM() public static méthode

Scalar - Matrix
public static SubtractSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Résultat MatrixValue

Sum() public méthode

Computes the sum of all entries.
public Sum ( ) : ScalarValue
Résultat ScalarValue

ToArray() public méthode

Copies the internal scalar values to a 1-dim. complex array.
public ToArray ( ) : YAMP.ScalarValue[]
Résultat YAMP.ScalarValue[]

ToString() public méthode

Creates a standard string representation of the matrix.
public ToString ( ParseContext context ) : String
context ParseContext The parse content.
Résultat String

ToString() public méthode

Creates a standard string representation of the matrix.
public ToString ( ParseContext context, Int32 exponent ) : String
context ParseContext The parse content.
exponent System.Int32 The global exponent that is in use.
Résultat String

Trace() public méthode

Computes the trace (sum over all elements on the diagonal) of the matrix.
public Trace ( ) : ScalarValue
Résultat ScalarValue

Transpose() public méthode

Computes the transposed matrix.
public Transpose ( ) : MatrixValue
Résultat MatrixValue

VectorSort() public méthode

Sorts the values of the matrix and outputs the values in a new vector.
public VectorSort ( ) : MatrixValue
Résultat MatrixValue

operator() public static méthode

Inequality.
public static operator ( ) : System.Boolean
Résultat System.Boolean

operator() public static méthode

Multiplication.
public static operator ( ) : MatrixValue
Résultat MatrixValue

this() public méthode

Gets or sets the i-th element of the matrix (counted rows-first).
public this ( int i ) : ScalarValue
i int The 1-based index.
Résultat ScalarValue

this() public méthode

Gets the element of the j-th row and i-th column.
public this ( int j, int i ) : ScalarValue
j int The 1-based row index.
i int The 1-based column index.
Résultat ScalarValue