package mikera.matrixx.impl;
import mikera.matrixx.AMatrix;
import mikera.vectorz.AVector;
import mikera.vectorz.Op;
import mikera.vectorz.Vector;
import mikera.vectorz.Vectorz;
import mikera.vectorz.impl.Vector0;
import mikera.vectorz.util.ErrorMessages;
/**
* Abstract base class for matrices that use a collection of Vectors
* as storage for the matrix rows.
*
* @author Mike
*/
public abstract class AVectorMatrix extends ARectangularMatrix implements IFastRows {
private static final long serialVersionUID = -6838429336358726743L;
protected AVectorMatrix(int rows, int cols) {
super(rows, cols);
}
/* ================================
* Abstract interface
*/
/**
* 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.
* @param i
* @param row
*/
@Override
public abstract void replaceRow(int i, AVector row);
/**
* Gets a row of the matrix.
*
* Guaranteed to be an existing vector view by all descendants of AVectorMatrix.
*/
@Override
public abstract T getRow(int row);
@Override
public final T getRowView(int i) {
return getRow(i);
}
@Override
public double get(int row, int column) {
return getRow(row).get(column);
}
@Override
public double unsafeGet(int row, int column) {
return getRow(row).unsafeGet(column);
}
@Override
public boolean isFullyMutable() {
int rc=rowCount();
for (int i=0; i
Ads help maintain this website.