# Matrix class

Namespace: [Rhino.Geometry](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.geometry.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
[Serializable]
public class Matrix : IDisposable, ISerializable
```

Represents an arbitrarily sized matrix of [double](https://learn.microsoft.com/dotnet/api/system.double)-precision floating point numbers. If you are working with a 4x4 matrix, then you may want to use the [Transform](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.transform.md) class instead.

## Constructors

- [Matrix](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/ctor.md): (3 overloads) Initializes a new instance of the matrix.

## Finalizer

- [~Matrix](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/finalize.md): Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().

## Properties

- [ColumnCount](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/columncount.md): Gets the amount of columns.
- [IsColumnOrthogonal](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/iscolumnorthogonal.md): Gets a value indicating whether the matrix is column orthogonal.
- [IsColumnOrthoNormal](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/iscolumnorthonormal.md): Gets a value indicating whether the matrix is column orthonormal.
- [IsRowOrthogonal](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/isroworthogonal.md): Gets a value indicating whether the matrix is row orthogonal.
- [IsRowOrthoNormal](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/isroworthonormal.md): Gets a value indicating whether the matrix is row orthonormal.
- [IsSquare](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/issquare.md): Gets a value indicating whether this matrix has the same number of rows and columns. 0x0 matrices are not considered square.
- [IsValid](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/isvalid.md): Gets a value indicating whether this matrix is valid.
- [RowCount](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/rowcount.md): Gets the amount of rows.

## Indexers

- [this[]](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/item.md): Gets or sets the matrix value at the given row and column indices.

## Methods

- [BackSolve](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/backsolve.md): Solves M*x=b where M is upper triangular with a unit diagonal and b is a column of values.
- [BackSolvePoints](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/backsolvepoints.md): Solves M*x=b where M is upper triangular with a unit diagonal and b is a column of 3d points.
- [Dispose](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/dispose.md): (2 overloads) Actively reclaims unmanaged resources that this instance uses.
- [Duplicate](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/duplicate.md): Create a duplicate of this matrix.
- [GetHashCode](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/gethashcode.md): Gets the hash code for this matrix. The hash code will change when the matrix changes so you cannot change matrices while they are stored in hash tables.
- [GetObjectData](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/getobjectdata.md): Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
- [Invert](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/invert.md): Modifies this matrix to become its own inverse. Matrix might be non-invertible (singular) and the return value will be false.
- [RowReduce](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/rowreduce.md): (3 overloads) Row reduces a matrix as the first step in solving M*X=b where b is a column of values.
- [Scale](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/scale.md): Modifies the current matrix by multiplying its values by a number.
- [SetDiagonal](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/setdiagonal.md): Sets diagonal value and zeros off all non-diagonal values.
- [SwapColumns](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/swapcolumns.md): Exchanges two columns.
- [SwapRows](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/swaprows.md): Exchanges two rows.
- [Transpose](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/transpose.md): Modifies this matrix to be its transpose. This is like swapping rows with columns. http://en.wikipedia.org/wiki/Transpose
- [Zero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/zero.md): Sets all values inside the matrix to zero.

## Operators

- [operator +](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/op-addition.md): (static) Adds two matrices and returns a new sum matrix.
- [operator *](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.matrix/op-multiply.md): (static) Multiplies two matrices and returns a new product matrix.
