IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::Matrix2d Class Reference

Matrix in a 2 dimensional space. More...

Inheritance diagram for IG::Num::Matrix2d:
Collaboration diagram for IG::Num::Matrix2d:

List of all members.

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

Detailed Description

Matrix in a 2 dimensional space.

$A Igor Jul08; Oct10;


Constructor & Destructor Documentation

IG::Num::Matrix2d::Matrix2d ( Matrix2d  m) [inline]

Copy constructor. Initializes components of a 2D matrix with components of another 2D matrix.

Parameters:
mMatrix 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.

Parameters:
mMatrix whose components are copied to the initialized matrix (should be 2*2).
IG::Num::Matrix2d::Matrix2d ( Vector2d  rowx,
Vector2d  rowy 
) [inline]

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.

Parameters:
vMatrix 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.

Parameters:
componentValue that is assigned to all matrix components.
IG::Num::Matrix2d::Matrix2d ( vec2  xrow,
vec2  yrow,
vec2  zrow 
) [inline]

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.

Parameters:
AArray from which a 2D matrix is constructed.
IG::Num::Matrix2d::Matrix2d ( double  A[,]) [inline]

Initializes a 2D matrix with elements of a rectangular array.

Parameters:
AArray from which a 2D matrix is constructed.

Member Function Documentation

static Matrix2d IG::Num::Matrix2d::Create ( Matrix2d  mat) [inline, static]

Creates and returns a 2D matrix that is a copy of another 2D matrix.

Parameters:
mat
Returns:
static Matrix2d IG::Num::Matrix2d::Create ( IMatrix  mat) [inline, static]

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.

Parameters:
matMatrix whose components are copied to the created matrix. Should be a 2*2 matrix, otherwisee exception is thrown.
Returns:
static Matrix2d IG::Num::Matrix2d::Create ( double  A[][]) [inline, static]

Constructs a matrix from a copy of a 2-D array by deep-copy.

Parameters:
ATwo-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.

Parameters:
ATwo-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.

static Matrix2d IG::Num::Matrix2d::CreateFromRows ( IList< Vector rowVectors) [inline, static]

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.

Parameters:
d1Number of rows.
d2Number of columns.
Returns:
An d1*d2 matrix with ones on the diagonal and zeros elsewhere.
static Matrix2d IG::Num::Matrix2d::Zeros ( ) [inline, static]

Creates a 2D matrix filled with 0.

Parameters:
d1Number of rows.
d2Number of columns.
static Matrix2d IG::Num::Matrix2d::Ones ( ) [inline, static]

Creates a 2D matrix filled with 1.

Parameters:
d1Number of rows.
d2Number of columns.
static Matrix2d IG::Num::Matrix2d::Diagonal ( IVector  diagonalVector) [inline, static]

Creates a new diagonal d1*d2 matrix based on the diagonal vector.

Parameters:
diagonalVectorThe values of the matrix diagonal.
d1Number of rows.
d2Number of columns.
Returns:
A d1*d2 matrix with the values from the diagonal vector on the diagonal and zeros elsewhere.
static Matrix2d IG::Num::Matrix2d::Random ( ) [inline, static]

Creates and returns a 2D matrix with uniformly distributed random elements in the [0, 1) interval.

