jsat.linear
Class TransposeView
- java.lang.Object
-
- jsat.linear.Matrix
-
- jsat.linear.GenericMatrix
-
- jsat.linear.TransposeView
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class TransposeView extends GenericMatrix
This class provides a free view of the transpose of a matrix. This is done by accessing the matrix elements in swapped order. This has a serious performance impact. If the base matrix storage is row major order, then accessing the TransposeView in column major order will provide the best performance.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TransposeView(Matrix base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidchangeSize(int newRows, int newCols)This method alters the size of a matrix, either adding or subtracting rows from the internal structure of the matrix.intcols()Returns the number of columns stored in this matrixdoubleget(int i, int j)Returns the value stored at at the matrix position Ai,jVecgetColumnView(int j)Obtains a vector that is backed by this, at very little memory cost.VecgetRowView(int r)Obtains a vector that is backed by this, at very little memory cost.booleanisSparce()Returnstrueif the matrix is sparse,falseotherwiseintrows()Returns the number of rows stored in this matrixvoidset(int i, int j, double value)Sets the value stored at at the matrix position Ai,j-
Methods inherited from class jsat.linear.GenericMatrix
clone, lup, lup, multiply, multiply, multiply, multiplyTranspose, multiplyTranspose, mutableAdd, mutableAdd, mutableAdd, mutableAdd, mutableMultiply, mutableMultiply, mutableTranspose, qr, qr, swapRows, transpose, transposeMultiply, transposeMultiply, transposeMultiply, zeroOut
-
Methods inherited from class jsat.linear.Matrix
add, add, add, add, canBeMutated, canMultiply, copyTo, diag, diagMult, diagMult, equals, equals, eye, getColumn, getRow, increment, isSquare, isSymmetric, isSymmetric, multiply, multiply, multiply, multiply, multiply, multiplyTranspose, multiplyTranspose, mutableAdd, mutableAdd, mutableSubtract, mutableSubtract, mutableSubtract, mutableSubtract, mutableSubtract, mutableSubtract, nnz, OuterProductUpdate, OuterProductUpdate, pascal, random, sameDimensions, subtract, subtract, subtract, subtract, toString, transpose, transposeMultiply, transposeMultiply, transposeMultiply, updateRow
-
-
-
-
Constructor Detail
-
TransposeView
public TransposeView(Matrix base)
-
-
Method Detail
-
getColumnView
public Vec getColumnView(int j)
Description copied from class:MatrixObtains a vector that is backed by this, at very little memory cost. Mutations to this vector will alter the values stored in the matrix, and vice versa.- Overrides:
getColumnViewin classMatrix- Parameters:
j- the column to obtain a view of- Returns:
- a vector backed by the specified row of the matrix
-
getRowView
public Vec getRowView(int r)
Description copied from class:MatrixObtains a vector that is backed by this, at very little memory cost. Mutations to this vector will alter the values stored in the matrix, and vice versa.- Overrides:
getRowViewin classMatrix- Parameters:
r- the row to obtain a view of- Returns:
- a vector backed by the specified row of the matrix
-
get
public double get(int i, int j)Description copied from class:MatrixReturns the value stored at at the matrix position Ai,j
-
set
public void set(int i, int j, double value)Description copied from class:MatrixSets the value stored at at the matrix position Ai,j
-
rows
public int rows()
Description copied from class:MatrixReturns the number of rows stored in this matrix
-
cols
public int cols()
Description copied from class:MatrixReturns the number of columns stored in this matrix
-
isSparce
public boolean isSparce()
Description copied from class:MatrixReturnstrueif the matrix is sparse,falseotherwise
-
changeSize
public void changeSize(int newRows, int newCols)Description copied from class:MatrixThis method alters the size of a matrix, either adding or subtracting rows from the internal structure of the matrix. Every resize call may cause a new allocation internally, and should not be called for excessive changing of a matrix. All added rows/ columns will have values of zero. If a row / column is removed, it is always the bottom/right most row / column removed. Values of the removed rows / columns will be lost.- Specified by:
changeSizein classMatrix- Parameters:
newRows- the new number of rows, must be positivenewCols- the new number of columns, must be positive.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG