mikera.matrixx.impl
Class TransposedMatrix
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<AVector>
-
- mikera.matrixx.AMatrix
-
- mikera.matrixx.impl.ARectangularMatrix
-
- mikera.matrixx.impl.TransposedMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<AVector>, INDArray, IMatrix
public class TransposedMatrix extends ARectangularMatrix
Class representing a transposed view of another matrix The transposed matrix is a reference to the underlying matrix data- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidabs()Replaces all elements of this array with their absolute values, according to Math.abs(double)voidaddSparse(double value)Adds to the non-sparse elements of this arrayvoidapplyOp(IOperator op)Applies a unary operator to all elements of the array (in-place)voidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)voidapplyOp(Op2 op, double b)Applies a binary operator to this array and a double value.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 arraydoubledeterminant()Calculates the determinant of the matrix.doublediagonalProduct()Computes the product of entries on the main diagonal of a matrixdoubleelementMax()Returns the maximum element value in this array.doubleelementMin()Returns the maximum element value in this array.doubleelementSum()Returns the sum of all elements in this matrixbooleanequals(AMatrix m)Returns true if this matrix is exactly equal to another matrixbooleanequalsTranspose(AMatrix a)Tests if this matrix is exactly equal to the transpose of another matrixTransposedMatrixexactClone()Creates a deep clone of an array, using the same class implementation as the original arrayvoidexp()Computes the function e^x (in-place) for all array elementsvoidfill(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 matrixAVectorgetBand(int i)Gets a specific band of the matrix, as a view vector.AVectorgetColumn(int column)Returns a column of the matrix.AVectorgetColumnClone(int column)Returns a column of the matrix as a new cloned, mutable vector The cloned column may be modified without affecting the original matrix.java.util.List<AVector>getColumns()Gets a List of columns of a matrix.AVectorgetColumnView(int column)Returns a column of the matrix as a vector view.INDArraygetComponent(int k)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 <= kINDArray[]getComponents()Gets all components in a new array, with length componentCount();voidgetElements(double[] dest, int destOffset)Copies all elements of this array a double array at the specified offsetAVectorgetRow(int row)Returns a row of the matrix.AVectorgetRowClone(int row)Returns a row of the matrix as a new cloned, mutable vector.java.util.List<AVector>getRows()Gets a List of rows of a matrix.AVectorgetRowView(int row)Returns a row of the matrix as a vector view.AMatrixgetTranspose()Returns the transpose of this array.AMatrixgetTransposeCopy()Gets a mutable transposed clone of the matrixAMatrixgetTransposeView()Returns a transposed view of the array.AMatrixinnerProduct(AMatrix s)Computes the inner product of this matrix with another.booleanisBoolean()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.booleanisLowerTriangular()Returns true if a matrix is lower triangular.booleanisMutable()Returns true if the INDArray is mutable (at least partially)booleanisSparse()Returns true if the array is in a sparse formatbooleanisSymmetric()Returns true if a matrix is symmetricbooleanisUpperTriangular()Returns true if a matrix is upper triangular An upper triangular matrix is defined as having all elements equal to 0.0 where i > jbooleanisView()Return true if this array is considered as a view type.booleanisZero()Returns true if the matrix is the zero matrix (all components zero)voidlog()Computes the natural logarithm (in-place) for all array elementsintlowerBandwidth()Computes the lower bandwidth of a matrix, i.e.intlowerBandwidthLimit()A limit on the lower bandwidth of the banded matrix.voidmultiply(double factor)Multiplies all elements of the array in place by a given double valuevoidnegate()Negates all elements in the array in placelongnonZeroCount()Returns the number of non-zero elements in the array.voidreciprocal()Replaces all elements in the array with their reciprocalvoidset(int row, int column, double value)Sets a value at a given position in a mutable 2D arrayvoidsetSparse(double value)Sets the non-sparse elements of this array to the specified value May throw an exception if non-sparse elements are not mutablevoidsignum()Calculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)intsliceCount()Returns the number of major slices in this array (i.e.AMatrixsparseClone()Creates a fully mutable clone of this array.voidsqrt()Computes the square root of all elements in the arrayvoidsquare()Squares all elements of the array in placeMatrixtoMatrix()Coerces the matrix to the standard mutable Matrix type in row major order.MatrixtoMatrixTranspose()Coerces the transpose of a matrix to the standard mutable Matrix type in row major order.doubletrace()Computes the trace of a matrix, i.e.AMatrixtransposeInnerProduct(AMatrix s)AMatrixtransposeInnerProduct(Matrix s)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.intupperBandwidth()Computes the upper bandwidth of a matrix, i.e.intupperBandwidthLimit()A limit on the upper bandwidth of the banded matrix.static AMatrixwrap(AMatrix m)-
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
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, applyOpCopy, asDoubleArray, asElementList, asVector, bandIndex, bandPosition, bandStartColumn, bandStartRow, broadcast, broadcastCloneLike, broadcastCopyLike, broadcastLike, broadcastLike, clamp, clone, composeWith, copy, dense, denseClone, dimensionality, divide, divide, divide, divide, divideCopy, elementIterator, elementsEqual, elementSquaredSum, ensureMutable, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equalsArray, get, get, get, get, getBandWrapped, getLeadingDiagonal, getLongShape, getSlices, getSlices, getSliceViews, hashCode, hasOrthonormalColumns, hasOrthonormalRows, hasUncountable, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, inputDimensions, inverse, isDiagonal, isElementConstrained, isHermitian, isIdentity, isInvertible, isOrthogonal, isOrthogonal, isPositiveDefinite, isRectangularDiagonal, iterator, join, mul, multiply, multiply, multiply, multiplyCopy, multiplyRow, mutable, outerProduct, outputDimensions, pow, rank, 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, slice, slice, sparse, sub, sub, sub, subArray, subCopy, subMatrix, swapColumns, swapRows, toAffineTransform, toDoubleArray, toDoubleBuffer, toMutableMatrix, toNestedDoubleArrays, toSliceArray, toString, toStringFull, toVector, transform, transform, transformInPlace, transformInPlace, transposeInPlace, validate
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
absCopy, absDiff, absDiffCopy, add, addApplyOp, addAt, addCopy, addInnerProduct, addInnerProduct, addMultipleSparse, addPower, addPower, broadcastLike, compareTo, density, divideCopy, elementAbsPowSum, elementMaxAbs, elementPowSum, elementProduct, epsilonEquals, equals, equalsArray, get, get, get, get, 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, broadcastLike, divideCopy, elementAbsPowSum, elementMaxAbs, elementPowSum, elementProduct, epsilonEquals, equalsArray, get, get, get, get, getElements, getElements, getElements, isDense, join, multiplyCopy, negateCopy, reciprocalCopy, scale, scaleCopy, setElements, setInnerProduct, signumCopy, sliceValue, squareCopy, sub, subCopy, withComponents
-
-
-
-
Method Detail
-
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
-
isMutable
public boolean isMutable()
Description copied from interface:INDArrayReturns true if the INDArray is mutable (at least partially)
-
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.- 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.
-
getRow
public AVector getRow(int row)
Description copied from interface:IMatrixReturns a row of the matrix. May or may not be a view, depending on matrix type. Intended for the fastest possible read access of the row. This often means a view, but might not be (e.g. getRow on a Matrix33 returns a Vector3).
-
getColumn
public AVector getColumn(int column)
Description copied from interface:IMatrixReturns a column of the matrix. May or may not be a view, depending on matrix type. Intended for the fastest possible read access of the column. This often means a view, but might not be (e.g. getColumn on a Matrix33 returns a Vector3).
-
getRowClone
public AVector getRowClone(int row)
Description copied from interface:IMatrixReturns a row of the matrix as a new cloned, mutable vector. The cloned row may be modified without affecting the original matrix.- Specified by:
getRowClonein interfaceIMatrix- Overrides:
getRowClonein classAMatrix
-
getColumnClone
public AVector getColumnClone(int column)
Description copied from interface:IMatrixReturns a column of the matrix as a new cloned, mutable vector The cloned column may be modified without affecting the original matrix.- Specified by:
getColumnClonein interfaceIMatrix- Overrides:
getColumnClonein classAMatrix
-
getRowView
public AVector getRowView(int row)
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
-
getColumnView
public AVector getColumnView(int column)
Description copied from interface:IMatrixReturns a column of the matrix as a vector view. May be used to modify the original matrix.- Specified by:
getColumnViewin interfaceIMatrix- Overrides:
getColumnViewin classAMatrix
-
getRows
public java.util.List<AVector> getRows()
Description copied from interface:IMatrixGets a List of rows of a matrix. May return either copies or views, depending on the specific matrix type.
-
getColumns
public java.util.List<AVector> getColumns()
Description copied from interface:IMatrixGets a List of columns of a matrix. May return either copies or views, depending on the specific matrix type.- Specified by:
getColumnsin interfaceIMatrix- Overrides:
getColumnsin classAMatrix- Returns:
-
sliceCount
public int sliceCount()
Description copied from interface:INDArrayReturns the number of major slices in this array (i.e. the size of dimension 0)- Specified by:
sliceCountin interfaceINDArray- Overrides:
sliceCountin classAMatrix
-
trace
public double trace()
Description copied from interface:IMatrixComputes the trace of a matrix, i.e. the sum of all elements on the leading diagonal
-
diagonalProduct
public double diagonalProduct()
Description copied from class:AMatrixComputes the product of entries on the main diagonal of a matrix- Specified by:
diagonalProductin interfaceIMatrix- Overrides:
diagonalProductin classAMatrix- Returns:
-
toMatrixTranspose
public Matrix toMatrixTranspose()
Description copied from class:AMatrixCoerces the transpose of a matrix to the standard mutable Matrix type in row major order. Performs a copy if necessary.- Overrides:
toMatrixTransposein classAMatrix
-
toMatrix
public Matrix toMatrix()
Description copied from class:AMatrixCoerces the matrix to the standard mutable Matrix type in row major order. Performs a copy if necessary.
-
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 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
-
determinant
public double determinant()
Description copied from class:AMatrixCalculates the determinant of the matrix.- Overrides:
determinantin classAMatrix
-
isSymmetric
public boolean isSymmetric()
Description copied from class:AMatrixReturns true if a matrix is symmetric- Specified by:
isSymmetricin interfaceIMatrix- Overrides:
isSymmetricin classAMatrix- Returns:
-
isSparse
public boolean isSparse()
Description copied from interface:INDArrayReturns true if the array is in a sparse format- Specified by:
isSparsein interfaceINDArray- Overrides:
isSparsein classAbstractArray<AVector>
-
isZero
public boolean isZero()
Description copied from class:AMatrixReturns true if the matrix is the zero matrix (all components zero)
-
isUpperTriangular
public boolean isUpperTriangular()
Description copied from class:AMatrixReturns true if a matrix is upper triangular An upper triangular matrix is defined as having all elements equal to 0.0 where i > j- Overrides:
isUpperTriangularin classAMatrix
-
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).- Overrides:
lowerBandwidthLimitin classAMatrix- Returns:
-
lowerBandwidth
public int lowerBandwidth()
Description copied from class:AMatrixComputes the lower bandwidth of a matrix, i.e. the number of bands below the leading diagonal that cover all non-zero values- Overrides:
lowerBandwidthin classAMatrix- Returns:
-
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).- Overrides:
upperBandwidthLimitin classAMatrix- Returns:
-
upperBandwidth
public int upperBandwidth()
Description copied from class:AMatrixComputes the upper bandwidth of a matrix, i.e. the number of bands above the leading diagonal that cover all non-zero values- Overrides:
upperBandwidthin classAMatrix- Returns:
-
getBand
public AVector getBand(int i)
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.
-
isLowerTriangular
public boolean isLowerTriangular()
Description copied from class:AMatrixReturns true if a matrix is lower triangular. A lower triangular matrix is defined as having all elements equal to 0.0 where i < j- Overrides:
isLowerTriangularin classAMatrix
-
getTranspose
public AMatrix 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
-
getTransposeView
public AMatrix getTransposeView()
Description copied from interface:INDArrayReturns a transposed view of the array. May throw UnsupportedOperationException if the array type does not support this capability- Specified by:
getTransposeViewin interfaceINDArray- Specified by:
getTransposeViewin interfaceIMatrix- Overrides:
getTransposeViewin classAMatrix- Returns:
- the transpose of this matrix, as a view
-
getTransposeCopy
public AMatrix getTransposeCopy()
Description copied from class:AMatrixGets a mutable transposed clone of the matrix- Specified by:
getTransposeCopyin interfaceINDArray- Overrides:
getTransposeCopyin classAMatrix
-
transposeInnerProduct
public AMatrix transposeInnerProduct(AMatrix s)
- Overrides:
transposeInnerProductin classAMatrix
-
transposeInnerProduct
public AMatrix transposeInnerProduct(Matrix s)
- Overrides:
transposeInnerProductin classAMatrix
-
innerProduct
public AMatrix innerProduct(AMatrix s)
Description copied from interface:IMatrixComputes the inner product of this matrix with another. Equivalent to matrix x matrix multiplication- Specified by:
innerProductin interfaceIMatrix- Overrides:
innerProductin classAMatrix- Returns:
-
sparseClone
public AMatrix sparseClone()
Description copied from interface:INDArrayCreates a fully mutable clone of this array. Will use a sparse format if possible.- Specified by:
sparseClonein interfaceINDArray- Overrides:
sparseClonein classAMatrix
-
exactClone
public TransposedMatrix 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
-
equals
public boolean equals(AMatrix m)
Description copied from class:AMatrixReturns true if this matrix is exactly equal to another matrix
-
equalsTranspose
public boolean equalsTranspose(AMatrix a)
Description copied from class:AMatrixTests if this matrix is exactly equal to the transpose of another matrix- Overrides:
equalsTransposein classAMatrix- 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.
-
isBoolean
public boolean isBoolean()
Description copied from interface:INDArrayReturns true if the array is boolean (contains only 0.0 or 1.0 values)
-
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 INDArray getComponent(int k)
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:
-
getComponents
public INDArray[] getComponents()
Description copied from interface:INDArrayGets all components in a new array, with length componentCount();- Specified by:
getComponentsin interfaceINDArray- Overrides:
getComponentsin classAbstractArray<AVector>- Returns:
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
applyOp
public void applyOp(IOperator op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
applyOp
public void applyOp(Op2 op, double b)
Description copied from interface:INDArrayApplies a binary operator to this array and a double value. Works as if the double value was broadcast to the shape of this array.
-
multiply
public void multiply(double factor)
Description copied from interface:INDArrayMultiplies all elements of the array in place by a given double value
-
fill
public void fill(double value)
Description copied from interface:INDArrayFills this array with a single double value. Requires the array to be mutable.
-
setSparse
public void setSparse(double value)
Description copied from interface:INDArraySets the non-sparse elements of this array to the specified value May throw an exception if non-sparse elements are not mutable- Specified by:
setSparsein interfaceINDArray- Overrides:
setSparsein classAbstractArray<AVector>
-
addSparse
public void addSparse(double value)
Description copied from interface:INDArrayAdds to the non-sparse elements of this array- Specified by:
addSparsein interfaceINDArray- Overrides:
addSparsein classAbstractArray<AVector>
-
elementSum
public double elementSum()
Description copied from class:AMatrixReturns the sum of all elements in this matrix- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAMatrix
-
elementMin
public double elementMin()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMinin interfaceINDArray- Overrides:
elementMinin classAbstractArray<AVector>
-
elementMax
public double elementMax()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMaxin interfaceINDArray- Overrides:
elementMaxin classAbstractArray<AVector>
-
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
-
abs
public void abs()
Description copied from interface:INDArrayReplaces all elements of this array with their absolute values, according to Math.abs(double)
-
square
public void square()
Description copied from interface:INDArraySquares all elements of the array in place
-
sqrt
public void sqrt()
Description copied from interface:INDArrayComputes the square root of all elements in the array
-
signum
public void signum()
Description copied from interface:INDArrayCalculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)
-
negate
public void negate()
Description copied from interface:INDArrayNegates all elements in the array in place
-
log
public void log()
Description copied from interface:INDArrayComputes the natural logarithm (in-place) for all array elements
-
exp
public void exp()
Description copied from interface:INDArrayComputes the function e^x (in-place) for all array elements
-
reciprocal
public void reciprocal()
Description copied from interface:INDArrayReplaces all elements in the array with their reciprocal- Specified by:
reciprocalin interfaceINDArray- Overrides:
reciprocalin classAMatrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG
You see the box below because you did not login.