CMatrix Class


The CMatrix class manages a sparse 2-dimensional matrix. The members (or elements) of the matrix are usually numbers but may be any type of value, such as strings or references to other types. The matrix is organized as an array of CMatrixRow objects, with each CMatrix row managing an array of matrix elements.

CMatrix Class Topics

See the detailed description of the CMatrix class in Working with Matrices.

Usage

Construction

Object = CMatrix:new()

Destruction

Object:delete()

Properties (Variables)

This class has no exposed properties.

Construction

new

Creates a new instance of the CMatrix class.

delete

Deletes the instance of the CMatrix object.

Copy

Copies another CMatrix into this one.

Dup

Duplicates the current CMatrix into a new CMatrix and returns the new CMatrix.

Operations

Cols

Returns the maximum column index used in any row.

Count

Returns the number of rows actually initialized.

Dump

Lists all matrix elements in a text window.

Empty

Empties the contents of the CMatrix but does not delete it.

Exists

Returns true if a value exists at the (row, column) index.

Get

Returns the value at a (row, column) position in the matrix.

GetRow

Returns the CArray used for a row.

Init

Initializes all row x column entries to a value.

MaxColsUsed

Returns the maximum number of columns initialized in any row.

Members

Returns a count of total defined members.

Remove

Removes the value at a (row,column) index.

RemoveRow

Deletes an entire row from the matrix.

Rows

Returns the number the maximum row index used.

RowExists

Returns true if a specified row exists.

RowsUsed

Returns the number of rows actually initialized.

Set

Sets the value at a row, column index.

Math Operations

Normalize

Normalizes all element values to a volume of 1.0.

Volume

Returns the sum of all matrix members.

Related Topics

CArray class

CSet class

CImage class

Script Classes