Top Description Fields Constructors Methods
javax.vecmath

public Class GMatrix

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.lang.Math

A double precision, general, dynamically-resizable, two-dimensional matrix class. Row and column numbering begins with zero. The representation is row major.

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final double
pack-priv int
pack-priv int
pack-priv static final long
pack-priv double[][]

Constructor Summary

AccessConstructor and Description
public
GMatrix(int
number of rows in this matrix.
nRow
,
int
number of columns in this matrix.
nCol
)

Constructs an nRow by NCol identity matrix.

public
GMatrix(int
number of rows in this matrix.
nRow
,
int
number of columns in this matrix.
nCol
,
double[]
a 1D array that specifies a matrix in row major fashion
matrix
)

Constructs an nRow by nCol matrix initialized to the values in the matrix array.

public
GMatrix(GMatrix
the source of the initial values of the new GMatrix
matrix
)

Constructs a new GMatrix and copies the initial values from the parameter matrix.

Method Summary

Modifier and TypeMethod and Description
public final void
add(GMatrix
the other matrix
m1
)

Sets the value of this matrix to sum of itself and matrix m1.

public final void
add(GMatrix
the first matrix
m1
,
GMatrix
the second matrix
m2
)

Sets the value of this matrix to the matrix sum of matrices m1 and m2.

private static void
chase_across(double[] s, double[] e, int k, GMatrix u)

private static void
chase_up(double[] s, double[] e, int k, GMatrix v)

private static void
public Object

Returns:

a clone of this instance.
clone
()

Overrides java.lang.Object.clone.

Creates a new object of the same class as this object.
pack-priv static int
compute_2X2(double f, double g, double h, double[] single_values, double[] snl, double[] csl, double[] snr, double[] csr, int index)

pack-priv static void
compute_qr(int start, int end, double[] s, double[] e, GMatrix u, GMatrix v)

pack-priv static double
compute_rot(double f, double g, double[] sin, double[] cos)

pack-priv static double
compute_shift(double f, double g, double h)

pack-priv static int
public final void
copySubMatrix(int
the top-most row of the sub-matrix
rowSource
,
int
the left-most column of the sub-matrix
colSource
,
int
the number of rows in the sub-matrix
numRow
,
int
the number of columns in the sub-matrix
numCol
,
int
the top-most row of the position of the copied sub-matrix within the target matrix
rowDest
,
int
the left-most column of the position of the copied sub-matrix within the target matrix
colDest
,
GMatrix
the matrix into which the sub-matrix will be copied
target
)

Copies a sub-matrix derived from this matrix into the target matrix.

pack-priv static double
d_sign(double a, double b)

public boolean
epsilonEquals(GMatrix m1, float epsilon)

Deprecated Use epsilonEquals(GMatrix, double) instead
public boolean
epsilonEquals(GMatrix
The matrix to be compared to this matrix
m1
,
double
the threshold value
epsilon
)

Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false.

public boolean

Returns:

true or false
equals
(GMatrix
The matrix with which the comparison is made.
m1
)

Returns true if all of the data members of GMatrix m1 are equal to the corresponding data members in this GMatrix.

public boolean

Returns:

true or false
equals
(Object
The object with which the comparison is made.
o1
)

Overrides java.lang.Object.equals.

Returns true if the Object o1 is of type GMatrix and all of the data members of o1 are equal to the corresponding data members in this GMatrix.
public final void
get(Matrix3d
The matrix that will hold the new values
m1
)

Places the values in the upper 3x3 of this GMatrix into the matrix m1.

public final void
get(Matrix3f
The matrix that will hold the new values
m1
)

Places the values in the upper 3x3 of this GMatrix into the matrix m1.

public final void
get(Matrix4d
The matrix that will hold the new values
m1
)

Places the values in the upper 4x4 of this GMatrix into the matrix m1.

public final void
get(Matrix4f
The matrix that will hold the new values
m1
)

Places the values in the upper 4x4 of this GMatrix into the matrix m1.

public final void
get(GMatrix
The matrix that will hold the new values
m1
)

