mikera.vectorz.impl.AComputedVector 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.ErrorMessages;
/**
* Base class for computed vectors. Assumed to be immutable and fixed size.
*
* @author Mike
*
*/
@SuppressWarnings("serial")
public abstract class AComputedVector extends ASizedVector {
protected AComputedVector(int length) {
super(length);
}
@Override
public abstract double get(int i);
@Override
public final void set(int i, double value) {
throw new UnsupportedOperationException(ErrorMessages.immutable(this));
}
@Override
public final void unsafeSet(int i, double value) {
throw new UnsupportedOperationException(ErrorMessages.immutable(this));
}
@Override
public ImmutableScalar slice(int i) {
return ImmutableScalar.create(get(i));
}
@Override
public boolean isMutable() {
return false; // i.e. immutable
}
@Override
public AComputedVector exactClone() {
return this; // OK since immutable
}
@Override
public double dotProduct(double[] data, int offset) {
double result=0.0;
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy