public class SubMatrix extends GenericMatrix
NB2
Constructor and Description |
---|
SubMatrix(Matrix baseMatrix,
int firstRow,
int firstColumn,
int toRow,
int toCol)
Creates a new matrix that is a sub view of the given base matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
changeSize(int newRows,
int newCols)
This method alters the size of a matrix, either adding or subtracting
rows from the internal structure of the matrix.
|
int |
cols()
Returns the number of columns stored in this matrix
|
double |
get(int i,
int j)
Returns the value stored at at the matrix position Ai,j
|
Matrix |
getBaseMatrix()
Returns the matrix that is the base for this sub matrix.
|
Vec |
getColumnView(int j)
Obtains a vector that is backed by this, at very little memory
cost.
|
int |
getFirstColumn()
Returns the column offset used from the base matrix
|
int |
getFirstRow()
Returns the row offset used from the base matrix
|
protected Matrix |
getMatrixOfSameType(int rows,
int cols)
Creates a new matrix of the same type
|
Vec |
getRowView(int r)
Obtains a vector that is backed by this, at very little memory
cost.
|
boolean |
isSparce()
Returns
true if the matrix is sparse, false otherwise |
int |
rows()
Returns the number of rows stored in this matrix
|
void |
set(int i,
int j,
double value)
Sets the value stored at at the matrix position Ai,j
|
clone, lup, lup, multiply, multiply, multiply, multiplyTranspose, multiplyTranspose, mutableAdd, mutableAdd, mutableAdd, mutableAdd, mutableMultiply, mutableMultiply, mutableTranspose, qr, qr, swapRows, transpose, transposeMultiply, transposeMultiply, transposeMultiply, zeroOut
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
public SubMatrix(Matrix baseMatrix, int firstRow, int firstColumn, int toRow, int toCol)
baseMatrix
- the base matrix to get a view offirstRow
- the first row to consider as part of the sub matrix, starting from 0 inclusivefirstColumn
- the first column to consider as part of the sub matrix, starting from 0 inclusivetoRow
- the last row from the base matrix to consider, exclusivetoCol
- the last column from the base matrix to consider, exclusivepublic Matrix getBaseMatrix()
public int getFirstRow()
public int getFirstColumn()
protected Matrix getMatrixOfSameType(int rows, int cols)
GenericMatrix
getMatrixOfSameType
in class GenericMatrix
rows
- the number of rows for the matrix to havecols
- the number of columns for the matrix to havepublic double get(int i, int j)
Matrix
public void set(int i, int j, double value)
Matrix
public Vec getRowView(int r)
Matrix
getRowView
in class Matrix
r
- the row to obtain a view ofpublic Vec getColumnView(int j)
Matrix
getColumnView
in class Matrix
j
- the column to obtain a view ofpublic int rows()
Matrix
public int cols()
Matrix
public boolean isSparce()
Matrix
true
if the matrix is sparse, false
otherwisepublic void changeSize(int newRows, int newCols)
changeSize
in class Matrix
newRows
- the new number of rows, must be positivenewCols
- the new number of columns, must be positive.Copyright © 2017. All rights reserved.