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 : Matrix3D

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

### Class description:

> Matrix3D objects store an arbitrary sized 3D grid of arbitrary floating point data.

> Several of these matrix operations are built on top of the BLAS library and may be hardware accelerated on certain processors if the platform provides a hardware accelerated BLAS library. In particular, AltiVec acceleration is provided on G4 an G5 processors with Mac OS X.

> Hardware accelerated methods sometimes preform multiple operations simultaneously for the same computational cost. The add operation, for example, also scales one of the matrices being added. When using these methods, it is often beneficial to structure code to take advantage of all of the operations preformed. It is far more efficient to scale and add a matrix simultaneously using add than to first scale using scale and then add using add.

> Technical note: matrix objects are implemented using single precision floats, while much of the rest of the breve simulation environment uses double precision floating point math.

### Class methods:

> - add-scalar
> - add-values
> - compute-diffusion-matrix
> - compute-periodic-diffusion-matrix
> - copy
> - get-absolute-sum
> - get-value
> - init-with
> - multiply-with-values
> - scale
> - set-all-values
> - set-size
> - set-value
> - subtract-values

> Copying Slices of the 3D Matrix to Images

> - copy-slice-to-alpha-channel
> - copy-slice-to-blue-channel
> - copy-slice-to-red-channel
> - copy-sliced-to-green-channel

> Copying the Contents of the 3D Matrix to PatchGrids

> - copy-to-alpha-channel
> - copy-to-blue-channel
> - copy-to-green-channel
> - copy-to-red-channel

`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 diffiusion of the chemical.

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

>      0 0 0  0 1 0  0 0 0 0 1 0  1-6 1  0 1 0 0 0 0  0 1 0  0 0 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 diffiusion of the chemical.

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

>      0 0 0  0 1 0  0 0 0 0 1 0  1-6 1  0 1 0 0 0 0  0 1 0  0 0 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-slice-to-alpha-channel z-plane thePlane (int) of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the alpha channel of theImage, scaled by the optional scale argument.

> 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-slice-to-blue-channel z-plane thePlane (int) of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the blue channel of theImage. scaled by the optional scale argument.

> 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-slice-to-red-channel z-plane thePlane (int) of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the red channel of theImage, scaled by the optional scale argument.

> 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.

`copy-sliced-to-green-channel z-plane thePlane (int) of-image theImage (Image object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the green channel of theImage, scaled by the optional scale argument.

> 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-alpha-channel of-patch-grid grid (PatchGrid object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the alpha channel of the PatchGrid, scaled by the optional scale value.

`copy-to-blue-channel of-patch-grid grid (PatchGrid object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the blue channel of the PatchGrid, scaled by the optional scale value.

`copy-to-green-channel of-patch-grid grid (PatchGrid object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the green channel of the PatchGrid, scaled by the optional scale value.

`copy-to-red-channel of-patch-grid grid (PatchGrid object) with-scale scale = 1.0 (float)`

> Copies the contents of this matrix to the red channel of the PatchGrid, scaled by the optional scale value.

`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) at-z z (int)`

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

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

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

`multiply-with-values of otherMatrix (Matrix3D 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.

`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) z zSize (int)`

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

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

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

`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.

Documentation created Fri Aug 8 15:16:49 2008