public class SymmetricBandMatrix extends SymmetricMatrix
k1
below the main diagonal,
the number of diagonals k2
above the main diagonal, plus the main diagonal.
bandwidth := k1 + k2 + 1
offset
buffer, columns, rows, zeroPadded
Modifier | Constructor and Description |
---|---|
|
SymmetricBandMatrix(int length,
int bandwidth,
boolean direct,
boolean zeroPadded)
Creates a square, symmetric band matrix with the given number of rows and columns.
|
|
SymmetricBandMatrix(int length,
int bandwidth,
float defaultValue)
Creates a square, symmetric band matrix with the given number of rows and columns.
|
protected |
SymmetricBandMatrix(int length,
int bandwidth,
MatrixBackingBuffer buffer,
boolean zeroPadded,
float defaultValue,
boolean allocate) |
|
SymmetricBandMatrix(int length,
int bandwidth,
MatrixBackingBuffer buffer,
float defaultValue,
boolean zeroPadded)
Creates a square, symmetric band matrix with the given number of rows and columns.
|
Modifier and Type | Method and Description |
---|---|
protected void |
allocate(MatrixBackingBuffer buffer)
Calls
MatrixBackingBuffer.allocate(int) on the used buffer. |
void |
copy(float[] values)
Copies values from the provided array row by row to this matrix.
|
void |
copy(Matrix fromMatrix)
Copies values from another
Matrix to this matrix. |
void |
copy(Matrix fromMatrix,
int fromRow,
int fromColumn,
int toRow,
int toColumn,
int rows,
int columns)
Copies values from a defined offset from another matrix to a defined offset of this matrix.
|
void |
fill(float value)
Fills the matrix with the given values and adjusts the
defaultValue
returned for elements outside the band. |
float |
get(int row,
int column)
Gets the value from
row and column . |
void |
set(int row,
int column,
float value)
Sets the given value.
|
protected int |
toIndex(int row,
int column) |
String |
toString() |
isInvalid
copy, set, setColumn, setRow
add, checkBounds, columnSum, enlarge, equals, get, getColumn, getNumberOfColumns, getNumberOfRows, getRow, hadamardMultiply, hashCode, isValidXORZeroPadded, isZeroPadded, multiply, multiply, rowSum, subtract, sum, translate, transpose
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
setColumn, setRow
add, columnSum, enlarge, getColumn, getNumberOfColumns, getNumberOfRows, getRow, hadamardMultiply, isZeroPadded, multiply, multiply, rowSum, subtract, sum, translate, transpose
public SymmetricBandMatrix(int length, int bandwidth, float defaultValue)
length
- rows == columns (square)bandwidth
- bandwidth == k1 + k2 + 1, with k1 and k2 being the number of diagonals above and below the main diagonaldefaultValue
- value to return for elements outside the bandpublic SymmetricBandMatrix(int length, int bandwidth, MatrixBackingBuffer buffer, float defaultValue, boolean zeroPadded)
length
- rows == columns (square)bandwidth
- bandwidth == k1 + k2 + 1, with k1 and k2 being the number of diagonals above and below the main diagonalbuffer
- backing bufferdefaultValue
- value to return for elements outside the bandzeroPadded
- zero pad?public SymmetricBandMatrix(int length, int bandwidth, boolean direct, boolean zeroPadded)
FloatBackingBuffer
either directly/natively or on the Java heap.
The matrix may be zero-padded.length
- rows == columns (square)bandwidth
- bandwidth == k1 + k2 + 1, with k1 and k2 being the number of diagonals above and below the main diagonaldirect
- allocate memory natively or on the Java heapzeroPadded
- zero pad?protected SymmetricBandMatrix(int length, int bandwidth, MatrixBackingBuffer buffer, boolean zeroPadded, float defaultValue, boolean allocate)
protected void allocate(MatrixBackingBuffer buffer)
MutableAbstractMatrix
MatrixBackingBuffer.allocate(int)
on the used buffer.allocate
in class SymmetricMatrix
buffer
- bufferpublic void fill(float value)
defaultValue
returned for elements outside the band.fill
in interface MutableMatrix
fill
in class MutableAbstractMatrix
value
- valuepublic void copy(float[] values)
MutableMatrix
copy
in interface MutableMatrix
copy
in class MutableAbstractMatrix
values
- valuespublic void copy(Matrix fromMatrix)
MutableMatrix
Matrix
to this matrix.
If this matrix does not support the setting of certain elements (e.g. SymmetricBandMatrix
),
the method fails silently, i.e. no values are copied, and no exception is raised.copy
in interface MutableMatrix
copy
in class MutableAbstractMatrix
fromMatrix
- other matrixpublic void copy(Matrix fromMatrix, int fromRow, int fromColumn, int toRow, int toColumn, int rows, int columns)
MutableMatrix
SymmetricBandMatrix
),
the method fails silently, i.e. no values are copied, and no exception is raised.copy
in interface MutableMatrix
copy
in class MutableAbstractMatrix
fromMatrix
- other matrixfromRow
- row start offset of from matrixfromColumn
- column start offset of from matrixtoRow
- column start offset of this matrixtoColumn
- column start offset of this matrixrows
- number of rows to copycolumns
- number of column to copypublic float get(int row, int column)
Matrix
row
and column
.
If the matrix supports zero-padding, this method may return
0f
for undefined rows or columns.get
in interface Matrix
get
in class SymmetricMatrix
row
- rowcolumn
- columnpublic void set(int row, int column, float value)
MutableMatrix
set
in interface MutableMatrix
set
in class SymmetricMatrix
row
- rowcolumn
- columnvalue
- valueprotected int toIndex(int row, int column)
toIndex
in class SymmetricMatrix
public String toString()
toString
in class SymmetricMatrix
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.