use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class Nd4j method createComplex.
/**
* @param dim
* @return
*/
public static IComplexNDArray createComplex(double[] dim) {
IComplexNDArray ret = INSTANCE.createComplex(dim, new int[] { 1, dim.length / 2 });
logCreationIfNecessary(ret);
return ret;
}
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, double value) {
IComplexNDArray ones = complexOnes(num);
ones.assign(Nd4j.createDouble(value, 0.0));
return ones;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexFlatten.
@Override
public IComplexNDArray complexFlatten(List<IComplexNDArray> flatten) {
int length = 0;
for (IComplexNDArray m : flatten) length += m.length();
IComplexNDArray ret = Nd4j.createComplex(length);
int linearIndex = 0;
for (IComplexNDArray d : flatten) {
IComplexNDArray flattened = d.linearView();
for (int i = 0; i < d.length(); i++) {
ret.putScalar(linearIndex++, flattened.getComplex(i));
}
}
return ret;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexOnes.
/**
* Creates an ndarray
*
* @param columns the number of columns in the row vector
* @return ndarray
*/
@Override
public IComplexNDArray complexOnes(int columns) {
IComplexNDArray base = createComplex(new int[] { 1, columns });
base.assign(1);
return base;
}
use of org.nd4j.linalg.api.complex.IComplexNDArray in project nd4j by deeplearning4j.
the class BaseNDArrayFactory method complexFlatten.
@Override
public IComplexNDArray complexFlatten(IComplexNDArray[] flatten) {
int length = 0;
for (IComplexNDArray m : flatten) length += m.length();
IComplexNDArray ret = Nd4j.createComplex(length);
int linearIndex = 0;
for (IComplexNDArray d : flatten) {
IComplexNDArray flattened = d.linearView();
for (int i = 0; i < d.length(); i++) {
ret.putScalar(linearIndex++, flattened.getComplex(i));
}
}
return ret;
}
Aggregations