package mikera.vectorz.impl;
import mikera.vectorz.AScalar;
import mikera.vectorz.AVector;
import mikera.vectorz.util.ErrorMessages;
/**
* Base class for all vectors backed by a single final double[] array
*
* Supports arbitrary indexing: array elements may not correspond to vector elements in any particular order. Ordering of elements is
* defined by subclasses of AArrayVector.
*
* @author Mike
*
*/
public abstract class AArrayVector extends ASizedVector {
private static final long serialVersionUID = -6271828303431809681L;
protected final double[] data;
protected AArrayVector(int length, double[] data) {
super(length);
this.data=data;
}
@Override
public AScalar slice(int i) {
checkIndex(i);
return ArrayIndexScalar.wrap(data,index(i));
}
@Override
public AVector selectView(int... indices) {
if (isFullyMutable()) {
int len=indices.length;
int[] ixs=new int[len];
for (int i=0; iresult) result=v;
}
return result;
}
}
Ads help maintain this website.