All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mikera.vectorz.impl.BaseIndexedVector Maven / Gradle / Ivy

Go to download

Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.

There is a newer version: 0.67.0
Show newest version
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