Places the values in the this GMatrix into the matrix m1; m1 should be at least as large as this GMatrix.

public final void
getColumn(int
the target column number
col
,
double[]
the array into which the column values will be placed
array
)

Places the values of the specified column into the array parameter.

public final void
getColumn(int
the target column number
col
,
GVector
the vector into which the column values will be placed
vector
)

Places the values of the specified column into the vector parameter.

public final double

Returns:

the value at the indexed element
getElement
(int
the row number to be retrieved (zero indexed)
row
,
int
the column number to be retrieved (zero indexed)
column
)

Retrieves the value at the specified row and column of this matrix.

public final int

Returns:

number of columns in this matrix
getNumCol
()

Returns the number of colmuns in this matrix.

public final int

Returns:

number of rows in this matrix
getNumRow
()

Returns the number of rows in this matrix.

public final void
getRow(int
the target row number
row
,
double[]
the array into which the row values will be placed
array
)

Places the values of the specified row into the array parameter.

public final void
getRow(int
the target row number
row
,
GVector
the vector into which the row values will be placed
vector
)

Places the values of the specified row into the vector parameter.

public int

Returns:

the integer hash code value
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value based on the data values in this object.
public final void
identityMinus()

Subtracts this matrix from the identity matrix and puts the values back into this (this = I - this).

public final void
invert()

Inverts this matrix in place.

public final void
invert(GMatrix
the matrix to be inverted
m1
)

Inverts matrix m1 and places the new values into this matrix.

pack-priv final void
invertGeneral(GMatrix m1)

General invert routine.

pack-priv static void
luBacksubstitution(int dim, double[] matrix1, int[] row_perm, double[] matrix2)

Solves a set of linear equations.

public final int

Returns:

+-1 depending on whether the number of row interchanges was even or odd respectively
LUD
(GMatrix
The matrix into which the lower and upper decompositions will be placed.
LU
,
GVector
The row permutation effected by the partial pivoting
permutation
)

LU Decomposition: this matrix must be a square matrix and the LU GMatrix parameter must be the same size as this matrix.

pack-priv static boolean

Returns:

true if the matrix is nonsingular, or false otherwise.
luDecomposition
(int dim, double[] matrix0, int[] row_perm, int[] even_row_xchg)

Given a nxn array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself.

pack-priv static double
max(double a, double b)

pack-priv static double
min(double a, double b)

public final void
mul(GMatrix
the other matrix
m1
)

Sets the value of this matrix to the result of multiplying itself with matrix m1 (this = this * m1).

public final void
mul(GMatrix
the first matrix
m1
,
GMatrix
the second matrix
m2
)

Sets the value of this matrix to the result of multiplying the two argument matrices together (this = m1 * m2).

public final void
mul(GVector
the first vector, treated as a row vector
v1
,
GVector
the second vector, treated as a column vector
v2
)

Computes the outer product of the two vectors; multiplies the the first vector by the transpose of the second vector and places the matrix result into this matrix.

public final void
mulTransposeBoth(GMatrix
The matrix on the left hand side of the multiplication
m1
,
GMatrix
The matrix on the right hand side of the multiplication
m2
)

Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.

public final void
mulTransposeLeft(GMatrix
The matrix on the left hand side of the multiplication
m1
,
GMatrix
The matrix on the right hand side of the multiplication
m2
)

Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.

public final void
mulTransposeRight(GMatrix
The matrix on the left hand side of the multiplication
m1
,
GMatrix
The matrix on the right hand side of the multiplication
m2
)

Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.

public final void
negate()

Negates the value of this matrix: this = -this.

public final void
negate(GMatrix
The source matrix
m1
)

Sets the value of this matrix equal to the negation of of the GMatrix parameter.

public final void
set(double[]
the row major source array
matrix
)

Sets the value of this matrix to the values found in the array parameter.

public final void
set(Matrix3f
the matrix
m1
)

Sets the value of this matrix to that of the Matrix3f provided.

public final void
set(Matrix3d
the matrix
m1
)

Sets the value of this matrix to that of the Matrix3d provided.

public final void
set(Matrix4f
the matrix
m1
)

Sets the value of this matrix to that of the Matrix4f provided.

public final void
set(Matrix4d
the matrix
m1
)

Sets the value of this matrix to that of the Matrix4d provided.

public final void
set(GMatrix
the source matrix
m1
)

Sets the value of this matrix to the values found in matrix m1.

public final void
setColumn(int
the column of this matrix into which the array values will be copied
col
,
double[]
the source array
array
)

Copy the values from the array into the specified column of this matrix.

public final void
setColumn(int
the column of this matrix into which the array values will be copied
col
,
GVector
the source vector
vector
)

Copy the values from the vector into the specified column of this matrix.

public final void
setElement(int
the row number to be modified (zero indexed)
row
,
int
the column number to be modified (zero indexed)
column
,
double
the new matrix element value
value
)

Modifies the value at the specified row and column of this matrix.

public final void
setIdentity()

Sets this GMatrix to the identity matrix.

public final void
setRow(int
the row of this matrix into which the array values will be copied.
row
,
double[]
the source array
array
)

Copy the values from the array into the specified row of this matrix.

public final void
setRow(int
the row of this matrix into which the array values will be copied
row
,
GVector
the source vector
vector
)

Copy the values from the vector into the specified row of this matrix.

public final void
setScale(double
The new scale value
scale
)

Sets this matrix to a uniform scale matrix; all of the values are reset.

public final void
setSize(int
number of desired rows in this matrix
nRow
,
int
number of desired columns in this matrix
nCol
)

Changes the size of this matrix dynamically.

public final void
setZero()

Sets all the values in this matrix to zero.

public final void
sub(GMatrix
the other matrix
m1
)

Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).

public final void
sub(GMatrix
the first matrix
m1
,
GMatrix
the second matrix
m2
)

Sets the value of this matrix to the matrix difference of matrices m1 and m2 (this = m1 - m2).

public final int

Returns:

The rank of this matrix.
SVD
(GMatrix
The computed U matrix in the equation this = U*W*transpose(V)
U
,
GMatrix
The computed W matrix in the equation this = U*W*transpose(V)
W
,
GMatrix
The computed V matrix in the equation this = U*W*transpose(V)
V
)

Finds the singular value decomposition (SVD) of this matrix such that this = U*W*transpose(V); and returns the rank of this matrix; the values of U,W,V are all overwritten.

public String

Returns:

the String representation
toString
()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this GMatrix.
private static String
public final double

Returns:

the trace of this matrix
trace
()

Returns the trace of this matrix.

public final void
transpose()

Transposes this matrix in place.

public final void
transpose(GMatrix
the matrix to be transposed (but not modified)
m1
)

Places the matrix values of the transpose of matrix m1 into this matrix.

private static void
update_u(int index, GMatrix u, double[] cosl, double[] sinl)

private static void
update_u_split(int topr, int bottomr, GMatrix u, double[] cosl, double[] sinl, GMatrix t, GMatrix m)

private static void
update_v(int index, GMatrix v, double[] cosr, double[] sinr)

private static void
update_v_split(int topr, int bottomr, GMatrix v, double[] cosr, double[] sinr, GMatrix t, GMatrix m)

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

debugback to summary
private static final boolean debug
EPSback to summary
private static final double EPS
nColback to summary
pack-priv int nCol
nRowback to summary
pack-priv int nRow
serialVersionUIDback to summary
pack-priv static final long serialVersionUID
valuesback to summary
pack-priv double[][] values

Constructor Detail

GMatrixback to summary
public GMatrix(int nRow, int nCol)

Constructs an nRow by NCol identity matrix. Note that because row and column numbering begins with zero, nRow and nCol will be one larger than the maximum possible matrix index values.

Parameters
nRow:int

number of rows in this matrix.

nCol:int

number of columns in this matrix.

GMatrixback to summary
public GMatrix(int nRow, int nCol, double[] matrix)

Constructs an nRow by nCol matrix initialized to the values in the matrix array. The array values are copied in one row at a time in row major fashion. The array should be at least nRow*nCol in length. Note that because row and column numbering begins with zero, nRow and nCol will be one larger than the maximum possible matrix index values.

