mikera.arrayz.impl.JoinedArray 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.arrayz.impl;
import mikera.arrayz.Arrayz;
import mikera.arrayz.INDArray;
import mikera.vectorz.Op;
import mikera.vectorz.util.ErrorMessages;
/**
* Array created by joining two arrays along a specific dimension
*
* @author Mike
*
*/
public class JoinedArray extends BaseShapedArray {
private static final long serialVersionUID = 4929988077055768422L;
final INDArray left;
final INDArray right;
final int dimension;
final int split;
private JoinedArray(INDArray left, INDArray right, int dim) {
super(left.getShapeClone());
this.left=left;
this.right=right;
dimension=dim;
this.split=shape[dimension];
shape[dimension]+=right.getShape(dimension);
}
public static JoinedArray join(INDArray a, INDArray b, int dim) {
int n=a.dimensionality();
if (b.dimensionality()!=n) throw new IllegalArgumentException(ErrorMessages.incompatibleShapes(a, b));
for (int i=0; i=sliceCount())) {
throw new IndexOutOfBoundsException(ErrorMessages.invalidIndex(this, x));
}
if (x=sliceCount())) {
throw new IndexOutOfBoundsException(ErrorMessages.invalidIndex(this, x,y));
}
if (x=sliceCount())) {
throw new IndexOutOfBoundsException(ErrorMessages.invalidIndex(this, x,y));
}
if (y
© 2015 - 2025 Weber Informatics LLC | Privacy Policy