public final class Matrix1 extends MatrixSIS
MathTransform1D
derivative computation.
The matrix member is:
┌ ┐ │ m00 │ └ ┘
Matrix2
,
Matrix3
,
Matrix4
,
Serialized FormDefined in the sis-referencing
module
Modifier and Type | Field and Description |
---|---|
double |
m00
The only element in this matrix.
|
static int |
SIZE
The matrix size, which is 1.
|
Constructor and Description |
---|
Matrix1()
Creates a new identity matrix.
|
Matrix1(double m00)
Creates a new matrix initialized to the specified value.
|
Matrix1(double[] elements)
Creates a new matrix initialized to the specified values.
|
Modifier and Type | Method and Description |
---|---|
static Matrix1 |
castOrCopy(Matrix matrix)
Casts or copies the given matrix to a
Matrix1 implementation. |
boolean |
equals(Object object)
Returns
true if the specified object is of type Matrix1 and
all of the data members are equal to the corresponding data members in this matrix. |
double |
getElement(int row,
int column)
Retrieves the value at the specified row and column of this matrix.
|
double[] |
getElements()
Returns all matrix elements in a flat, row-major (column indices vary fastest) array.
|
int |
getNumCol()
Returns the number of columns in this matrix, which is always 1 in this implementation.
|
int |
getNumRow()
Returns the number of rows in this matrix, which is always 1 in this implementation.
|
int |
hashCode()
Returns a hash code value based on the data values in this object.
|
boolean |
isAffine()
Returns
true if this matrix represents an affine transform. |
boolean |
isIdentity()
Returns
true if this matrix is an identity matrix. |
void |
normalizeColumns()
Normalizes all columns in-place.
|
void |
setElement(int row,
int column,
double value)
Modifies the value at the specified row and column of this matrix.
|
void |
setElements(double[] elements)
Sets all matrix elements from a flat, row-major (column indices vary fastest) array.
|
void |
transpose()
For a 1×1 matrix, this method does nothing.
|
public static final int SIZE
public double m00
public Matrix1()
public Matrix1(double m00)
m00
- The element in this matrix.public Matrix1(double[] elements) throws IllegalArgumentException
elements
- Elements of the matrix.IllegalArgumentException
- If the given array does not have the expected length.setElements(double[])
,
Matrices.create(int, int, double[])
public static Matrix1 castOrCopy(Matrix matrix) throws MismatchedMatrixSizeException
Matrix1
implementation. If the given matrix
is already an instance of Matrix1
, then it is returned unchanged. Otherwise this method
verifies the matrix size, then copies the element in a new Matrix1
object.matrix
- The matrix to cast or copy, or null
.null
argument),
or a copy of the given matrix otherwise.MismatchedMatrixSizeException
- If the size of the given matrix is not 1×1.public final int getNumRow()
public final int getNumCol()
public final double getElement(int row, int column)
Matrix1
,
then the m00
field can be read directly for efficiency.getElement
in interface Matrix
getElement
in class MatrixSIS
row
- The row index, which can only be 0.column
- The column index, which can only be 0.public final void setElement(int row, int column, double value)
Matrix1
,
then the m00
field can be set directly for efficiency.row
- The row index, which can only be 0.column
- The column index, which can only be 0.value
- The new value to set.public final double[] getElements()
getElements
in class MatrixSIS
public final void setElements(double[] elements)
setElements
in class MatrixSIS
elements
- The new matrix elements in a row-major array.Matrices.create(int, int, double[])
public final boolean isAffine()
true
if this matrix represents an affine transform.
A transform is affine if the matrix is square and its last row contains
only zeros, except in the last column which contains 1.isAffine
in class MatrixSIS
true
if this matrix represents an affine transform.Matrices.isAffine(Matrix)
public final boolean isIdentity()
true
if this matrix is an identity matrix.
This method is equivalent to the following code, except that it is potentially more efficient:
return Matrices.isIdentity(this, 0.0);
isIdentity
in interface Matrix
isIdentity
in class MatrixSIS
true
if this matrix is an identity matrix.Matrices.isIdentity(Matrix, double)
,
AffineTransform.isIdentity()
public void transpose()
public void normalizeColumns()
m00
value to 1.normalizeColumns
in class MatrixSIS
public boolean equals(Object object)
true
if the specified object is of type Matrix1
and
all of the data members are equal to the corresponding data members in this matrix.equals
in interface LenientComparable
equals
in class Object
object
- The object to compare with this matrix for equality.true
if the given object is equal to this matrix.ComparisonMode.STRICT
Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.