Parameters
nRow:int

number of rows in this matrix.

nCol:int

number of columns in this matrix.

matrix:double[]

a 1D array that specifies a matrix in row major fashion

GMatrixback to summary
public GMatrix(GMatrix matrix)

Constructs a new GMatrix and copies the initial values from the parameter matrix.

Parameters
matrix:GMatrix

the source of the initial values of the new GMatrix

Method Detail

addback to summary
public final void add(GMatrix m1)

Sets the value of this matrix to sum of itself and matrix m1.

Parameters
m1:GMatrix

the other matrix

addback to summary
public final void add(GMatrix m1, GMatrix m2)

Sets the value of this matrix to the matrix sum of matrices m1 and m2.

Parameters
m1:GMatrix

the first matrix

m2:GMatrix

the second matrix

chase_acrossback to summary
private static void chase_across(double[] s, double[] e, int k, GMatrix u)
chase_upback to summary
private static void chase_up(double[] s, double[] e, int k, GMatrix v)
checkMatrixback to summary
private static void checkMatrix(GMatrix m)
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Creates a new object of the same class as this object.

Returns:Object

a clone of this instance.

Exceptions
OutOfMemoryError:
if there is not enough memory.
Since
vecmath 1.3
See Also
java.lang.Cloneable
compute_2X2back to summary
pack-priv static int compute_2X2(double f, double g, double h, double[] single_values, double[] snl, double[] csl, double[] snr, double[] csr, int index)
compute_qrback to summary
pack-priv static void compute_qr(int start, int end, double[] s, double[] e, GMatrix u, GMatrix v)
compute_rotback to summary
pack-priv static double compute_rot(double f, double g, double[] sin, double[] cos)
compute_shiftback to summary
pack-priv static double compute_shift(double f, double g, double h)
computeSVDback to summary
pack-priv static int computeSVD(GMatrix mat, GMatrix U, GMatrix W, GMatrix V)
copySubMatrixback to summary
public final void copySubMatrix(int rowSource, int colSource, int numRow, int numCol, int rowDest, int colDest, GMatrix target)

Copies a sub-matrix derived from this matrix into the target matrix. The upper left of the sub-matrix is located at (rowSource, colSource); the lower right of the sub-matrix is located at (lastRowSource,lastColSource). The sub-matrix is copied into the the target matrix starting at (rowDest, colDest).

Parameters
rowSource:int

the top-most row of the sub-matrix

colSource:int

the left-most column of the sub-matrix

numRow:int

the number of rows in the sub-matrix

numCol:int

the number of columns in the sub-matrix

rowDest:int

the top-most row of the position of the copied sub-matrix within the target matrix

colDest:int

the left-most column of the position of the copied sub-matrix within the target matrix

target:GMatrix

the matrix into which the sub-matrix will be copied

d_signback to summary
pack-priv static double d_sign(double a, double b)
epsilonEqualsback to summary
public boolean epsilonEquals(GMatrix m1, float epsilon)

Deprecated

Use epsilonEquals(GMatrix, double) instead

