SmartEngine  1.6.0
Public Member Functions | Properties | List of all members
SmartEngine.Matrix Class Reference

Wrapper around either a const or a mutable matrix. More...

Inheritance diagram for SmartEngine.Matrix:
SmartEngine.Object SmartEngine.Disposable

Public Member Functions

 Matrix (long rows, long cols)
 Creates a new Matrix instance with the specified rows and cols More...
 
float GetValue (long row, long col)
 Returns the value at location [row, col] More...
 
unsafe void GetRow (long row, ref float[] buffer)
 Fills the buffer with a single row from the matrix. The buffer should have space for at least RowCount() elements. More...
 
unsafe void GetBuffer (ref float[] buffer)
 Fills the buffer with all elements from this matrix. The elements in the buffer will be laid out in row major order ( R0C0, R0C1, R1C0, R1C1, etc). The buffer should have space for at least RowCount() * ColCount() elements. More...
 
void SetValue (long row, long col, float value)
 Sets a value in the matrix. This will error if the matrix is read only. More...
 
void Resize (long rows, long cols)
 Resizes the matrix to the specified number of rows and columns. This will error if the matrix is read only. More...
 
void Zero ()
 Assigns 0 to all values in the matrix. More...
 
bool HasNaN ()
 Returns true if any value is NaN, false otherwise. More...
 
- Public Member Functions inherited from SmartEngine.Object
void AddRef ()
 Increments the internal reference count on this object. It is not common to use this method directly. More...
 
void Release ()
 Decrements the internal reference count on this object. It is not common to use this method directly. More...
 
- Public Member Functions inherited from SmartEngine.Disposable
void Dispose ()
 Cleans up any internal state. It is not safe to use an object after it has been disposed. More...
 

Properties

bool IsReadOnly [get]
 Returns true if this matrix is read only. More...
 
long RowCount [get]
 Returns the number of rows in the matrix More...
 
long ColCount [get]
 Returns the number of columns in the matrix More...
 

Detailed Description

Wrapper around either a const or a mutable matrix.

Constructor & Destructor Documentation

◆ Matrix()

SmartEngine.Matrix.Matrix ( long  rows,
long  cols 
)

Creates a new Matrix instance with the specified rows and cols

Parameters
rows
cols

Member Function Documentation

◆ GetBuffer()

unsafe void SmartEngine.Matrix.GetBuffer ( ref float[]  buffer)

Fills the buffer with all elements from this matrix. The elements in the buffer will be laid out in row major order ( R0C0, R0C1, R1C0, R1C1, etc). The buffer should have space for at least RowCount() * ColCount() elements.

The passed in buffer will be created or resized if necessary.

◆ GetRow()

unsafe void SmartEngine.Matrix.GetRow ( long  row,
ref float[]  buffer 
)

Fills the buffer with a single row from the matrix. The buffer should have space for at least RowCount() elements.

The passed in buffer will be created or resized if necessary.

◆ GetValue()

float SmartEngine.Matrix.GetValue ( long  row,
long  col 
)

Returns the value at location [row, col]

◆ HasNaN()

bool SmartEngine.Matrix.HasNaN ( )

Returns true if any value is NaN, false otherwise.

◆ Resize()

void SmartEngine.Matrix.Resize ( long  rows,
long  cols 
)

Resizes the matrix to the specified number of rows and columns. This will error if the matrix is read only.

◆ SetValue()

void SmartEngine.Matrix.SetValue ( long  row,
long  col,
float  value 
)

Sets a value in the matrix. This will error if the matrix is read only.

◆ Zero()

void SmartEngine.Matrix.Zero ( )

Assigns 0 to all values in the matrix.

Property Documentation

◆ ColCount

long SmartEngine.Matrix.ColCount
get

Returns the number of columns in the matrix

◆ IsReadOnly

bool SmartEngine.Matrix.IsReadOnly
get

Returns true if this matrix is read only.

◆ RowCount

long SmartEngine.Matrix.RowCount
get

Returns the number of rows in the matrix