mikera.vectorz.impl.AArrayVector 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.vectorz.impl;
import mikera.vectorz.AScalar;
import mikera.vectorz.AVector;
/**
* 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; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy