These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

## Matrix : Matrix2D

This class is included as part of the file Matrix.tz.
To use this class in a simulation, include the line "@use Matrix."

### Class methods:

> Setting the Matrix Size

> - init-with
> - set-size

> Methods to Get and Set Values

> - get-value
> - get-x-dimension
> - get-y-dimension
> - set-all-values
> - set-value

> Matrix Match Methods

> - add-scalar
> - add-values
> - compute-diffusion-matrix
> - compute-periodic-diffusion-matrix
> - copy
> - get-absolute-sum
> - multiply-with-values
> - scale
> - subtract-values
> - transform

> Methods for using Displaying Matrices

> - copy-to-blue-channel
> - copy-to-green-channel
> - copy-to-red-channel
> - print-matlab-style

`add-scalar value scalarValue (double)`

> Adds the number scalarValue to each element in the matrix.

`add-values of otherMatrix (object) scaled-by scale = 1.0 (double)`

> Adds this matrix to otherMatrix leaving the result in otherMatrix. The matrices must be of the same size. The optional argument scale allows otherMatrix to be scaled before adding it to this matrix.

> This method is hardware accelerated where supported.

`compute-diffusion-matrix from chemicalMatrix (object) with-scale scale = 1.0 (float)`

> Sets the contents of this matrix to a diffusion rate from the matrix chemicalMatrix. chemicalMatrix is treated as a matrix of spatial chemical concentrations, and the resulting diffusion matrix gives the approximate rates of diffusion of the chemical.

> This is done by sampling each concentration's local neighborhood according to the following matrix:

>      0 1 0 1 -4 1 0 1 0

> chemicalMatrix is assumed to have real boundary conditions so that the chemical will not flow beyond the edges of the matrix.

> The optional scale argument may be used to scale the resulting scale matrix.

`compute-periodic-diffusion-matrix from chemicalMatrix (object) with-scale scale = 1.0 (float)`

> Sets the contents of this matrix to a diffusion rate from the matrix chemicalMatrix. chemicalMatrix is treated as a matrix of spatial chemical concentrations, and the resulting diffusion matrix gives the approximate rates of diffusion of the chemical.

> This is done by sampling each concentration's local neighborhood according to the following matrix:

>      0 1 0 1 -4 1 0 1 0

> chemicalMatrix is assumed to have periodic boundary conditions so that the chemical will flow freely from the edges of the matrix to the other side.

> The optional scale argument may be used to scale the resulting scale matrix.

`copy from otherMatrix (object)`

> Copies the contents of otherMatrix to thisMatrix.

> This method is hardware accelerated where supported.

`copy-to-blue-channel of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the blue channel of theImage. The optional argument scale specifies how the matrix elements should be scaled.

> This method, and it's counterparts copy-to-red-channel and copy-to-green-channel are far faster than looping manually through the matrix values.

`copy-to-green-channel of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the green channel of theImage. The optional argument scale specifies how the matrix elements should be scaled.

> This method, and it's counterparts copy-to-blue-channel and copy-to-red-channel are far faster than looping manually through the matrix values.

`copy-to-red-channel of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the red channel of theImage. The optional argument scale specifies how the matrix elements should be scaled.

> This method, and it's counterparts copy-to-green-channel and copy-to-blue-channel are far faster than looping manually through the matrix values.

`get-absolute-sum`

> Returns the sum of the absolute values of all elements in this matrix.

> This method is hardware accelerated where supported.

`get-value at-x x (int) at-y y (int)`

> Returns the matrix value at position (x, y).

`get-x-dimension`

> Returns the x size of this matrix.

`get-y-dimension`

> Returns the y size of this matrix.

`init-with x-size xSize (int) y-size ySize (int)`

> sets the size to of this matrix to (sSize, ySize).

`multiply-with-values of otherMatrix (Matrix2D object)`

> Multiplies each element in this matrix with the corresponding element in otherMatrix. This is not regular matrix multiplication; rather, it is a way to scale each element in otherMatrix.

`print-matlab-style`

> Prints the matrix in a style similar to MATLAB.

`scale by scaleValue (float)`

> Scales all elements in the matrix by scaleValue.

> This method is hardware accelerated where supported.

`set-all-values to value (float)`

> Sets all of the values in the matrix to value.

`set-size x xSize (int) y ySize (int)`

> Sets the size of this matrix to (xSize, ySize).

`set-value to value (double) at-x x (int) at-y y (int)`

> Sets the matrix value at position (x, y).

`subtract-values of otherMatrix (object) scaled-by scale = 1.0 (double)`

> Subtracts this matrix from this otherMatrix, leaving the result in otherMatrix. This method uses the same mechanism as add, but using a negative scale argument. The optional argument scale allows otherMatrix to be scaled before subtracting it from this matrix.

> This method is hardware accelerated where supported.

`transform with-matrix transformation (Matrix2D object) with-result result (Matrix2D object)`

> Transforms this Vector with the Matrix2D matrix, storing the output in result.

Documentation created Fri Aug 8 15:16:49 2008