mikera.matrixx.impl.ADenseArrayMatrix Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vectorz Show documentation
Show all versions of vectorz Show documentation
Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.
package mikera.matrixx.impl;
import mikera.arrayz.INDArray;
import mikera.arrayz.impl.IDenseArray;
import mikera.matrixx.AMatrix;
import mikera.vectorz.AVector;
import mikera.vectorz.Op2;
import mikera.vectorz.Tools;
import mikera.vectorz.Vector;
import mikera.vectorz.Vectorz;
import mikera.vectorz.impl.ADenseArrayVector;
import mikera.vectorz.impl.AStridedVector;
import mikera.vectorz.impl.ArraySubVector;
import mikera.vectorz.util.DoubleArrays;
import mikera.vectorz.util.ErrorMessages;
/**
* Abstract base class for matrices wrapping a dense (rows*cols) subset of a double[] array
* @author Mike
*/
public abstract class ADenseArrayMatrix extends AStridedMatrix implements IFastRows, IDenseArray {
private static final long serialVersionUID = -2144964424833585026L;
protected ADenseArrayMatrix(double[] data, int rows, int cols) {
super(data, rows, cols);
}
@Override
public abstract int getArrayOffset();
@Override
public boolean isPackedArray() {
return (getArrayOffset()==0) && (data.length ==(rows*cols));
}
@Override
public boolean isZero() {
return DoubleArrays.isZero(data, getArrayOffset(), rows*cols);
}
@Override
public boolean isUpperTriangular() {
// triangular test, taking into account cache layout to access via rows
int rc=rowCount();
int cc=columnCount();
int offset=getArrayOffset();
for (int i=1; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy