mikera.matrixx.impl
Class BandedMatrix
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<AVector>
-
- mikera.matrixx.AMatrix
-
- mikera.matrixx.impl.ABandedMatrix
-
- mikera.matrixx.impl.BandedMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<AVector>, INDArray, IMatrix, IFastBands
public class BandedMatrix extends ABandedMatrix
Sparse banded matrix implementation. Composed of a list of diagonal bands.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAt(int i, int j, double d)Adds a value at a specific position in the matrix, mutating the matrix Does not perform bounds checking - this in an unsafe operationintcolumnCount()Gets the number of columns in this matrix (dimension 1)static BandedMatrixcreate(AMatrix m)static BandedMatrixcreate(int rowCount, int columnCount, int minBand, int maxBand)BandedMatrixexactClone()Creates a deep clone of an array, using the same class implementation as the original arraydoubleget(int i, int j)Returns the double value at the specified position in a 2D matrixAVectorgetBand(int band)Gets a specific band of the matrix, as a view vector.BandedMatrixgetTranspose()Returns the transpose of this array.booleanisView()Return true if this array is considered as a view type.intlowerBandwidthLimit()A limit on the lower bandwidth of the banded matrix.introwCount()Gets the number of rows in this matrix (dimension 0)voidset(int i, int j, double value)Sets a value at a given position in a mutable 2D arrayvoidtransform(AVector source, AVector dest)Transforms a source vector into a destination vector, using matrix multiplication (inner product).voidtransform(Vector source, Vector dest)doubleunsafeGet(int i, int j)Gets an element in the matrix in an unsafe fashion, without performing bound checks The result is undefined if the row and column are out of bounds.voidunsafeSet(int i, int j, double value)Sets an element value in the matrix in an unsafe fashion, without performing bound checks The result is undefined if the row and column are out of bounds.intupperBandwidthLimit()A limit on the upper bandwidth of the banded matrix.voidvalidate()Validates the internal data structure of the INDArray.static BandedMatrixwrap(int rowCount, int columnCount, int minBand, int maxBand, AVector... bands)-
Methods inherited from class mikera.matrixx.impl.ABandedMatrix
addToArray, copyRowTo, density, diagonalProduct, elementSquaredSum, elementSum, fill, getRowView, isFullyMutable, isLowerTriangular, isMutable, isSparse, isSymmetric, isUpperTriangular, isZero, lowerBandwidth, multiply, nonZeroCount, setSparse, toDoubleArray, toMatrix, toMatrixTranspose, trace, upperBandwidth
-
Methods inherited from class mikera.matrixx.AMatrix
abs, add, add, add, add, add2, addCopy, addCopy, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addOuterProduct, addOuterProduct, addOuterProductSparse, addOuterProductSparse, addRowMultiple, addSparse, addSparse, applyOp, applyOp, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, bandIndex, bandLength, bandPosition, bandStartColumn, bandStartRow, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, checkColumn, checkRow, checkSquare, clamp, clone, composeWith, copy, copyColumnTo, dense, denseClone, determinant, dimensionality, divide, divide, divide, divide, divideCopy, elementCount, elementIterator, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equals, equalsArray, equalsTranspose, exp, get, get, get, get, getBandWrapped, getColumn, getColumnClone, getColumns, getColumnView, getElement, getElements, getLeadingDiagonal, getLongShape, getRow, getRowClone, getRows, getShape, getShape, getShapeClone, getSlices, getSlices, getSliceViews, getTransposeCopy, getTransposeView, hashCode, hasOrthonormalColumns, hasOrthonormalRows, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, inputDimensions, inverse, isBoolean, isDiagonal, isElementConstrained, isHermitian, isIdentity, isInvertible, isOrthogonal, isOrthogonal, isPositiveDefinite, isRectangularDiagonal, isSameShape, isSameShape, isSquare, iterator, join, log, mul, multiply, multiply, multiply, multiplyCopy, multiplyRow, mutable, negate, outerProduct, outputDimensions, pow, rank, reciprocal, reduce, reduce, reduceSlices, reduceSlices, reorder, reorder, replaceColumn, replaceRow, reshape, reshape, rotateView, rowDotProduct, scaleAdd, scaleAdd, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setColumn, setElements, setElements, setMultiple, setMultiple, setMultiple, setMultiple, setMultiple, setRow, setSparse, setSparse, signum, slice, slice, sliceCount, sparse, sparseClone, sqrt, square, sub, sub, sub, subArray, subCopy, subMatrix, swapColumns, swapRows, toAffineTransform, toDoubleBuffer, toMutableMatrix, toNestedDoubleArrays, toSliceArray, toString, toStringFull, toVector, transformInPlace, transformInPlace, transposeInnerProduct, transposeInnerProduct, transposeInPlace
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
absCopy, absDiff, absDiffCopy, add, addApplyOp, addAt, addCopy, addInnerProduct, addInnerProduct, addMultipleSparse, addPower, addPower, addSparse, broadcastLike, compareTo, componentCount, divideCopy, elementAbsPowSum, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, epsilonEquals, equals, equalsArray, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, isDense, join, multiplyCopy, negateCopy, reciprocalCopy, scale, scaleCopy, setElements, setInnerProduct, signumCopy, sliceValue, squareCopy, sub, sub, subCopy, withComponents
-
Methods inherited from interface mikera.arrayz.INDArray
absCopy, absDiff, absDiffCopy, addApplyOp, addAt, addInnerProduct, addMultipleSparse, addPower, addPower, addSparse, broadcastLike, componentCount, divideCopy, elementAbsPowSum, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, epsilonEquals, equalsArray, get, get, get, get, getComponent, getComponents, getElements, getElements, getElements, isDense, join, multiplyCopy, negateCopy, reciprocalCopy, scale, scaleCopy, setElements, setInnerProduct, signumCopy, sliceValue, squareCopy, sub, subCopy, withComponents
-
-
-
-
Method Detail
-
create
public static BandedMatrix create(AMatrix m)
-
create
public static BandedMatrix create(int rowCount, int columnCount, int minBand, int maxBand)
-
wrap
public static BandedMatrix wrap(int rowCount, int columnCount, int minBand, int maxBand, AVector... bands)
-
upperBandwidthLimit
public int upperBandwidthLimit()
Description copied from class:AMatrixA limit on the upper bandwidth of the banded matrix. Actual upper bandwidth is guaranteed to be less than or equal to this value. Implementation should be O(1).- Specified by:
upperBandwidthLimitin classABandedMatrix- Returns:
-
lowerBandwidthLimit
public int lowerBandwidthLimit()
Description copied from class:AMatrixA limit on the lower bandwidth of the banded matrix. Actual lower bandwidth is guaranteed to be less than or equal to this value. Implementation should be O(1).- Specified by:
lowerBandwidthLimitin classABandedMatrix- Returns:
-
getTranspose
public BandedMatrix getTranspose()
Description copied from interface:INDArrayReturns the transpose of this array. A transpose of an array is equivalent to reversing the order of dimensions. May or may not return a view depending on the array type.- Specified by:
getTransposein interfaceINDArray- Specified by:
getTransposein interfaceIMatrix- Overrides:
getTransposein classAMatrix- Returns:
- the transpose of this matrix
-
getBand
public AVector getBand(int band)
Description copied from class:AMatrixGets a specific band of the matrix, as a view vector. The band is truncated at the edges of the matrix, i.e. it does not wrap around the matrix.- Specified by:
getBandin interfaceIMatrix- Specified by:
getBandin interfaceIFastBands- Specified by:
getBandin classABandedMatrix- Returns:
-
rowCount
public int rowCount()
Description copied from interface:IMatrixGets the number of rows in this matrix (dimension 0)- Returns:
-
columnCount
public int columnCount()
Description copied from interface:IMatrixGets the number of columns in this matrix (dimension 1)- Returns:
-
isView
public boolean isView()
Description copied from interface:INDArrayReturn true if this array is considered as a view type. This indicates (but does not guarantee): a) Data is *likely* to be shared with other arrays, so mutation of one may affect others b) It is *unlikely* to be in the most efficient general purpose format isView is intended to be used as for heuristics. It should *not* be used where the outcome might affect correctness.
-
get
public double get(int i, int j)Description copied from interface:INDArrayReturns the double value at the specified position in a 2D matrix
-
set
public void set(int i, int j, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 2D array
-
unsafeGet
public double unsafeGet(int i, int j)Description copied from class:AMatrixGets an element in the matrix in an unsafe fashion, without performing bound checks The result is undefined if the row and column are out of bounds.
-
unsafeSet
public void unsafeSet(int i, int j, double value)Description copied from class:AMatrixSets an element value in the matrix in an unsafe fashion, without performing bound checks The result is undefined if the row and column are out of bounds.
-
addAt
public void addAt(int i, int j, double d)Description copied from interface:IMatrixAdds a value at a specific position in the matrix, mutating the matrix Does not perform bounds checking - this in an unsafe operation
-
exactClone
public BandedMatrix exactClone()
Description copied from interface:INDArrayCreates a deep clone of an array, using the same class implementation as the original array- Specified by:
exactClonein interfaceINDArray- Specified by:
exactClonein classAMatrix- Returns:
- A clone of the original array
-
transform
public void transform(AVector source, AVector dest)
Description copied from interface:IMatrixTransforms a source vector into a destination vector, using matrix multiplication (inner product). The destination vector is overwritten.
-
validate
public void validate()
Description copied from interface:INDArrayValidates the internal data structure of the INDArray. Throws an exception on failure. Failure indicates a serious bug and/or data corruption.- Specified by:
validatein interfaceINDArray- Overrides:
validatein classABandedMatrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG