mikera.vectorz.impl.BaseIndexedVector 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.util.VectorzException;
/**
* Abstract base class for vectors that index into other sources
* @author Mike
*/
@SuppressWarnings("serial")
abstract class BaseIndexedVector extends ASizedVector {
protected final int[] indexes;
protected BaseIndexedVector(int length) {
super(length);
indexes=new int[length];
}
public BaseIndexedVector(int[] indexes) {
super(indexes.length);
this.indexes=indexes;
}
protected abstract BaseIndexedVector replaceIndex(int[] newIndices);
@Override
public boolean isView() {
return true;
}
@Override
public void validate() {
if (length!=indexes.length) throw new VectorzException("Wrong index length");
super.validate();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy