use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexValueOf.
/**
* Creates an shape ndarray with the specified value
*
* @param shape the shape of the ndarray
* @param value the value to assign
* @return a complex ndarray of the specified size
* and value
*/
@Override
public IComplexNDArray complexValueOf(int[] shape, double value) {
IComplexNDArray ones = complexOnes(shape);
ones.assign(Nd4j.scalar(value));
return ones;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method concat.
/**
* concatenate ndarrays along a dimension
*
* @param dimension the dimension to concatenate along
* @param toConcat the ndarrays to concatenate
* @return the concatenate ndarrays
*/
@Override
public IComplexNDArray concat(int dimension, IComplexNDArray... toConcat) {
if (toConcat.length == 1)
return toConcat[0];
validateConcat(dimension, toConcat);
int sumAlongDim = 0;
for (int i = 0; i < toConcat.length; i++) sumAlongDim += toConcat[i].shape()[dimension];
int[] outputShape = ArrayUtil.copy(toConcat[0].shape());
outputShape[dimension] = sumAlongDim;
IComplexNDArray ret = Nd4j.createComplex(outputShape);
IComplexNDArray linear = ret.linearView();
int count = 0;
for (int i = 0; i < toConcat.length; i++) {
IComplexNDArray flattened = toConcat[i].linearView();
for (int j = 0; j < flattened.length(); j++) {
linear.putScalar(count++, flattened.getComplex(j));
}
}
return ret;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexValueOf.
/**
* Creates an shape ndarray with the specified value
*
* @param shape the shape of the ndarray
* @param value the value to assign
* @return a complex ndarray of the specified size
* and value
*/
@Override
public IComplexNDArray complexValueOf(int[] shape, IComplexNumber value) {
IComplexNDArray ones = complexOnes(shape);
ones.assign(Nd4j.scalar(value));
return ones;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexValueOf.
/**
* Creates an 1 x num ndarray with the specified value
*
* @param num the number of columns
* @param value the value to assign
* @return a complex ndarray of the specified size
* and value
*/
@Override
public IComplexNDArray complexValueOf(int num, IComplexNumber value) {
IComplexNDArray ones = complexOnes(num);
ones.assign(Nd4j.scalar(value));
return ones;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexOnes.
/**
* Create an ndarray of ones
*
* @param shape the shape of the ndarray
* @return an ndarray with ones filled in
*/
@Override
public IComplexNDArray complexOnes(int[] shape) {
IComplexNDArray ret = createComplex(shape);
ret.assign(1);
return ret;
}
Aggregations