IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Matrix in a 2 dimensional space. More...
Public Member Functions | |
Matrix2d (Matrix2d m) | |
Copy constructor. Initializes components of a 2D matrix with components of another 2D matrix. | |
Matrix2d (IMatrix m) | |
Constructor. Initializes components of a 2D matrix with components of another matrix. The specified matrix should be 2*2. | |
Matrix2d (Vector2d rowx, Vector2d rowy) | |
Initializes 2D matrix structure with the specified components. | |
Matrix2d (mat2 m) | |
Initializes components of a 2D matrix with components of the specified matrix. | |
Matrix2d (double xx, double xy, double yx, double yy) | |
Initializes 2D matrix structure with the specified components. | |
Matrix2d (double component) | |
Initializes 2D with the specified component. | |
Matrix2d (vec2 xrow, vec2 yrow, vec2 zrow) | |
Initializes 2D matrix structure with the specified components. | |
Matrix2d (double[][] A) | |
Initializes a 2D matrix with elements of a jagged array. | |
Matrix2d (double[,] A) | |
Initializes a 2D matrix with elements of a rectangular array. | |
virtual Matrix2d | GetCopyThis () |
Returns a copy of the current 2D matrix. | |
override MatrixBase | GetCopyBase () |
Returns a deep copy of the current 2D matrix. | |
Matrix2d | GetNewThis (int rowCount, int ColumnCount) |
Returns a copy of the current 2D matrix. | |
override MatrixBase | GetNewBase (int rowCount, int columnCount) |
Creates and returns a new 2D matrix with the specified dimensions, and of the same type as the current matrix. | |
Matrix2d | GetNewThis () |
Creates and returns a new matrix with the same dimensions and of the same type as the current matrix. | |
override MatrixBase | GetNewBase () |
Creates and returns a new matrix with the same dimensions and of the same type as the current matrix. | |
Vector2d | GetNewVectorThis (int length) |
Creates and returns a new vector with the specified dimension, and of the type that is consistent with the type of the current matrix. | |
override VectorBase | GetNewVectorBase (int length) |
Creates and returns a new vector with the specified dimension, and of the type that is consistent with the type of the current matrix. | |
override int | GetHashCode () |
Returns the hash code (hash function) of the current matrix. | |
override bool | Equals (Object obj) |
Returns a value indicating whether the specified object is equal to the current matrix. True is returned if the object is a non-null matrix (i.e. it implements the IMatrix interface), and has the same dimension and equal elements as the current matrix. | |
Matrix2d | NormalizedEuclidean () |
Returns this matrix normalized with Euclidean norm. | |
Matrix2d | NormalizedForbenius () |
Returns this matrix normalized with Euclidean norm. | |
Matrix2d | Normalized1 () |
Returns this matrix normalized with 1 norm. | |
Matrix2d | NormalizedInfinity () |
Returns this matrix normalized with infinity norm. | |
Vector2d | Solve (Vector2d b) |
Returns solution of system of equations with the current system matrix and the specified right-hand sides. | |
Matrix2d | Add (Matrix2d a) |
Returns sum of the current matrix and the specified matrix. | |
Matrix2d | Subtract (Matrix2d a) |
Returns difference between the current matrix and the specified matrix. | |
Matrix2d | MultiplyRight (Matrix2d b) |
Right-multiplies the current 2D matrix with the specified matrix and returns the product. | |
Matrix2d | MultiplyLeft (Matrix2d b) |
Left-multiplies the current 2D matrix with the specified matrix and returns the product. | |
Vector2d | Multiply (Vector2d b) |
Right-multiplies the current 2D matrix with the specified 2D vector and returns the product. | |
Matrix2d | Multiply (double b) |
Multiplies the current 2D matrix with the specified scalar and returns the product. | |
void | Read () |
Reads 2D matrix components from a console. | |
void | Read (string name) |
Reads 2D matrix components from a console. | |
Static Public Member Functions | |
static Matrix2d | Create (Matrix2d mat) |
Creates and returns a 2D matrix that is a copy of another 2D matrix. | |
static Matrix2d | Create (IMatrix mat) |
Creates and returns a 2D matrix that is a copy of another (general) matrix. That matrix should be a 2*2 matrix, otherwise exception is thrown. | |
static Matrix2d | Create (double[][] A) |
Constructs a matrix from a copy of a 2-D array by deep-copy. | |
static Matrix2d | Create (double[,] A) |
Constructs a 2D matrix from a copy of a 2-D array by deep-copy. | |
static Matrix2d | CreateFromColumns (IList< IVector > columnVectors) |
Construct a complex matrix from a set of real column vectors. | |
static Matrix2d | CreateFromRows (IList< Vector > rowVectors) |
Construct a complex matrix from a set of real row vectors. | |
static Matrix2d | Identity () |
Creates a d1*d2 identity matrix. | |
static Matrix2d | Zeros () |
Creates a 2D matrix filled with 0. | |
static Matrix2d | Ones () |
Creates a 2D matrix filled with 1. | |
static Matrix2d | Diagonal (IVector diagonalVector) |
Creates a new diagonal d1*d2 matrix based on the diagonal vector. | |
static Matrix2d | Random () |
Creates and returns a 2D matrix with uniformly distributed random elements in the [0, 1) interval. | |
static Matrix2d | Random (IRandomGenerator rnd) |
Creates and returns a 2D matrix with uniformly distributed random elements in the [0, 1) interval. | |
static Matrix2d | Copy (Matrix2d m) |
Returns a copy of the specified 2D matrix. | |
static void | Negate (Matrix2d m, ref Matrix2d res) |
Negates the specified 2D matrix and stores its copy in the resulting matrix. | |
static int | EigenSystem2d (Matrix2d a, ref Matrix2d eigenvec, ref Vector2d eigenval) |
Calculates eigenvectors and eigenvalues of a 2x2 matrix a and stores eigenvectors to lines of eigenvec and eigenvalues to eigenval. eigenvec can be the same matrix as a. The number of different real eigenvalues is returned. Ref.: linalg.nb Not tested yet! | |
static Matrix2d | operator+ (Matrix2d m) |
Unary plus for 2D matrices, returns the operand. | |
static Matrix2d | operator- (Matrix2d a) |
Unary negation for 2D matrices, returns the negative operand. | |
static Matrix2d | operator+ (Matrix2d a, Matrix2d b) |
Matrix addition in 2D. | |
static Matrix2d | operator- (Matrix2d a, Matrix2d b) |
Matrix subtraction in 2D. | |
static Matrix2d | operator* (Matrix2d a, Matrix2d b) |
Matrix multiplication in 2D. | |
static Vector2d | operator* (Matrix2d a, Vector2d b) |
Matrix with vector multiplication in 2D. | |
static Matrix2d | operator* (Matrix2d a, double b) |
Product of a 2D matrix by a scalar. | |
static Matrix2d | operator* (double a, Matrix2d b) |
Product of a 2D matrix by a scalar. | |
static Matrix2d | operator/ (Matrix2d a, double b) |
Division of a 2D matrix by a scalar. | |
Properties | |
override int | RowCount [get] |
Gets the first dimension (number of rows) of the 2D matrix, i.e. 2. | |
override int | ColumnCount [get] |
Gets the second dimension (number of columns) of the 2D matrix, i.e. 2. | |
mat2 | Mat [get, set] |
Gets the struct representation of this 2D matrix. | |
double | XX [get, set] |
XX component. | |
double | XY [get, set] |
XY component. | |
double | YX [get, set] |
YX component. | |
double | YY [get, set] |
YY component. | |
override double | this [int i, int j] [get, set] |
Index operator. | |
Vector2d | RowX [get, set] |
Gets or sets the x-row of the 2D matrix. | |
Vector2d | RowY [get, set] |
Gets or sets the y-row of the 2D matrix. | |
Vector2d | ColumnX [get, set] |
Gets or sets the x-column of the 2D matrix. | |
Vector2d | ColumnY [get, set] |
Gets or sets the y-column of the 2D matrix. | |
override double | NormEuclidean [get] |
Get Forbenius (or euclidean) norm of the matrix - square root of sum of squares of components. | |
override double | NormForbenius [get] |
Get Forbenius (or Euclidean) norm of the matrix - square root of sum of squares of components. | |
override double | Norm [get] |
Get Forbenius (or euclidean) norm of the matrix - square root of sum of squares of components. | |
double | Norm1 [get] |
Get the 1 norm of the matrix - maximum over columns of sum of absolute values of components. | |
double | NormInfinity [get] |
Get the infinity norm of the matrix - maximum over rows of sum of absolute values of components. | |
double | Determinant [get] |
Gets matrix determinant. | |
double | Det [get] |
Gets matrix determinant. | |
override double | Trace [get] |
Gets matrix trace (sum of diagonal elements). | |
new Matrix2d | T [get] |
Gets transpose of the current matrix. | |
Matrix2d | Inverse [get] |
Gets inverse of the current matrix. | |
Matrix2d | Inv [get] |
Gets inverse of the current matrix. | |
Private Member Functions | |
object ICloneable. | Clone () |
Returns a deep copy of a vector. | |
Private Attributes | |
mat2 | _m |
Matrix in a 2 dimensional space.
$A Igor Jul08; Oct10;
IG::Num::Matrix2d::Matrix2d | ( | Matrix2d | m | ) | [inline] |
Copy constructor. Initializes components of a 2D matrix with components of another 2D matrix.
m | Matrix whose components are copied to the initialized matrix. |
IG::Num::Matrix2d::Matrix2d | ( | IMatrix | m | ) | [inline] |
Constructor. Initializes components of a 2D matrix with components of another matrix. The specified matrix should be 2*2.
m | Matrix whose components are copied to the initialized matrix (should be 2*2). |
Initializes 2D matrix structure with the specified components.
IG::Num::Matrix2d::Matrix2d | ( | mat2 | m | ) | [inline] |
Initializes components of a 2D matrix with components of the specified matrix.
v | Matrix whose components are copied to the initialized matrix. |
IG::Num::Matrix2d::Matrix2d | ( | double | xx, |
double | xy, | ||
double | yx, | ||
double | yy | ||
) | [inline] |
Initializes 2D matrix structure with the specified components.
IG::Num::Matrix2d::Matrix2d | ( | double | component | ) | [inline] |
Initializes 2D with the specified component.
component | Value that is assigned to all matrix components. |
Initializes 2D matrix structure with the specified components.
IG::Num::Matrix2d::Matrix2d | ( | double | A[][] | ) | [inline] |
Initializes a 2D matrix with elements of a jagged array.
A | Array from which a 2D matrix is constructed. |
IG::Num::Matrix2d::Matrix2d | ( | double | A[,] | ) | [inline] |
Initializes a 2D matrix with elements of a rectangular array.
A | Array from which a 2D matrix is constructed. |
Creates and returns a 2D matrix that is a copy of another 2D matrix.
mat |
Creates and returns a 2D matrix that is a copy of another (general) matrix. That matrix should be a 2*2 matrix, otherwise exception is thrown.
mat | Matrix whose components are copied to the created matrix. Should be a 2*2 matrix, otherwisee exception is thrown. |
static Matrix2d IG::Num::Matrix2d::Create | ( | double | A[][] | ) | [inline, static] |
Constructs a matrix from a copy of a 2-D array by deep-copy.
A | Two-dimensional array of doubles. |
static Matrix2d IG::Num::Matrix2d::Create | ( | double | A[,] | ) | [inline, static] |
Constructs a 2D matrix from a copy of a 2-D array by deep-copy.
A | Two-dimensional array of doubles. |
static Matrix2d IG::Num::Matrix2d::CreateFromColumns | ( | IList< IVector > | columnVectors | ) | [inline, static] |
Construct a complex matrix from a set of real column vectors.
Construct a complex matrix from a set of real row vectors.
static Matrix2d IG::Num::Matrix2d::Identity | ( | ) | [inline, static] |
Creates a d1*d2 identity matrix.
d1 | Number of rows. |
d2 | Number of columns. |
static Matrix2d IG::Num::Matrix2d::Zeros | ( | ) | [inline, static] |
Creates a 2D matrix filled with 0.
d1 | Number of rows. |
d2 | Number of columns. |
static Matrix2d IG::Num::Matrix2d::Ones | ( | ) | [inline, static] |
Creates a 2D matrix filled with 1.
d1 | Number of rows. |
d2 | Number of columns. |
Creates a new diagonal d1*d2 matrix based on the diagonal vector.
diagonalVector | The values of the matrix diagonal. |
d1 | Number of rows. |
d2 | Number of columns. |
static Matrix2d IG::Num::Matrix2d::Random | ( | ) | [inline, static] |
Creates and returns a 2D matrix with uniformly distributed random elements in the [0, 1) interval.
[0, 1)
interval.static Matrix2d IG::Num::Matrix2d::Random | ( | IRandomGenerator | rnd | ) | [inline, static] |
Creates and returns a 2D matrix with uniformly distributed random elements in the [0, 1) interval.
rnd | Random generator that is used for generation of elements. |
[0, 1)
interval.virtual Matrix2d IG::Num::Matrix2d::GetCopyThis | ( | ) | [inline, virtual] |
Returns a copy of the current 2D matrix.
override MatrixBase IG::Num::Matrix2d::GetCopyBase | ( | ) | [inline, virtual] |
Returns a deep copy of the current 2D matrix.
Implements IG::Num::MatrixBase.
Matrix2d IG::Num::Matrix2d::GetNewThis | ( | int | rowCount, |
int | ColumnCount | ||
) | [inline] |
Returns a copy of the current 2D matrix.
override MatrixBase IG::Num::Matrix2d::GetNewBase | ( | int | rowCount, |
int | columnCount | ||
) | [inline, virtual] |
Creates and returns a new 2D matrix with the specified dimensions, and of the same type as the current matrix.
rowCount | Number fo rows of the newly created matrix. Must be 2. |
columnCount | Number of columns of the newly created matrix. Must be 2. |
Implements IG::Num::MatrixBase.
Matrix2d IG::Num::Matrix2d::GetNewThis | ( | ) | [inline] |
Creates and returns a new matrix with the same dimensions and of the same type as the current matrix.
override MatrixBase IG::Num::Matrix2d::GetNewBase | ( | ) | [inline, virtual] |
Creates and returns a new matrix with the same dimensions and of the same type as the current matrix.
Implements IG::Num::MatrixBase.
Vector2d IG::Num::Matrix2d::GetNewVectorThis | ( | int | length | ) | [inline] |
Creates and returns a new vector with the specified dimension, and of the type that is consistent with the type of the current matrix.
length | Dimension of the newly created vector. |
override VectorBase IG::Num::Matrix2d::GetNewVectorBase | ( | int | length | ) | [inline, virtual] |
Creates and returns a new vector with the specified dimension, and of the type that is consistent with the type of the current matrix.
length | Dimension of the newly created vector. |
Implements IG::Num::MatrixBase.
override int IG::Num::Matrix2d::GetHashCode | ( | ) | [inline] |
Returns the hash code (hash function) of the current matrix.
This method calls the MatrixBase.GetHashCode to calculate the hash code, which is standard for all implementations of the IMatrix interface.
Two matrices that have the same dimensions and equal elements will produce the same hash codes.
Probability that two different matrices will produce the same hash code is small but it exists.
Overrides the object.GetHashCode method.
Reimplemented from IG::Num::MatrixBase.
override bool IG::Num::Matrix2d::Equals | ( | Object | obj | ) | [inline] |
Returns a value indicating whether the specified object is equal to the current matrix. True is returned if the object is a non-null matrix (i.e. it implements the IMatrix interface), and has the same dimension and equal elements as the current matrix.
This method calls the MatrixBase.Equals to obtain the returned value, which is standard for all implementations of the IMatrix interface.
Overrides the object.Equals method.
Reimplemented from IG::Num::MatrixBase.
Matrix2d IG::Num::Matrix2d::NormalizedEuclidean | ( | ) | [inline] |
Returns this matrix normalized with Euclidean norm.
Matrix2d IG::Num::Matrix2d::NormalizedForbenius | ( | ) | [inline] |
Returns this matrix normalized with Euclidean norm.
Matrix2d IG::Num::Matrix2d::Normalized1 | ( | ) | [inline] |
Returns this matrix normalized with 1 norm.
Matrix2d IG::Num::Matrix2d::NormalizedInfinity | ( | ) | [inline] |
Returns this matrix normalized with infinity norm.
Returns solution of system of equations with the current system matrix and the specified right-hand sides.
b | Vector of right-hand sides of equations. |
Returns sum of the current matrix and the specified matrix.
Returns difference between the current matrix and the specified matrix.
Right-multiplies the current 2D matrix with the specified matrix and returns the product.
b | Right-hand side factor of multiplication. |
Left-multiplies the current 2D matrix with the specified matrix and returns the product.
b | Left-hand side factor of multiplication. |
Right-multiplies the current 2D matrix with the specified 2D vector and returns the product.
b | Right-hand side factor of multiplication. |
Matrix2d IG::Num::Matrix2d::Multiply | ( | double | b | ) | [inline] |
Multiplies the current 2D matrix with the specified scalar and returns the product.
b | Factor of multiplication. |
Returns a copy of the specified 2D matrix.
m | Matrix whose copy is returned. |
static int IG::Num::Matrix2d::EigenSystem2d | ( | Matrix2d | a, |
ref Matrix2d | eigenvec, | ||
ref Vector2d | eigenval | ||
) | [inline, static] |
Calculates eigenvectors and eigenvalues of a 2x2 matrix a and stores eigenvectors to lines of eigenvec and eigenvalues to eigenval. eigenvec can be the same matrix as a. The number of different real eigenvalues is returned. Ref.: linalg.nb Not tested yet!
a | 2D Matrix whose eigenvalues and eigenvectors are calculated. |
eigenvec | Matrix where eigenvectors are stored as rows. |
eigenval | Vector where eigenvalues are stored. |
$A Igor Aug08, Oct10;
Unary plus for 2D matrices, returns the operand.
Unary negation for 2D matrices, returns the negative operand.
Matrix addition in 2D.
Matrix subtraction in 2D.
Matrix multiplication in 2D.
Matrix with vector multiplication in 2D.
Product of a 2D matrix by a scalar.
Product of a 2D matrix by a scalar.
Division of a 2D matrix by a scalar.
object ICloneable. IG::Num::Matrix2d::Clone | ( | ) | [inline, private] |
Returns a deep copy of a vector.
void IG::Num::Matrix2d::Read | ( | ) | [inline] |
Reads 2D matrix components from a console.
void IG::Num::Matrix2d::Read | ( | string | name | ) | [inline] |
Reads 2D matrix components from a console.
name | Name of the matrix to be read; it is written as orientation to the user and can be null. |
mat2 IG::Num::Matrix2d::_m [private] |
override int IG::Num::Matrix2d::RowCount [get] |
Gets the first dimension (number of rows) of the 2D matrix, i.e. 2.
Reimplemented from IG::Num::MatrixBase.
override int IG::Num::Matrix2d::ColumnCount [get] |
Gets the second dimension (number of columns) of the 2D matrix, i.e. 2.
Reimplemented from IG::Num::MatrixBase.
mat2 IG::Num::Matrix2d::Mat [get, set, protected] |
Gets the struct representation of this 2D matrix.
double IG::Num::Matrix2d::XX [get, set] |
XX component.
double IG::Num::Matrix2d::XY [get, set] |
XY component.
double IG::Num::Matrix2d::YX [get, set] |
YX component.
double IG::Num::Matrix2d::YY [get, set] |
YY component.
override double IG::Num::Matrix2d::this[int i, int j] [get, set] |
Index operator.
i | Component index. |
Reimplemented from IG::Num::MatrixBase.
Vector2d IG::Num::Matrix2d::RowX [get, set] |
Gets or sets the x-row of the 2D matrix.
Vector2d IG::Num::Matrix2d::RowY [get, set] |
Gets or sets the y-row of the 2D matrix.
Vector2d IG::Num::Matrix2d::ColumnX [get, set] |
Gets or sets the x-column of the 2D matrix.
Vector2d IG::Num::Matrix2d::ColumnY [get, set] |
Gets or sets the y-column of the 2D matrix.
override double IG::Num::Matrix2d::NormEuclidean [get] |
Get Forbenius (or euclidean) norm of the matrix - square root of sum of squares of components.
Reimplemented from IG::Num::MatrixBase.
override double IG::Num::Matrix2d::NormForbenius [get] |
Get Forbenius (or Euclidean) norm of the matrix - square root of sum of squares of components.
Reimplemented from IG::Num::MatrixBase.
override double IG::Num::Matrix2d::Norm [get] |
Get Forbenius (or euclidean) norm of the matrix - square root of sum of squares of components.
Reimplemented from IG::Num::MatrixBase.
double IG::Num::Matrix2d::Norm1 [get] |
Get the 1 norm of the matrix - maximum over columns of sum of absolute values of components.
double IG::Num::Matrix2d::NormInfinity [get] |
Get the infinity norm of the matrix - maximum over rows of sum of absolute values of components.
double IG::Num::Matrix2d::Determinant [get] |
Gets matrix determinant.
double IG::Num::Matrix2d::Det [get] |
Gets matrix determinant.
override double IG::Num::Matrix2d::Trace [get] |
Gets matrix trace (sum of diagonal elements).
Reimplemented from IG::Num::MatrixBase.
new Matrix2d IG::Num::Matrix2d::T [get] |
Gets transpose of the current matrix.
Reimplemented from IG::Num::MatrixBase.
Matrix2d IG::Num::Matrix2d::Inverse [get] |
Gets inverse of the current matrix.
Matrix2d IG::Num::Matrix2d::Inv [get] |
Gets inverse of the current matrix.