Returns:
A 2D matrix with uniformly distributed random elements in [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.

Parameters:
rndRandom generator that is used for generation of elements.
Returns:
A 2D matrix with uniformly distributed random elements in [0, 1) interval.
virtual Matrix2d IG::Num::Matrix2d::GetCopyThis ( ) [inline, virtual]

Returns a copy of the current 2D matrix.

Returns:
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.

Parameters:
rowCountNumber fo rows of the newly created matrix. Must be 2.
columnCountNumber of columns of the newly created matrix. Must be 2.
Returns:
A newly created matrix of the specified dimensions and of the same type as the current matrix.

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.

Parameters:
lengthDimension of the newly created vector.
Returns:
A newly created vector of the specified dimension and of the same type as the current 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.

Parameters:
lengthDimension of the newly created vector.
Returns:
A newly created vector of the specified dimension and of the same type as the current 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.

Vector2d IG::Num::Matrix2d::Solve ( Vector2d  b) [inline]

Returns solution of system of equations with the current system matrix and the specified right-hand sides.

Parameters:
bVector of right-hand sides of equations.
Returns:
Matrix2d IG::Num::Matrix2d::Add ( Matrix2d  a) [inline]

Returns sum of the current matrix and the specified matrix.

Matrix2d IG::Num::Matrix2d::Subtract ( Matrix2d  a) [inline]

Returns difference between the current matrix and the specified matrix.

Matrix2d IG::Num::Matrix2d::MultiplyRight ( Matrix2d  b) [inline]

Right-multiplies the current 2D matrix with the specified matrix and returns the product.

Parameters:
bRight-hand side factor of multiplication.
Returns:
this*b
Matrix2d IG::Num::Matrix2d::MultiplyLeft ( Matrix2d  b) [inline]

Left-multiplies the current 2D matrix with the specified matrix and returns the product.

Parameters:
bLeft-hand side factor of multiplication.
Returns:
b*this
Vector2d IG::Num::Matrix2d::Multiply ( Vector2d  b) [inline]

Right-multiplies the current 2D matrix with the specified 2D vector and returns the product.

Parameters:
bRight-hand side factor of multiplication.
Returns:
this*b
Matrix2d IG::Num::Matrix2d::Multiply ( double  b) [inline]

Multiplies the current 2D matrix with the specified scalar and returns the product.

Parameters:
bFactor of multiplication.
Returns:
this*b
static Matrix2d IG::Num::Matrix2d::Copy ( Matrix2d  m) [inline, static]

Returns a copy of the specified 2D matrix.

Parameters:
mMatrix whose copy is returned.
static void IG::Num::Matrix2d::Negate ( Matrix2d  m,
ref Matrix2d  res 
) [inline, static]

Negates the specified 2D matrix and stores its copy in the resulting matrix.

Parameters:
vMatrix to be negated.
resMatrix where the result is stored.
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!

Parameters:
a2D Matrix whose eigenvalues and eigenvectors are calculated.
eigenvecMatrix where eigenvectors are stored as rows.
eigenvalVector where eigenvalues are stored.
Returns:
The number of different real eigenvalues.

$A Igor Aug08, Oct10;

static Matrix2d IG::Num::Matrix2d::operator+ ( Matrix2d  m) [inline, static]

Unary plus for 2D matrices, returns the operand.

static Matrix2d IG::Num::Matrix2d::operator- ( Matrix2d  a) [inline, static]

Unary negation for 2D matrices, returns the negative operand.

static Matrix2d IG::Num::Matrix2d::operator+ ( Matrix2d  a,
Matrix2d  b 
) [inline, static]

Matrix addition in 2D.

static Matrix2d IG::Num::Matrix2d::operator- ( Matrix2d  a,
Matrix2d  b 
) [inline, static]

Matrix subtraction in 2D.

static Matrix2d IG::Num::Matrix2d::operator* ( Matrix2d  a,
Matrix2d  b 
) [inline, static]

Matrix multiplication in 2D.

static Vector2d IG::Num::Matrix2d::operator* ( Matrix2d  a,
Vector2d  b 
) [inline, static]

Matrix with vector multiplication in 2D.

static Matrix2d IG::Num::Matrix2d::operator* ( Matrix2d  a,
double  b 
) [inline, static]

Product of a 2D matrix by a scalar.

static Matrix2d IG::Num::Matrix2d::operator* ( double  a,
Matrix2d  b 
) [inline, static]

Product of a 2D matrix by a scalar.

static Matrix2d IG::Num::Matrix2d::operator/ ( Matrix2d  a,
double  b 
) [inline, static]

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.

Parameters:
nameName of the matrix to be read; it is written as orientation to the user and can be null.

Member Data Documentation


Property Documentation

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.

Parameters:
iComponent index.
Returns:
The specified component of a 2D vector.

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events