epsilonEqualsback to summary
public boolean epsilonEquals(GMatrix m1, double epsilon)

Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[i=0,1,2, . . .n ; j=0,1,2, . . .n ; abs(this.m(i,j) - m1.m(i,j)]

Parameters
m1:GMatrix

The matrix to be compared to this matrix

epsilon:double

the threshold value

equalsback to summary
public boolean equals(GMatrix m1)

Returns true if all of the data members of GMatrix m1 are equal to the corresponding data members in this GMatrix.

Parameters
m1:GMatrix

The matrix with which the comparison is made.

Returns:boolean

true or false

equalsback to summary
public boolean equals(Object o1)

Overrides java.lang.Object.equals.

Returns true if the Object o1 is of type GMatrix and all of the data members of o1 are equal to the corresponding data members in this GMatrix.

Parameters
o1:Object

The object with which the comparison is made.

Returns:boolean

true or false

getback to summary
public final void get(Matrix3d m1)

Places the values in the upper 3x3 of this GMatrix into the matrix m1.

Parameters
m1:Matrix3d

The matrix that will hold the new values

getback to summary
public final void get(Matrix3f m1)

Places the values in the upper 3x3 of this GMatrix into the matrix m1.

Parameters
m1:Matrix3f

The matrix that will hold the new values

getback to summary
public final void get(Matrix4d m1)

Places the values in the upper 4x4 of this GMatrix into the matrix m1.

Parameters
m1:Matrix4d

The matrix that will hold the new values

getback to summary
public final void get(Matrix4f m1)

Places the values in the upper 4x4 of this GMatrix into the matrix m1.

Parameters
m1:Matrix4f

The matrix that will hold the new values

getback to summary
public final void get(GMatrix m1)

Places the values in the this GMatrix into the matrix m1; m1 should be at least as large as this GMatrix.

Parameters
m1:GMatrix

The matrix that will hold the new values

getColumnback to summary
public final void getColumn(int col, double[] array)

Places the values of the specified column into the array parameter.

Parameters
col:int

the target column number

array:double[]

the array into which the column values will be placed

getColumnback to summary
public final void getColumn(int col, GVector vector)

Places the values of the specified column into the vector parameter.

Parameters
col:int

the target column number

vector:GVector

the vector into which the column values will be placed

getElementback to summary
public final double getElement(int row, int column)

Retrieves the value at the specified row and column of this matrix.

Parameters
row:int

the row number to be retrieved (zero indexed)

column:int

the column number to be retrieved (zero indexed)

Returns:double

the value at the indexed element

getNumColback to summary
public final int getNumCol()

Returns the number of colmuns in this matrix.

Returns:int

number of columns in this matrix

getNumRowback to summary
public final int getNumRow()

Returns the number of rows in this matrix.

Returns:int

number of rows in this matrix

getRowback to summary
public final void getRow(int row, double[] array)

Places the values of the specified row into the array parameter.

Parameters
row:int

the target row number

array:double[]

the array into which the row values will be placed

getRowback to summary
public final void getRow(int row, GVector vector)

Places the values of the specified row into the vector parameter.

Parameters
row:int

the target row number

vector:GVector

the vector into which the row values will be placed

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value based on the data values in this object. Two different GMatrix objects with identical data values (i.e., GMatrix.equals returns true) will return the same hash number. Two GMatrix objects with different data members may return the same hash value, although this is not likely.

Returns:int

the integer hash code value

identityMinusback to summary
public final void identityMinus()

Subtracts this matrix from the identity matrix and puts the values back into this (this = I - this).

invertback to summary
public final void invert()

Inverts this matrix in place.

invertback to summary
public final void invert(GMatrix m1)

Inverts matrix m1 and places the new values into this matrix. Matrix m1 is not modified.

Parameters
m1:GMatrix

the matrix to be inverted

invertGeneralback to summary
pack-priv final void invertGeneral(GMatrix m1)

General invert routine. Inverts m1 and places the result in "this". Note that this routine handles both the "this" version and the non-"this" version. Also note that since this routine is slow anyway, we won't worry about allocating a little bit of garbage.

luBacksubstitutionback to summary
pack-priv static void luBacksubstitution(int dim, double[] matrix1, int[] row_perm, double[] matrix2)

Solves a set of linear equations. The input parameters "matrix1", and "row_perm" come from luDecompostion and do not change here. The parameter "matrix2" is a set of column vectors assembled into a nxn matrix of floating-point values. The procedure takes each column of "matrix2" in turn and treats it as the right-hand side of the matrix equation Ax = LUx = b. The solution vector replaces the original column of the matrix. If "matrix2" is the identity matrix, the procedure replaces its contents with the inverse of the matrix from which "matrix1" was originally derived.

LUDback to summary
public final int LUD(GMatrix LU, GVector permutation)

LU Decomposition: this matrix must be a square matrix and the LU GMatrix parameter must be the same size as this matrix. The matrix LU will be overwritten as the combination of a lower diagonal and upper diagonal matrix decompostion of this matrix; the diagonal elements of L (unity) are not stored. The GVector parameter records the row permutation effected by the partial pivoting, and is used as a parameter to the GVector method LUDBackSolve to solve sets of linear equations. This method returns +/- 1 depending on whether the number of row interchanges was even or odd, respectively.

Parameters
LU:GMatrix

The matrix into which the lower and upper decompositions will be placed.

permutation:GVector

The row permutation effected by the partial pivoting

Returns:int

+-1 depending on whether the number of row interchanges was even or odd respectively

luDecompositionback to summary
pack-priv static boolean luDecomposition(int dim, double[] matrix0, int[] row_perm, int[] even_row_xchg)

Given a nxn array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself. The input parameters are "matrix0" and "dim". The array "matrix0" is also an output parameter. The vector "row_perm[]" is an output parameter that contains the row permutations resulting from partial pivoting. The output parameter "even_row_xchg" is 1 when the number of row exchanges is even, or -1 otherwise. Assumes data type is always double.

Returns:boolean

true if the matrix is nonsingular, or false otherwise.

maxback to summary
pack-priv static double max(double a, double b)
minback to summary
pack-priv static double min(double a, double b)
mulback to summary
public final void mul(GMatrix m1)

Sets the value of this matrix to the result of multiplying itself with matrix m1 (this = this * m1).

Parameters
m1:GMatrix

the other matrix

mulback to summary
public final void mul(GMatrix m1, GMatrix m2)

Sets the value of this matrix to the result of multiplying the two argument matrices together (this = m1 * m2).

Parameters
m1:GMatrix

the first matrix

m2:GMatrix

the second matrix

mulback to summary
public final void mul(GVector v1, GVector v2)

Computes the outer product of the two vectors; multiplies the the first vector by the transpose of the second vector and places the matrix result into this matrix. This matrix must be be as big or bigger than getSize(v1)xgetSize(v2).

Parameters
v1:GVector

the first vector, treated as a row vector

v2:GVector

the second vector, treated as a column vector

mulTransposeBothback to summary
public final void mulTransposeBoth(GMatrix m1, GMatrix m2)

Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.

Parameters
m1:GMatrix

The matrix on the left hand side of the multiplication

m2:GMatrix

The matrix on the right hand side of the multiplication

mulTransposeLeftback to summary
public final void mulTransposeLeft(GMatrix m1, GMatrix m2)

Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.

Parameters
m1:GMatrix

The matrix on the left hand side of the multiplication

m2:GMatrix

The matrix on the right hand side of the multiplication

mulTransposeRightback to summary
public final void mulTransposeRight(GMatrix m1, GMatrix m2)

Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.

Parameters
m1:GMatrix

The matrix on the left hand side of the multiplication

m2:GMatrix

The matrix on the right hand side of the multiplication

negateback to summary
public final void negate()

Negates the value of this matrix: this = -this.

negateback to summary
public final void negate(GMatrix m1)

Sets the value of this matrix equal to the negation of of the GMatrix parameter.

Parameters
m1:GMatrix

The source matrix

setback to summary
public final void set(double[] matrix)

Sets the value of this matrix to the values found in the array parameter. The values are copied in one row at a time, in row major fashion. The array should be at least equal in length to the number of matrix rows times the number of matrix columns in this matrix.

Parameters
matrix:double[]

the row major source array

setback to summary
public final void set(Matrix3f m1)

Sets the value of this matrix to that of the Matrix3f provided.

Parameters
m1:Matrix3f

the matrix

setback to summary
public final void set(Matrix3d m1)

Sets the value of this matrix to that of the Matrix3d provided.

Parameters
m1:Matrix3d

the matrix

setback to summary
public final void set(Matrix4f m1)

Sets the value of this matrix to that of the Matrix4f provided.

Parameters
m1:Matrix4f

the matrix

setback to summary
public final void set(Matrix4d m1)

Sets the value of this matrix to that of the Matrix4d provided.

Parameters
m1:Matrix4d

the matrix

setback to summary
public final void set(GMatrix m1)

Sets the value of this matrix to the values found in matrix m1.

Parameters
m1:GMatrix

the source matrix

setColumnback to summary
public final void setColumn(int col, double[] array)

Copy the values from the array into the specified column of this matrix.

Parameters
col:int

the column of this matrix into which the array values will be copied

array:double[]

the source array

setColumnback to summary
public final void setColumn(int col, GVector vector)

Copy the values from the vector into the specified column of this matrix.

Parameters
col:int

the column of this matrix into which the array values will be copied

vector:GVector

the source vector

setElementback to summary
public final void setElement(int row, int column, double value)

Modifies the value at the specified row and column of this matrix.

Parameters
row:int

the row number to be modified (zero indexed)

column:int

the column number to be modified (zero indexed)

value:double

the new matrix element value

setIdentityback to summary
public final void setIdentity()

Sets this GMatrix to the identity matrix.

setRowback to summary
public final void setRow(int row, double[] array)

Copy the values from the array into the specified row of this matrix.

Parameters
row:int

the row of this matrix into which the array values will be copied.

array:double[]

the source array

setRowback to summary
public final void setRow(int row, GVector vector)

Copy the values from the vector into the specified row of this matrix.

Parameters
row:int

the row of this matrix into which the array values will be copied

vector:GVector

the source vector

setScaleback to summary
public final void setScale(double scale)

Sets this matrix to a uniform scale matrix; all of the values are reset.

Parameters
scale:double

The new scale value

setSizeback to summary
public final void setSize(int nRow, int nCol)

Changes the size of this matrix dynamically. If the size is increased no data values will be lost. If the size is decreased, only those data values whose matrix positions were eliminated will be lost.

Parameters
nRow:int

number of desired rows in this matrix

nCol:int

number of desired columns in this matrix

setZeroback to summary
public final void setZero()

Sets all the values in this matrix to zero.

subback to summary
public final void sub(GMatrix m1)

Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).

