mikera.matrixx.impl
Class VectorMatrixMN
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<AVector>
-
- mikera.matrixx.AMatrix
-
- mikera.matrixx.impl.ARectangularMatrix
-
- mikera.matrixx.impl.AVectorMatrix<AVector>
-
- mikera.matrixx.impl.VectorMatrixMN
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<AVector>, INDArray, IMatrix, IFastRows
public class VectorMatrixMN extends AVectorMatrix<AVector>
A matrix implemented as a composition of M length N vectors- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description VectorMatrixMN(int rowCount, int columnCount)
-
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 operationvoidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)Matrixclone()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.static VectorMatrixMNcreate(AMatrix source)static VectorMatrixMNcreate(java.util.List<?> rows)Create a matrix from a list of rowsstatic VectorMatrixMNcreate(java.util.List<?> rows, int[] shape)VectorMatrixMNexactClone()Creates a deep clone of an array, using the same class implementation as the original arraydoubleget(int row, int column)Returns the double value at the specified position in a 2D matrixAVectorgetRow(int row)Gets a row of the matrix.voidmultiply(double factor)Multiplies all elements of the array in place by a given double valuevoidreplaceRow(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.voidset(int row, int column, double value)Sets a value at a given position in a mutable 2D arrayvoidswapRows(int i, int j)Swaps two rows of the matrix in place This is an elementary row operationvoidtransform(AVector source, AVector dest)Transforms a source vector into a destination vector, using matrix multiplication (inner product).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.static VectorMatrixMNwrap(AMatrix source)static VectorMatrixMNwrap(AVector[] rows)-
Methods inherited from class mikera.matrixx.impl.AVectorMatrix
asVector, componentCount, copyColumnTo, copyRowTo, elementSquaredSum, elementSum, equals, fill, getComponent, getElements, getRowView, innerProduct, isBoolean, isFullyMutable, isView, isZero, nonZeroCount, subMatrix, transform
-
Methods inherited from class mikera.matrixx.impl.ARectangularMatrix
bandLength, checkColumn, checkRow, checkSquare, columnCount, elementCount, getElement, getShape, getShape, getShapeClone, isSameShape, isSameShape, isSameShape, isSquare, rowCount
-
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, 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, 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, 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, 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, addCopy, addCopy, columnCount, diagonalProduct, getBand, getColumn, getColumnClone, getColumns, getColumnView, getRowClone, getRows, getTranspose, getTransposeView, innerProduct, innerProduct, inverse, isDiagonal, isIdentity, isInvertible, isRectangularDiagonal, isSquare, isSymmetric, rowCount, 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, 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, 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
-
create
public static VectorMatrixMN create(java.util.List<?> rows)
Create a matrix from a list of rows- Parameters:
rows-- Returns:
-
create
public static VectorMatrixMN create(java.util.List<?> rows, int[] shape)
-
wrap
public static VectorMatrixMN wrap(AVector[] rows)
-
multiply
public void multiply(double factor)
Description copied from interface:INDArrayMultiplies all elements of the array in place by a given double value
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)- Specified by:
applyOpin interfaceINDArray- Overrides:
applyOpin classAVectorMatrix<AVector>
-
create
public static VectorMatrixMN create(AMatrix source)
-
wrap
public static VectorMatrixMN wrap(AMatrix source)
-
replaceRow
public void replaceRow(int i, AVector row)Description copied from class:AVectorMatrixReplaces 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.- Specified by:
replaceRowin classAVectorMatrix<AVector>
-
swapRows
public void swapRows(int i, int j)Description copied from class:AMatrixSwaps two rows of the matrix in place This is an elementary row operation
-
getRow
public AVector getRow(int row)
Description copied from class:AVectorMatrixGets a row of the matrix. Guaranteed to be an existing vector view by all descendants of AVectorMatrix.
-
get
public double get(int row, int column)Description copied from interface:INDArrayReturns the double value at the specified position in a 2D matrix
-
set
public void set(int row, int column, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 2D array
-
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.- Overrides:
unsafeGetin classAVectorMatrix<AVector>- Returns:
-
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.- Overrides:
unsafeSetin classAVectorMatrix<AVector>
-
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
-
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.- Specified by:
transformin interfaceIMatrix- Overrides:
transformin classAVectorMatrix<AVector>
-
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 classAVectorMatrix<AVector>- Returns:
-
clone
public Matrix 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.- Specified by:
clonein interfaceINDArray- Overrides:
clonein classAVectorMatrix<AVector>
-
exactClone
public VectorMatrixMN 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
-
-
DMelt 3.0 © DataMelt by jWork.ORG