C# Класс YAMP.MatrixValue

The class for representing a matrix value.
Наследование: NumericValue, IFunction, ISetFunction
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
DeleteFullColumns ( List indices ) : void
DeleteFullRows ( List indices ) : void
LogicalSubscripting ( MatrixValue m ) : MatrixValue
LogicalSubscripting ( MatrixValue m, List indices ) : void

Описание методов

Abs() публичный Метод

Computes the L2-Norm of the matrix (seen as a vector).
public Abs ( ) : ScalarValue
Результат ScalarValue

AddColumn() публичный Метод

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.
Результат MatrixValue

AddMM() публичный статический Метод

Matrix + Matrix
public static AddMM ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a matrix.
Результат MatrixValue

AddMS() публичный статический Метод

Matrix + Scalar
public static AddMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Результат MatrixValue

AddRow() публичный Метод

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.
Результат MatrixValue

AddSM() публичный статический Метод

Scalar + Matrix
public static AddSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Результат MatrixValue

Adjungate() публичный Метод

Computes the adjungated (transposed + c.c.) matrix.
public Adjungate ( ) : MatrixValue
Результат MatrixValue

Clear() публичный Метод

Clears all entries.
public Clear ( ) : void
Результат void

Clone() публичный Метод

Creates a deep copy of the matrix.
public Clone ( ) : MatrixValue
Результат MatrixValue

ComplexDot() публичный Метод

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.
Результат ScalarValue

ComputeLargestStringContent() публичный Метод

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.
Результат System.Int32

ContainsIndex() защищенный Метод

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).
Результат bool

Copy() публичный Метод

Creates a deep copy of the matrix.
public Copy ( ) : Value
Результат Value

Create() публичный статический Метод

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.
Результат MatrixValue

DeleteColumns() публичный Метод

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.
Результат void

DeleteRows() публичный Метод

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.
Результат void

Deserialize() публичный Метод

Creates a new matrix instance from the given content.
public Deserialize ( Byte content ) : Value
content Byte The binary content.
Результат Value

Det() публичный Метод

Computes the determinant of the matrix.
public Det ( ) : ScalarValue
Результат ScalarValue

DivideMM() публичный статический Метод

Matrix / Matrix
public static DivideMM ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a matrix.
Результат MatrixValue

DivideMS() публичный статический Метод

Matrix / Scalar
public static DivideMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Результат MatrixValue

DivideSM() публичный статический Метод

Scalar / Matrix
public static DivideSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Результат MatrixValue

Dot() публичный Метод

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.
Результат ScalarValue

Equals() публичный Метод

Takes a close look if two matrices are equivalent.
public Equals ( object obj ) : bool
obj object The other matrix (otherwise it is false).
Результат bool

ForEach() публичный Метод

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.
Результат MatrixValue

FrobeniusNorm() публичный Метод

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
Результат double

GetColumnVector() публичный Метод

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.
Результат MatrixValue

GetComplexMatrix() публичный Метод

Gets a real matrix of the complete matrix.
public GetComplexMatrix ( ) : YAMP.ScalarValue[][]
Результат YAMP.ScalarValue[][]

GetHashCode() публичный Метод

Gives a first hint if two matrices can be equivalent.
public GetHashCode ( ) : int
Результат int

GetIndex() защищенный Метод

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.
Результат MatrixIndex

GetIndex() защищенный Метод

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).
Результат ScalarValue

GetRealMatrix() публичный Метод

Gets a real matrix of the complete matrix.
public GetRealMatrix ( ) : double[][]
Результат double[][]

GetRealVector() публичный Метод

Gets a real vector of the complete matrix.
public GetRealVector ( ) : double[]
Результат double[]

GetRealVector() публичный Метод

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.
Результат double[]

GetRowVector() публичный Метод

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.
Результат MatrixValue

GetSubMatrix() публичный Метод

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.
Результат MatrixValue

GetSubMatrix() публичный Метод

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.
Результат MatrixValue

InfinityNorm() публичный Метод

Computes the ∞-norm of the matrix.

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

public InfinityNorm ( ) : double
Результат double

Inverse() публичный Метод

Computes the inverse (if it exists).
public Inverse ( ) : MatrixValue
Результат MatrixValue

MatrixValue() публичный Метод

Constructs a new matrix.
public MatrixValue ( ) : System
Результат System

MatrixValue() публичный Метод

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.
Результат System

MatrixValue() публичный Метод

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.
Результат System

MatrixValue() публичный Метод

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.
Результат System

MatrixValue() публичный Метод

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.
Результат System

MatrixValue() публичный Метод

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
Результат System

MatrixValue() публичный Метод

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.
Результат System

Max() публичный Метод

Gets the index for the maximum entry in the matrix.
public Max ( ) : MatrixIndex
Результат MatrixIndex

Min() публичный Метод

Gets the index for the minimum entry in the matrix.
public Min ( ) : MatrixIndex
Результат MatrixIndex

ModuloMS() публичный статический Метод

Matrix % Scalar
public static ModuloMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Результат MatrixValue

ModuloSM() публичный статический Метод

Scalar % Matrix
public static ModuloSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Результат MatrixValue

MultiplyMM() публичный статический Метод

Matrix * Matrix
public static MultiplyMM ( Value left, Value right ) : Value
left Value Must be a matrix.
right Value Must be a matrix.
Результат Value

MultiplyMS() публичный статический Метод

Matrix * Scalar
public static MultiplyMS ( Value left, Value right ) : MatrixValue
left Value Must be a matr.
right Value Must be a scalar.
Результат MatrixValue

MultiplySM() публичный статический Метод

Scalar * Matrix
public static MultiplySM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Результат MatrixValue

One() публичный статический Метод

Creates a new identity matrix of the given dimension.
public static One ( int dimension ) : MatrixValue
dimension int The rank of the identity matrix.
Результат MatrixValue

One() публичный статический Метод

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.
Результат MatrixValue

OneNorm() публичный Метод

Computes the 1-norm of the matrix.

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

public OneNorm ( ) : double
Результат double

Ones() публичный статический Метод

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.
Результат MatrixValue

Perform() публичный Метод

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.
Результат Value

Perform() публичный Метод

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.
Результат Value

PowMS() публичный статический Метод

Matrix ^ Scalar
public static PowMS ( Value basis, Value exponent ) : MatrixValue
basis Value Must be a matr.
exponent Value Must be a scalar.
Результат MatrixValue

PowSM() публичный статический Метод

Scalar ^ Matrix
public static PowSM ( Value basis, Value exponent ) : MatrixValue
basis Value Must be a scalar.
exponent Value Must be a matrix.
Результат MatrixValue

Randomize() публичный Метод

Goes over all rows and columns and randomizes the values.
public Randomize ( ) : void
Результат void

RegisterOperators() защищенный Метод

Registers all operators that are associated with the matrix.
protected RegisterOperators ( ) : void
Результат void

Serialize() публичный Метод

Serializes the current instance.
public Serialize ( ) : Byte[]
Результат Byte[]

SetColumnVector() публичный Метод

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.
Результат MatrixValue

SetRowVector() публичный Метод

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.
Результат MatrixValue

SubtractMM() публичный статический Метод

Matrix - Matrix
public static SubtractMM ( Value left, Value right ) : Value
left Value Must be a matrix.
right Value Must be a matrix.
Результат Value

SubtractMS() публичный статический Метод

Matrix - Scalar
public static SubtractMS ( Value left, Value right ) : MatrixValue
left Value Must be a matrix.
right Value Must be a scalar.
Результат MatrixValue

SubtractSM() публичный статический Метод

Scalar - Matrix
public static SubtractSM ( Value left, Value right ) : MatrixValue
left Value Must be a scalar.
right Value Must be a matrix.
Результат MatrixValue

Sum() публичный Метод

Computes the sum of all entries.
public Sum ( ) : ScalarValue
Результат ScalarValue

ToArray() публичный Метод

Copies the internal scalar values to a 1-dim. complex array.
public ToArray ( ) : YAMP.ScalarValue[]
Результат YAMP.ScalarValue[]

ToString() публичный Метод

Creates a standard string representation of the matrix.
public ToString ( ParseContext context ) : String
context ParseContext The parse content.
Результат String

ToString() публичный Метод

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.
Результат String

Trace() публичный Метод

Computes the trace (sum over all elements on the diagonal) of the matrix.
public Trace ( ) : ScalarValue
Результат ScalarValue

Transpose() публичный Метод

Computes the transposed matrix.
public Transpose ( ) : MatrixValue
Результат MatrixValue

VectorSort() публичный Метод

Sorts the values of the matrix and outputs the values in a new vector.
public VectorSort ( ) : MatrixValue
Результат MatrixValue

operator() публичный статический Метод

Inequality.
public static operator ( ) : System.Boolean
Результат System.Boolean

operator() публичный статический Метод

Multiplication.
public static operator ( ) : MatrixValue
Результат MatrixValue

this() публичный Метод

Gets or sets the i-th element of the matrix (counted rows-first).
public this ( int i ) : ScalarValue
i int The 1-based index.
Результат ScalarValue

this() публичный Метод

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.
Результат ScalarValue