Agilent T&M Toolkit 2.0 New Features: Matrix Support

Agilent T&M Toolkit 2.0 for Visual Studio .NET 2003 now provides Matrix and ComplexMatrix types.  You can use the Matrix type like so:

using Agilent.TMFramework;
using Agilent.TMFramework.DataAnalysis;

Matrix m1 = new Matrix(new double[,] {{1.0, 2.0, 3.0},{4.0, 5.0, 6.0}});
Matrix m2 = new Matrix(new double[,] {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}});
Matrix m3 = m1 * m2;
double determinant = m3.Determinant();

Here is all the functionality available on the Matrix type (ComplexMatrix functionality is very similar):

public sealed class Matrix : System.ICloneable
{
public Matrix(double[,] array);
public Matrix(int numRows, int numColumns);
public Matrix Clone();
public double[,] Array { get; }
public double this[int rowIndex, int columnIndex] { get; set; }
public bool IsDiagonal { get; }
public bool IsSquare { get; }
public bool IsSymmetric { get; }
public int NumColumns { get; }
public int NumRows { get; }
public double Determinant();
public Matrix GetSubMatrix(int[] row, int[] column);
public Matrix GetSubMatrix(int[] row, int startColumn, int endColumn);
public Matrix GetSubMatrix(int startRow, int endRow, int[] column);
public Matrix GetSubMatrix(int startRow, int endRow, int startColumn, int endColumn);
public Matrix Inverse();
public Matrix LU();
public double Norm();
public double[] Svd();
public double Trace();
public Matrix Transpose();

public override bool Equals(object obj);
public bool Equals(Matrix matrix);
public override int GetHashCode();
public override string ToString();

public Matrix Add(Matrix matrix);
public Matrix Subtract(Matrix matrix);
public Matrix Divide(Matrix matrix);
public Matrix Divide(double value);
public Matrix Multiply(Matrix matrix);
public Matrix Multiply(double value);
public Matrix Negate();

public static bool AlmostEquals(Matrix matrix1, Matrix matrix2, double epsilon);
public static bool AlmostEquals(Matrix matrix1, Matrix matrix2);
public static void Svd(Matrix matrix, out Matrix u, out Matrix v, out Matrix s);
public static Matrix Diagonal(int numRows, double diagonalValue);
public static Matrix Identity(int numRows);
public static Matrix operator *(Matrix matrixA, Matrix matrixB);
public static Matrix operator *(Matrix matrix, double value);
public static Matrix operator +(Matrix matrixA, Matrix matrixB);
public static Matrix operator -(Matrix matrixA, Matrix matrixB);
public static Matrix operator /(Matrix matrixA, Matrix matrixB);
public static Matrix operator /(Matrix matrix, double value);
public static bool   operator ==(Matrix matrixA, Matrix matrixB);
public static bool   operator !=(Matrix matrixA, Matrix matrixB);
public static Matrix operator -(Matrix matrix);
}

Advertisements
This entry was posted in Agilent T&M Toolkit. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s