Parameters
m1:GMatrix

the other matrix

subback to summary
public final void sub(GMatrix m1, GMatrix m2)

Sets the value of this matrix to the matrix difference of matrices m1 and m2 (this = m1 - m2).

Parameters
m1:GMatrix

the first matrix

m2:GMatrix

the second matrix

SVDback to summary
public final int SVD(GMatrix U, GMatrix W, GMatrix V)

Finds the singular value decomposition (SVD) of this matrix such that this = U*W*transpose(V); and returns the rank of this matrix; the values of U,W,V are all overwritten. Note that the matrix V is output as V, and not transpose(V). If this matrix is mxn, then U is mxm, W is a diagonal matrix that is mxn, and V is nxn. Using the notation W = diag(w), then the inverse of this matrix is: inverse(this) = V*diag(1/w)*tranpose(U), where diag(1/w) is the same matrix as W except that the reciprocal of each of the diagonal components is used.

Parameters
U:GMatrix

The computed U matrix in the equation this = U*W*transpose(V)

W:GMatrix

The computed W matrix in the equation this = U*W*transpose(V)

V:GMatrix

The computed V matrix in the equation this = U*W*transpose(V)

Returns:int

The rank of this matrix.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this GMatrix.

Returns:String

the String representation

toStringback to summary
private static String toString(GMatrix m)
traceback to summary
public final double trace()

Returns the trace of this matrix.

Returns:double

the trace of this matrix

transposeback to summary
public final void transpose()

Transposes this matrix in place.

transposeback to summary
public final void transpose(GMatrix m1)

Places the matrix values of the transpose of matrix m1 into this matrix.

Parameters
m1:GMatrix

the matrix to be transposed (but not modified)

update_uback to summary
private static void update_u(int index, GMatrix u, double[] cosl, double[] sinl)
update_u_splitback to summary
private static void update_u_split(int topr, int bottomr, GMatrix u, double[] cosl, double[] sinl, GMatrix t, GMatrix m)
update_vback to summary
private static void update_v(int index, GMatrix v, double[] cosr, double[] sinr)
update_v_splitback to summary
private static void update_v_split(int topr, int bottomr, GMatrix v, double[] cosr, double[] sinr, GMatrix t, GMatrix m)