mikera.matrixx.impl
Class AVectorMatrix<T extends AVector>
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<AVector>
-
- mikera.matrixx.AMatrix
-
- mikera.matrixx.impl.ARectangularMatrix
-
- mikera.matrixx.impl.AVectorMatrix<T>
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<AVector>, INDArray, IMatrix, IFastRows
- Direct Known Subclasses:
- VectorMatrixM3, VectorMatrixMN
public abstract class AVectorMatrix<T extends AVector> extends ARectangularMatrix implements IFastRows
Abstract base class for matrices that use a collection of Vectors as storage for the matrix rows.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)AVectorasVector()Returns the matrix values as a single reference Vector in the form [row0 row1 row2....]AMatrixclone()Returns a clone of the array data, as a new array which will be fully mutable and may be of a different class to the original.intcomponentCount()Returns the number of components of this array.voidcopyColumnTo(int col, double[] dest, int destOffset)Copies the elements in a selected row of this matrix to a double arrayvoidcopyRowTo(int row, double[] dest, int destOffset)Copies the elements in a selected row of this matrix to a double arraydoubleelementSquaredSum()Returns the squared sum of all elements in this matrixdoubleelementSum()Returns the sum of all elements in this matrixbooleanequals(AMatrix m)Returns true if this matrix is exactly equal to another matrixvoidfill(double value)Fills this array with a single double value.doubleget(int row, int column)Returns the double value at the specified position in a 2D matrixAVectorgetComponent(int i)Gets a component from the array at the specified index Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= kvoidgetElements(double[] dest, int destOffset)Copies all elements of this array a double array at the specified offsetabstract TgetRow(int row)Gets a row of the matrix.TgetRowView(int i)Returns a row of the matrix as a vector view.AVectorinnerProduct(AVector v)Computes the inner product of this array with a vectorbooleanisBoolean()Returns true if the array is boolean (contains only 0.0 or 1.0 values)booleanisFullyMutable()If this method returns true, the INDArray is guaranteed to be fully mutable in all positions i.e.booleanisView()Return true if this array is considered as a view type.booleanisZero()Returns true if the matrix is the zero matrix (all components zero)longnonZeroCount()Returns the number of non-zero elements in the array.abstract voidreplaceRow(int i, AVector row)Replaces a row in this matrix.doublerowDotProduct(int i, AVector inputVector)Returns the dot product of a specific row with a vector.AMatrixsubMatrix(int rowStart, int rows, int colStart, int cols)Gets a rectangular submatrix view of part of a matrixvoidtransform(AVector source, AVector dest)Transforms a source vector into a destination vector, using matrix multiplication (inner product).voidtransform(Vector source, Vector dest)doubleunsafeGet(int row, int column)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 row, int column, 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.-
Methods inherited from class mikera.matrixx.impl.ARectangularMatrix
bandLength, checkColumn, checkRow, checkSquare, columnCount, elementCount, getElement, getShape, getShape, getShapeClone, isSameShape, isSameShape, isSameShape, isSquare, rowCount, set
-
Methods inherited from class mikera.matrixx.AMatrix
abs, add, add, add, add, add2, addAt, addCopy, addCopy, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addOuterProduct, addOuterProduct, addOuterProductSparse, addOuterProductSparse, addRowMultiple, addSparse, addSparse, addToArray, applyOp, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, bandIndex, bandPosition, bandStartColumn, bandStartRow, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, clamp, composeWith, copy, dense, denseClone, determinant, diagonalProduct, dimensionality, divide, divide, divide, divide, divideCopy, elementIterator, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equalsArray, equalsTranspose, exactClone, exp, get, get, get, get, getBand, getBandWrapped, getColumn, getColumnClone, getColumns, getColumnView, getLeadingDiagonal, getLongShape, getRowClone, getRows, getSlices, getSlices, getSliceViews, getTranspose, getTransposeCopy, getTransposeView, hashCode, hasOrthonormalColumns, hasOrthonormalRows, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, inputDimensions, inverse, isDiagonal, isElementConstrained, isHermitian, isIdentity, isInvertible, isLowerTriangular, isMutable, isOrthogonal, isOrthogonal, isPositiveDefinite, isRectangularDiagonal, isSymmetric, isUpperTriangular, iterator, join, log, lowerBandwidth, lowerBandwidthLimit, mul, multiply, multiply, multiply, multiply, multiplyCopy, multiplyRow, mutable, negate, outerProduct, outputDimensions, pow, rank, reciprocal, reduce, reduce, reduceSlices, reduceSlices, reorder, reorder, replaceColumn, reshape, reshape, rotateView, 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, swapColumns, swapRows, toAffineTransform, toDoubleArray, toDoubleBuffer, toMatrix, toMatrixTranspose, toMutableMatrix, toNestedDoubleArrays, toSliceArray, toString, toStringFull, toVector, trace, transformInPlace, transformInPlace, transposeInnerProduct, transposeInnerProduct, transposeInPlace, upperBandwidth, upperBandwidthLimit, validate
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
absCopy, absDiff, absDiffCopy, add, addApplyOp, addAt, addCopy, addInnerProduct, addInnerProduct, addMultipleSparse, addPower, addPower, addSparse, broadcastLike, compareTo, density, divideCopy, elementAbsPowSum, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, epsilonEquals, equals, equalsArray, get, get, get, get, getComponents, getElements, getElements, getElements, isDense, isSparse, join, multiplyCopy, negateCopy, reciprocalCopy, scale, scaleCopy, setElements, setInnerProduct, setSparse, signumCopy, sliceValue, squareCopy, sub, sub, subCopy, withComponents
-
Methods inherited from interface mikera.matrixx.IMatrix
add2, addAt, addCopy, addCopy, columnCount, diagonalProduct, getBand, getColumn, getColumnClone, getColumns, getColumnView, getRowClone, getRows, getTranspose, getTransposeView, innerProduct, innerProduct, inverse, isDiagonal, isIdentity, isInvertible, isRectangularDiagonal, isSquare, isSymmetric, rowCount, set, toNestedDoubleArrays, trace, transformInPlace, transposeInPlace
-
Methods inherited from interface mikera.arrayz.INDArray
abs, absCopy, absDiff, absDiffCopy, add, add, addApplyOp, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addMultiple, addMultipleSparse, addOuterProduct, addOuterProductSparse, addPower, addPower, addSparse, addSparse, addToArray, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, broadcastLike, clamp, copy, dense, denseClone, dimensionality, divide, divide, divideCopy, divideCopy, elementAbsPowSum, elementCount, elementIterator, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, elementsEqual, ensureMutable, epsilonEquals, epsilonEquals, equals, equalsArray, equalsArray, exactClone, exp, get, get, get, get, get, get, get, get, getComponents, getElement, getElements, getElements, getElements, getLongShape, getShape, getShape, getShapeClone, getSlices, getSlices, getSliceViews, getTransposeCopy, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, isDense, isElementConstrained, isMutable, isSameShape, isSparse, join, join, log, multiply, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, outerProduct, pow, reciprocal, reciprocalCopy, reduce, reduce, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, set, set, set, set, set, set, setApplyOp, setElements, setElements, setElements, setInnerProduct, setMultiple, setMultiple, setSparse, setSparse, signum, signumCopy, slice, slice, sliceCount, sliceValue, sparse, sparseClone, sqrt, square, squareCopy, sub, sub, subArray, subCopy, toDoubleArray, toDoubleBuffer, toSliceArray, toVector, validate, withComponents
-
-
-
-
Method Detail
-
replaceRow
public abstract void replaceRow(int i, AVector row)Replaces a row in this matrix. The row must be of a type allowed by the matrix. Detaches the current row: this will invalidate views over the matrix that include the original row.- Overrides:
replaceRowin classAMatrix- Parameters:
i-row-
-
getRow
public abstract T getRow(int row)
Gets a row of the matrix. Guaranteed to be an existing vector view by all descendants of AVectorMatrix.
-
getRowView
public final T getRowView(int i)
Description copied from interface:IMatrixReturns a row of the matrix as a vector view. May be used to modify the original matrix.- Specified by:
getRowViewin interfaceIMatrix- Overrides:
getRowViewin classAMatrix
-
get
public double get(int row, int column)Description copied from interface:INDArrayReturns the double value at the specified position in a 2D matrix
-
unsafeGet
public double unsafeGet(int row, int column)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.
-
isFullyMutable
public boolean isFullyMutable()
Description copied from interface:INDArrayIf this method returns true, the INDArray is guaranteed to be fully mutable in all positions i.e. every position can store any valid double value- Specified by:
isFullyMutablein interfaceINDArray- Specified by:
isFullyMutablein classAMatrix
-
fill
public void fill(double value)
Description copied from interface:INDArrayFills this array with a single double value. Requires the array to be mutable.
-
unsafeSet
public void unsafeSet(int row, int column, 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.
-
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.
-
rowDotProduct
public double rowDotProduct(int i, AVector inputVector)Description copied from class:AMatrixReturns the dot product of a specific row with a vector. Unsafe operation: performs no bounds checking- Overrides:
rowDotProductin classAMatrix- Returns:
-
copyRowTo
public void copyRowTo(int row, double[] dest, int destOffset)Description copied from class:AMatrixCopies the elements in a selected row of this matrix to a double array
-
copyColumnTo
public void copyColumnTo(int col, double[] dest, int destOffset)Description copied from class:AMatrixCopies the elements in a selected row of this matrix to a double array- Overrides:
copyColumnToin classAMatrixdest- Destination double[] array
-
getElements
public final void getElements(double[] dest, int destOffset)Description copied from interface:INDArrayCopies all elements of this array a double array at the specified offset- Specified by:
getElementsin interfaceINDArray- Overrides:
getElementsin classAMatrix
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
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.
-
isZero
public boolean isZero()
Description copied from class:AMatrixReturns true if the matrix is the zero matrix (all components zero)
-
isBoolean
public boolean isBoolean()
Description copied from interface:INDArrayReturns true if the array is boolean (contains only 0.0 or 1.0 values)
-
elementSum
public double elementSum()
Description copied from class:AMatrixReturns the sum of all elements in this matrix- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAMatrix
-
elementSquaredSum
public double elementSquaredSum()
Description copied from class:AMatrixReturns the squared sum of all elements in this matrix- Specified by:
elementSquaredSumin interfaceINDArray- Overrides:
elementSquaredSumin classAMatrix
-
nonZeroCount
public long nonZeroCount()
Description copied from interface:INDArrayReturns the number of non-zero elements in the array.- Specified by:
nonZeroCountin interfaceINDArray- Overrides:
nonZeroCountin classAMatrix
-
asVector
public AVector asVector()
Description copied from class:AMatrixReturns the matrix values as a single reference Vector in the form [row0 row1 row2....]
-
componentCount
public int componentCount()
Description copied from interface:INDArrayReturns the number of components of this array. May return 0 if components are not supported- Specified by:
componentCountin interfaceINDArray- Overrides:
componentCountin classAbstractArray<AVector>- Returns:
-
getComponent
public AVector getComponent(int i)
Description copied from interface:INDArrayGets a component from the array at the specified index Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= k- Specified by:
getComponentin interfaceINDArray- Overrides:
getComponentin classAbstractArray<AVector>- Returns:
-
innerProduct
public AVector innerProduct(AVector v)
Description copied from interface:INDArrayComputes the inner product of this array with a vector- Specified by:
innerProductin interfaceINDArray- Specified by:
innerProductin interfaceIMatrix- Overrides:
innerProductin classAMatrix- Parameters:
v- A vector- Returns:
- A new array representing the inner product
-
subMatrix
public AMatrix subMatrix(int rowStart, int rows, int colStart, int cols)
Description copied from interface:IMatrixGets a rectangular submatrix view of part of a matrix
-
equals
public boolean equals(AMatrix m)
Description copied from class:AMatrixReturns true if this matrix is exactly equal to another matrix
-
clone
public AMatrix clone()
Description copied from interface:INDArrayReturns a clone of the array data, as a new array which will be fully mutable and may be of a different class to the original. Clone should attempt to return the most efficient possible array type. Clone should preserve sparsity property where possible, but this is not guaranteed.
-
-
DMelt 3.0 © DataMelt by jWork.ORG
You see the box below because you did not login.