public interface XMatrix extends Matrix
Matrix
interface is basically just
a two dimensional array of numbers. The XMatrix
interface add inversion and multiplication capabilities.Modifier and Type | Method and Description |
---|---|
void |
add(double scalar)
Performs an in-place scalar addition.
|
void |
add(double scalar,
XMatrix matrix)
Set to the scalar addition of
scalar+matrix |
void |
add(XMatrix matrix)
Set to the matrix addition of
this+matrix . |
void |
add(XMatrix matrix1,
XMatrix matrix2)
Set to the matrix addition of
matrix1+matrix2 . |
double |
determinate()
Computes the determinant
|
boolean |
equals(Matrix matrix,
double tolerance)
Compares the element values.
|
void |
getColumn(int col,
double[] array)
Extract col to provided array.
|
double |
getElement(int row,
int column)
Returns the element at the specified index.
|
int |
getNumCol()
Returns the number of colmuns in this matrix.
|
int |
getNumRow()
Returns the number of rows in this matrix.
|
void |
getRow(int row,
double[] array)
Extract row to provided array
|
void |
invert()
Inverts this matrix in place.
|
void |
invert(Matrix matrix)
Set to the inverse of the provided matrix.
|
boolean |
isAffine()
Returns
true if this matrix is an affine transform. |
boolean |
isIdentity(double tolerance)
Returns
true if this matrix is an identity matrix using the provided tolerance. |
void |
mul(double scalar)
Sets this matrix to the result of multiplying itself with the provided scalar.
|
void |
mul(double scalar,
Matrix matrix)
Sets the value of this matrix to the result of multiplying the provided scalar and matrix.
|
void |
mul(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix.
|
void |
mul(Matrix matrix1,
Matrix matrix2)
Sets the value of this matrix to the result of multiplying matrix1 and matrix2.
|
void |
multiply(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix.
|
void |
negate()
Negates the value of this matrix:
this = -this . |
void |
negate(Matrix matrix)
Negates the value of this matrix:
this = -matrix . |
void |
setColumn(int column,
double... values)
Sets the value of the column using an array of values.
|
void |
setIdentity()
Sets this matrix to the identity matrix.
|
void |
setRow(int row,
double... values)
Sets the value of the row using an array of values.
|
void |
setZero()
Sets all the values in this matrix to zero.
|
void |
sub(double scalar)
In-place matrix subtraction:
this - scalar . |
void |
sub(double scalar,
Matrix matrix)
Set to the difference of
scalar - matrix2 . |
void |
sub(Matrix matrix)
In-place matrix subtraction:
this - matrix . |
void |
sub(Matrix matrix1,
Matrix matrix2)
Set to the difference of
matrix1 - matrix2 . |
void |
transpose()
Sets the value of this matrix to its transpose.
|
void |
transpose(Matrix matrix)
Set to the transpose of the provided matrix.
|
clone, isIdentity, setElement
int getNumRow()
int getNumCol()
double getElement(int row, int column)
getElement
in interface Matrix
row
- The row number to be retrieved (zero indexed).column
- The column number to be retrieved (zero indexed).void getRow(int row, double[] array)
row
- array
- void setRow(int row, double... values)
row
- values
- void getColumn(int col, double[] array)
col
- array
- @Extension void setColumn(int column, double... values)
column
- values
- void setZero()
void setIdentity()
boolean isIdentity(double tolerance)
true
if this matrix is an identity matrix using the provided tolerance. This
method is equivalent to computing the difference between this matrix and an identity matrix
of identical size, and returning true
if and only if all differences are smaller than
or equal to tolerance
.tolerance
- The tolerance value.true
if this matrix is close enough to the identity matrix given the
tolerance value.boolean equals(Matrix matrix, double tolerance)
matrix
- The matrix to compare.tolerance
- The tolerance value.true
if this matrix is close enough to the given matrix given the tolerance
value.boolean isAffine()
true
if this matrix is an affine transform. A transform is affine if the
matrix is square and last row contains only zeros, except in the last column which contains
1.true
if this matrix is affine.void negate()
this = -this
.void negate(Matrix matrix)
this = -matrix
.matrix
- Matrix to negatedvoid transpose()
void transpose(Matrix matrix)
matrix
- The original matrix. Not modified.void invert() throws SingularMatrixException
SingularMatrixException
- if this matrix is not invertible.void invert(Matrix matrix) throws SingularMatrixException
matrix
- The matrix that is to be inverted. Not modified.SingularMatrixException
- if this matrix is not invertible.void add(double scalar)
scalar
- The value that's added to each element.void add(double scalar, XMatrix matrix)
scalar+matrix
scalar
- The value that's added to each element.matrix
- The matrix that is to be added. Not modified.void add(XMatrix matrix)
this+matrix
.scalar
- The scalar to be added. Not modified.matrix
- The matrix that is to be added. Not modified.void add(XMatrix matrix1, XMatrix matrix2)
matrix1+matrix2
.matrix1
- First matrix to be added. Not modified.matrix2
- Second matrix to be added. Not modified.double determinate()
void multiply(Matrix matrix)
this
= this
× matrix
. In the context
of coordinate transformations, this is equivalent to
AffineTransform.concatenate
:
first transforms by the supplied transform and then transform the result by the original
transform.matrix
- The matrix to multiply to this matrix.void mul(double scalar)
scalar
- void mul(double scalar, Matrix matrix)
scalar
- matrix
- void mul(Matrix matrix)
this
= this
× matrix
. In the context
of coordinate transformations, this is equivalent to
AffineTransform.concatenate
:
first transforms by the supplied transform and then transform the result by the original
transform.matrix
- The matrix to multiply to this matrix.void mul(Matrix matrix1, Matrix matrix2)
matrix1
- matrix2
- void sub(double scalar)
this - scalar
.scalar
- void sub(double scalar, Matrix matrix)
scalar - matrix2
.scalar
- matrix2
- matrix, not modifiedvoid sub(Matrix matrix)
this - matrix
.b
- m by n matrix. Not modified.Copyright © 1996–2019 Geotools. All rights reserved.