org.nd4j.linalg.factory
Class BaseNDArrayFactory
- java.lang.Object
-
- org.nd4j.linalg.factory.BaseNDArrayFactory
-
- All Implemented Interfaces:
- NDArrayFactory
- Direct Known Subclasses:
- JblasNDArrayFactory
public abstract class BaseNDArrayFactory extends java.lang.Object implements NDArrayFactory
Base NDArrayFactory class. Allows specification or data type and row (c) or column(fortran) major order
-
-
Field Summary
-
Fields inherited from interface org.nd4j.linalg.factory.NDArrayFactory
C, FORTRAN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description INDArrayappendBias(INDArray... vectors)Merge the vectors and append a bias.INDArrayarange(double begin, double end)Array of evenly spaced values.INDArraybilinearProducts(INDArray curr, INDArray in)Returns a column vector where each entry is the nth bilinear product of the nth slices of the two tensors.IComplexNDArraycomplexFlatten(IComplexNDArray[] flatten)IComplexNDArraycomplexFlatten(java.util.List<IComplexNDArray> flatten)IComplexNDArraycomplexOnes(int columns)Creates an ndarrayIComplexNDArraycomplexOnes(int[] shape)Create an ndarray of onesINDArraycomplexOnes(int rows, int columns)Creates an ndarrayIComplexNDArraycomplexScalar(java.lang.Number value)Create a scalar ndarray with the specified offsetIComplexNDArraycomplexScalar(java.lang.Number value, int offset)Create a scalar ndarray with the specified offsetIComplexNDArraycomplexValueOf(int[] shape, double value)Creates an shape ndarray with the specified valueIComplexNDArraycomplexValueOf(int[] shape, IComplexNumber value)Creates an shape ndarray with the specified valueIComplexNDArraycomplexValueOf(int num, double value)Creates an 1 x num ndarray with the specified valueIComplexNDArraycomplexValueOf(int num, IComplexNumber value)Creates an 1 x num ndarray with the specified valueIComplexNDArraycomplexZeros(int columns)Creates an ndarrayIComplexNDArraycomplexZeros(int[] shape)Create an ndarray of onesIComplexNDArraycomplexZeros(int rows, int columns)Creates a matrix of zerosIComplexNDArrayconcat(int dimension, IComplexNDArray... toConcat)concatenate ndarrays along a dimensionINDArrayconcat(int dimension, INDArray... toConcat)concatenate ndarrays along a dimensionvoidcopy(INDArray a, INDArray b)Copy a to bINDArraycreate(double[] data)Creates a row vector with the dataINDArraycreate(double[] data, int[] shape)Create an ndrray with the specified shapeabstract INDArraycreate(double[] data, int[] shape, int[] stride, int offset)Creates an ndarray with the specified shapeINDArraycreate(double[] data, int rows, int columns, int[] stride, int offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data)Creates a row vector with the dataINDArraycreate(float[] data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(float[] data, int[] shape, int offset)abstract INDArraycreate(float[] data, int[] shape, int[] stride, int offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data, int rows, int columns, int[] stride, int offset)Creates an ndarray with the specified shapeINDArraycreate(int columns)Creates a row vector with the specified number of columnsINDArraycreate(int[] shape)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] stride, int offset)Creates an ndarray with the specified shapeINDArraycreate(int rows, int columns)Creates an ndarray with the specified shapeINDArraycreate(int rows, int columns, char ordering)INDArraycreate(int rows, int columns, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(int rows, int columns, int[] stride, int offset)Creates an ndarray with the specified shapeabstract INDArraycreate(java.util.List<INDArray> list, int[] shape)Creates an ndarray with the specified shapeDataBuffercreateBuffer(DataBuffer[] buffers)DataBuffercreateBuffer(double[] concat)DataBuffercreateBuffer(float[] concat)IComplexNDArraycreateComplex(double[] data)Creates an ndarray with the specified dataIComplexNDArraycreateComplex(double[] data, int[] shape)Create an ndrray with the specified shapeIComplexNDArraycreateComplex(double[] data, int[] shape, int offset)IComplexNDArraycreateComplex(double[] data, int[] shape, int[] stride)Create an ndrray with the specified shapeabstract IComplexNDArraycreateComplex(double[] data, int[] shape, int[] stride, int offset)Creates a complex ndarray with the specified shapeabstract IComplexNDArraycreateComplex(double[] data, int[] shape, int[] stride, int offset, char ordering)Create a complex ndarray with the given dataIComplexNDArraycreateComplex(double[] data, int[] shape, int offset, char ordering)IComplexNDArraycreateComplex(double[] data, int rows, int columns, int[] stride, int offset)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(float[] data, int[] shape)Create an ndrray with the specified shapeIComplexNDArraycreateComplex(float[] data, int[] shape, int[] stride)Create an ndrray with the specified shapeabstract IComplexNDArraycreateComplex(float[] data, int[] shape, int[] stride, int offset)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(float[] data, int rows, int columns, int[] stride, int offset)Creates a complex ndarray with the specified shapeabstract IComplexNDArraycreateComplex(IComplexNumber[] data, int[] shape)Create a complex ndarray from the passed in indarrayabstract IComplexNDArraycreateComplex(INDArray arr)Create a complex ndarray from the passed in indarrayIComplexNDArraycreateComplex(int columns)Creates an ndarrayIComplexNDArraycreateComplex(int[] shape)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(int[] shape, int[] stride)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(int[] shape, int[] stride, int offset)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(int rows, int columns)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(int rows, int columns, int[] stride)Creates a complex ndarray with the specified shapeIComplexNDArraycreateComplex(int rows, int columns, int[] stride, int offset)Creates a complex ndarray with the specified shapeabstract IComplexNDArraycreateComplex(java.util.List<IComplexNDArray> arrs, int[] shape)Create a complex ndarray from the passed in indarrayabstract IComplexDoublecreateDouble(double real, double imag)Create an instance of a complex doubleabstract IComplexFloatcreateFloat(float real, float imag)Create floatjava.lang.Stringdtype()Returns the data type for this ndarrayINDArrayeye(int n)Create the identity ndarrayINDArrayhstack(INDArray... arrs)Concatenates two matrices horizontally.INDArraylinspace(int lower, int upper, int num)Generate a linearly spaced vectorINDArrayones(int columns)Creates a row vector with the specified number of columnsINDArrayones(int[] shape)Create an ndarray of onesINDArrayones(int rows, int columns)Creates a row vector with the specified number of columnscharorder()Returns the order for this ndarray for internal data storageINDArrayrand(int[] shape)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(int[] shape, double min, double max, RandomGenerator rng)INDArrayrand(int[] shape, float min, float max, RandomGenerator rng)Generates a random matrix between min and maxINDArrayrand(int[] shape, long seed)Create a random ndarray with the given shape using the given rngINDArrayrand(int[] shape, RandomGenerator r)Create a random ndarray with the given shape using the given rngINDArrayrand(int[] shape, RealDistribution r)Create a random ndarray with the given shape using the given rngINDArrayrand(int rows, int columns)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(int rows, int columns, double min, double max, RandomGenerator rng)INDArrayrand(int rows, int columns, float min, float max, RandomGenerator rng)Generates a random matrix between min and maxINDArrayrand(int rows, int columns, long seed)Create a random ndarray with the given shape using the given rngINDArrayrand(int rows, int columns, RandomGenerator r)Create a random ndarray with the given shape using the given rngINDArrayrandn(int[] shape)Random normal using the current time stamp as the seedINDArrayrandn(int[] shape, long seed)Random normal using the specified seedINDArrayrandn(int[] shape, RandomGenerator r)Random normal using the given rngINDArrayrandn(int rows, int columns)Random normal using the current time stamp as the seedINDArrayrandn(int rows, int columns, long seed)Random normal using the specified seedINDArrayrandn(int rows, int columns, RandomGenerator r)Random normal using the given rngINDArrayreverse(INDArray reverse)Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etcINDArrayrot(INDArray reverse)Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etcvoidrot90(INDArray toRotate)Rotate a matrix 90 degreesINDArrayscalar(double value)Create a scalar nd array with the specified value and offsetINDArrayscalar(double value, int offset)Create a scalar nd array with the specified value and offsetINDArrayscalar(float value)Create a scalar nd array with the specified value and offsetINDArrayscalar(float value, int offset)Create a scalar nd array with the specified value and offsetIComplexNDArrayscalar(IComplexDouble value)Create a scalar nd array with the specified value and offsetIComplexNDArrayscalar(IComplexDouble value, int offset)Create a scalar nd array with the specified value and offsetIComplexNDArrayscalar(IComplexFloat value)Create a scalar nd array with the specified value and offsetIComplexNDArrayscalar(IComplexFloat value, int offset)Create a scalar nd array with the specified value and offsetIComplexNDArrayscalar(IComplexNumber value)Create a scalar ndarray with the specified offsetIComplexNDArrayscalar(IComplexNumber value, int offset)Create a scalar ndarray with the specified offsetINDArrayscalar(java.lang.Number value)Create a scalar ndarray with the specified offsetINDArrayscalar(java.lang.Number value, int offset)Create a scalar ndarray with the specified offsetvoidsetDType(java.lang.String dtype)Sets the data typevoidsetOrder(char order)Sets the order.INDArraytoFlattened(java.util.Collection<INDArray> matrices)Returns a vector with all of the elements in every nd array equal to the sum of the lengths of the ndarraysINDArraytoFlattened(INDArray... matrices)INDArraytoFlattened(int length, java.util.Iterator<? extends INDArray>... matrices)Returns a flattened ndarray with all of the elements in each ndarray regardless of dimensionINDArrayvalueArrayOf(int[] shape, double value)Creates an ndarray with the specified value as the only value in the ndarrayINDArrayvalueArrayOf(int rows, int columns, double value)Creates a row vector with the specified number of columnsINDArrayvstack(INDArray... arrs)Concatenates two matrices vertically.INDArrayzeros(int columns)Creates a row vector with the specified number of columnsINDArrayzeros(int[] shape)Create an ndarray of zerosINDArrayzeros(int rows, int columns)Creates a row vector with the specified number of columns-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.factory.NDArrayFactory
create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex, createComplex
-
-
-
-
Method Detail
-
setOrder
public void setOrder(char order)
Sets the order. Primarily for testing purposes- Specified by:
setOrderin interfaceNDArrayFactory- Parameters:
order-
-
rand
public INDArray rand(int[] shape, double min, double max, RandomGenerator rng)
- Specified by:
randin interfaceNDArrayFactory
-
rand
public INDArray rand(int rows, int columns, double min, double max, RandomGenerator rng)
- Specified by:
randin interfaceNDArrayFactory
-
setDType
public void setDType(java.lang.String dtype)
Sets the data type- Specified by:
setDTypein interfaceNDArrayFactory- Parameters:
dtype-
-
order
public char order()
Returns the order for this ndarray for internal data storage- Specified by:
orderin interfaceNDArrayFactory- Returns:
- the order (c or f)
-
dtype
public java.lang.String dtype()
Returns the data type for this ndarray- Specified by:
dtypein interfaceNDArrayFactory- Returns:
- the data type for this ndarray
-
linspace
public INDArray linspace(int lower, int upper, int num)
Generate a linearly spaced vector- Specified by:
linspacein interfaceNDArrayFactory- Parameters:
lower- upper boundupper- lower boundnum- the step size- Returns:
- the linearly spaced vector
-
createBuffer
public DataBuffer createBuffer(DataBuffer[] buffers)
- Specified by:
createBufferin interfaceNDArrayFactory
-
create
public INDArray create(int rows, int columns, char ordering)
- Specified by:
createin interfaceNDArrayFactory
-
createBuffer
public DataBuffer createBuffer(double[] concat)
- Specified by:
createBufferin interfaceNDArrayFactory
-
createBuffer
public DataBuffer createBuffer(float[] concat)
- Specified by:
createBufferin interfaceNDArrayFactory
-
toFlattened
public INDArray toFlattened(java.util.Collection<INDArray> matrices)
Returns a vector with all of the elements in every nd array equal to the sum of the lengths of the ndarrays- Specified by:
toFlattenedin interfaceNDArrayFactory- Parameters:
matrices- the ndarrays to getFloat a flattened representation of- Returns:
- the flattened ndarray
-
toFlattened
public INDArray toFlattened(int length, java.util.Iterator<? extends INDArray>... matrices)
Description copied from interface:NDArrayFactoryReturns a flattened ndarray with all of the elements in each ndarray regardless of dimension- Specified by:
toFlattenedin interfaceNDArrayFactorymatrices- the ndarrays to use- Returns:
- a flattened ndarray of the elements in the order of titerating over the ndarray and the linear view of each
-
bilinearProducts
public INDArray bilinearProducts(INDArray curr, INDArray in)
Returns a column vector where each entry is the nth bilinear product of the nth slices of the two tensors.- Specified by:
bilinearProductsin interfaceNDArrayFactory
-
toFlattened
public INDArray toFlattened(INDArray... matrices)
- Specified by:
toFlattenedin interfaceNDArrayFactory
-
eye
public INDArray eye(int n)
Create the identity ndarray- Specified by:
eyein interfaceNDArrayFactory- Parameters:
n- the number for the identity- Returns:
-
rot90
public void rot90(INDArray toRotate)
Rotate a matrix 90 degrees- Specified by:
rot90in interfaceNDArrayFactory- Parameters:
toRotate- the matrix to rotate
-
rot
public INDArray rot(INDArray reverse)
Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etc- Specified by:
rotin interfaceNDArrayFactory- Parameters:
reverse- the matrix to reverse- Returns:
- the reversed matrix
-
reverse
public INDArray reverse(INDArray reverse)
Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etc- Specified by:
reversein interfaceNDArrayFactory- Parameters:
reverse- the matrix to reverse- Returns:
- the reversed matrix
-
arange
public INDArray arange(double begin, double end)
Array of evenly spaced values.- Specified by:
arangein interfaceNDArrayFactory- Parameters:
begin- the begin of the rangeend- the end of the range- Returns:
- the range vector
-
createFloat
public abstract IComplexFloat createFloat(float real, float imag)
Create float- Specified by:
createFloatin interfaceNDArrayFactory- Parameters:
real- real componentimag- imag component- Returns:
-
createDouble
public abstract IComplexDouble createDouble(double real, double imag)
Create an instance of a complex double- Specified by:
createDoublein interfaceNDArrayFactory- Parameters:
real- the real componentimag- the imaginary component- Returns:
- a new imaginary double with the specified real and imaginary components
-
copy
public void copy(INDArray a, INDArray b)
Copy a to b- Specified by:
copyin interfaceNDArrayFactory- Parameters:
a- the origin matrixb- the destination matrix
-
rand
public INDArray rand(int[] shape, float min, float max, RandomGenerator rng)
Generates a random matrix between min and max- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the number of rows of the matrixmin- the minimum numbermax- the maximum numberrng- the rng to use- Returns:
- a random matrix of the specified shape and range
-
rand
public INDArray rand(int rows, int columns, float min, float max, RandomGenerator rng)
Generates a random matrix between min and max- Specified by:
randin interfaceNDArrayFactory- Parameters:
rows- the number of rows of the matrixcolumns- the number of columns in the matrixmin- the minimum numbermax- the maximum numberrng- the rng to use- Returns:
- a random matrix of the specified shape and range
-
appendBias
public INDArray appendBias(INDArray... vectors)
Merge the vectors and append a bias. Each vector must be either row or column vectors. An exception is thrown for inconsistency (mixed row and column vectors)- Specified by:
appendBiasin interfaceNDArrayFactory- Parameters:
vectors- the vectors to merge- Returns:
- the merged ndarray appended with the bias
-
createComplex
public abstract IComplexNDArray createComplex(INDArray arr)
Create a complex ndarray from the passed in indarray- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
arr- the arr to wrap- Returns:
- the complex ndarray with the specified ndarray as the real components
-
createComplex
public abstract IComplexNDArray createComplex(IComplexNumber[] data, int[] shape)
Create a complex ndarray from the passed in indarray- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to wrap- Returns:
- the complex ndarray with the specified ndarray as the real components
-
createComplex
public abstract IComplexNDArray createComplex(java.util.List<IComplexNDArray> arrs, int[] shape)
Create a complex ndarray from the passed in indarray- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
arrs- the arr to wrap- Returns:
- the complex ndarray with the specified ndarray as the real components
-
rand
public INDArray rand(int rows, int columns, RandomGenerator r)
Create a random ndarray with the given shape using the given rng- Specified by:
randin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrixr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(int rows, int columns, long seed)
Create a random ndarray with the given shape using the given rng- Specified by:
randin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarrayseed- the seed to use- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(int rows, int columns)
Create a random ndarray with the given shape using the current time as the seed- Specified by:
randin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
- the random ndarray with the specified shape
-
randn
public INDArray randn(int rows, int columns, RandomGenerator r)
Random normal using the given rng- Specified by:
randnin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrixr- the random generator to use- Returns:
-
randn
public INDArray randn(int rows, int columns)
Random normal using the current time stamp as the seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
-
randn
public INDArray randn(int rows, int columns, long seed)
Random normal using the specified seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
-
rand
public INDArray rand(int[] shape, RealDistribution r)
Create a random ndarray with the given shape using the given rng- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(int[] shape, RandomGenerator r)
Create a random ndarray with the given shape using the given rng- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(int[] shape, long seed)
Create a random ndarray with the given shape using the given rng- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayseed- the seed to use- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(int[] shape)
Create a random ndarray with the given shape using the current time as the seed- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- the random ndarray with the specified shape
-
randn
public INDArray randn(int[] shape, RandomGenerator r)
Random normal using the given rng- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayr- the random generator to use- Returns:
-
randn
public INDArray randn(int[] shape)
Random normal using the current time stamp as the seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
-
randn
public INDArray randn(int[] shape, long seed)
Random normal using the specified seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
-
create
public INDArray create(double[] data)
Creates a row vector with the data- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the columns of the ndarray- Returns:
- the created ndarray
-
create
public INDArray create(float[] data)
Creates a row vector with the data- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the columns of the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(double[] data)
Creates an ndarray with the specified data- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the number of columns in the row vector- Returns:
- ndarray
-
create
public INDArray create(int columns)
Creates a row vector with the specified number of columns- Specified by:
createin interfaceNDArrayFactory- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(int columns)
Creates an ndarray- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
columns- the number of columns in the row vector- Returns:
- ndarray
-
zeros
public INDArray zeros(int rows, int columns)
Creates a row vector with the specified number of columns- Specified by:
zerosin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarray- Returns:
- the created ndarray
-
complexZeros
public IComplexNDArray complexZeros(int rows, int columns)
Creates a matrix of zeros- Specified by:
complexZerosin interfaceNDArrayFactory- Parameters:
rows- te number of rows in the matrixcolumns- the number of columns in the row vector- Returns:
- ndarray
-
zeros
public INDArray zeros(int columns)
Creates a row vector with the specified number of columns- Specified by:
zerosin interfaceNDArrayFactory- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
complexZeros
public IComplexNDArray complexZeros(int columns)
Creates an ndarray- Specified by:
complexZerosin interfaceNDArrayFactory- Parameters:
columns- the number of columns in the row vector- Returns:
- ndarray
-
complexValueOf
public IComplexNDArray complexValueOf(int[] shape, IComplexNumber value)
Creates an shape ndarray with the specified value- Specified by:
complexValueOfin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayvalue- the value to assign- Returns:
- a complex ndarray of the specified size and value
-
complexValueOf
public IComplexNDArray complexValueOf(int num, double value)
Creates an 1 x num ndarray with the specified value- Specified by:
complexValueOfin interfaceNDArrayFactory- Parameters:
num- the number of columnsvalue- the value to assign- Returns:
- a complex ndarray of the specified size and value
-
complexValueOf
public IComplexNDArray complexValueOf(int[] shape, double value)
Creates an shape ndarray with the specified value- Specified by:
complexValueOfin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayvalue- the value to assign- Returns:
- a complex ndarray of the specified size and value
-
complexValueOf
public IComplexNDArray complexValueOf(int num, IComplexNumber value)
Creates an 1 x num ndarray with the specified value- Specified by:
complexValueOfin interfaceNDArrayFactory- Parameters:
num- the number of columnsvalue- the value to assign- Returns:
- a complex ndarray of the specified size and value
-
valueArrayOf
public INDArray valueArrayOf(int[] shape, double value)
Creates an ndarray with the specified value as the only value in the ndarray- Specified by:
valueArrayOfin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayvalue- the value to assign- Returns:
- the created ndarray
-
valueArrayOf
public INDArray valueArrayOf(int rows, int columns, double value)
Creates a row vector with the specified number of columns- Specified by:
valueArrayOfin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarrayvalue- the value to assign- Returns:
- the created ndarray
-
ones
public INDArray ones(int rows, int columns)
Creates a row vector with the specified number of columns- Specified by:
onesin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarray- Returns:
- the created ndarray
-
complexOnes
public INDArray complexOnes(int rows, int columns)
Creates an ndarray- Specified by:
complexOnesin interfaceNDArrayFactory- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the row vector- Returns:
- ndarray
-
ones
public INDArray ones(int columns)
Creates a row vector with the specified number of columns- Specified by:
onesin interfaceNDArrayFactory- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
complexOnes
public IComplexNDArray complexOnes(int columns)
Creates an ndarray- Specified by:
complexOnesin interfaceNDArrayFactory- Parameters:
columns- the number of columns in the row vector- Returns:
- ndarray
-
concat
public INDArray concat(int dimension, INDArray... toConcat)
concatenate ndarrays along a dimension- Specified by:
concatin interfaceNDArrayFactory- Parameters:
dimension- the dimension to concatenate alongtoConcat- the ndarrays to concatenate- Returns:
- the concatenate ndarrays
-
concat
public IComplexNDArray concat(int dimension, IComplexNDArray... toConcat)
concatenate ndarrays along a dimension- Specified by:
concatin interfaceNDArrayFactory- Parameters:
dimension- the dimension to concatenate alongtoConcat- the ndarrays to concatenate- Returns:
- the concatenate ndarrays
-
complexFlatten
public IComplexNDArray complexFlatten(IComplexNDArray[] flatten)
- Specified by:
complexFlattenin interfaceNDArrayFactory
-
complexFlatten
public IComplexNDArray complexFlatten(java.util.List<IComplexNDArray> flatten)
- Specified by:
complexFlattenin interfaceNDArrayFactory
-
hstack
public INDArray hstack(INDArray... arrs)
Concatenates two matrices horizontally. Matrices must have identical numbers of rows.- Specified by:
hstackin interfaceNDArrayFactory- Parameters:
arrs-
-
vstack
public INDArray vstack(INDArray... arrs)
Concatenates two matrices vertically. Matrices must have identical numbers of columns.- Specified by:
vstackin interfaceNDArrayFactory- Parameters:
arrs-
-
zeros
public INDArray zeros(int[] shape)
Create an ndarray of zeros- Specified by:
zerosin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
complexZeros
public IComplexNDArray complexZeros(int[] shape)
Create an ndarray of ones- Specified by:
complexZerosin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
ones
public INDArray ones(int[] shape)
Create an ndarray of ones- Specified by:
onesin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
complexOnes
public IComplexNDArray complexOnes(int[] shape)
Create an ndarray of ones- Specified by:
complexOnesin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
createComplex
public IComplexNDArray createComplex(float[] data, int rows, int columns, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with the ndarrayrows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public INDArray create(float[] data, int rows, int columns, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the data to use with the ndarrayrows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
createComplex
public abstract IComplexNDArray createComplex(float[] data, int[] shape, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with the ndarrayshape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public abstract INDArray create(float[] data, int[] shape, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public INDArray create(double[] data, int[] shape)
Create an ndrray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
create
public INDArray create(float[] data, int[] shape)
Create an ndrray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(double[] data, int[] shape)
Create an ndrray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(float[] data, int[] shape)
Create an ndrray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(double[] data, int[] shape, int[] stride)
Create an ndrray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarraystride- the stride for the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(float[] data, int[] shape, int[] stride)
Create an ndrray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarraystride- the stride for the ndarray- Returns:
- the created ndarray
-
createComplex
public IComplexNDArray createComplex(double[] data, int rows, int columns, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public INDArray create(double[] data, int rows, int columns, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayrows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
createComplex
public abstract IComplexNDArray createComplex(double[] data, int[] shape, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public abstract INDArray create(double[] data, int[] shape, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public abstract INDArray create(java.util.List<INDArray> list, int[] shape)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int rows, int columns, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public INDArray create(int rows, int columns, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int[] shape, int[] stride, int offset)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
public INDArray create(int[] shape, int[] stride, int offset)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int rows, int columns, int[] stride)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
create
public INDArray create(int rows, int columns, int[] stride)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int[] shape, int[] stride)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
create
public INDArray create(int[] shape, int[] stride)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int rows, int columns)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarray- Returns:
- the instance
-
create
public INDArray create(int rows, int columns)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarray- Returns:
- the instance
-
createComplex
public IComplexNDArray createComplex(int[] shape)
Creates a complex ndarray with the specified shape- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- the instance
-
create
public INDArray create(int[] shape)
Creates an ndarray with the specified shape- Specified by:
createin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- the instance
-
scalar
public INDArray scalar(java.lang.Number value, int offset)
Create a scalar ndarray with the specified offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar withoffset- the offset of the ndarray- Returns:
- the created ndarray
-
complexScalar
public IComplexNDArray complexScalar(java.lang.Number value, int offset)
Create a scalar ndarray with the specified offset- Specified by:
complexScalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar withoffset- the offset of the ndarray- Returns:
- the created ndarray
-
complexScalar
public IComplexNDArray complexScalar(java.lang.Number value)
Create a scalar ndarray with the specified offset- Specified by:
complexScalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar with- Returns:
- the created ndarray
-
scalar
public INDArray scalar(float value, int offset)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
scalar
public INDArray scalar(double value, int offset)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
scalar
public INDArray scalar(java.lang.Number value)
Create a scalar ndarray with the specified offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar with- Returns:
- the created ndarray
-
scalar
public INDArray scalar(float value)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalar = * @return the scalar nd array
-
scalar
public INDArray scalar(double value)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalar- Returns:
- the scalar nd array
-
scalar
public IComplexNDArray scalar(IComplexNumber value, int offset)
Create a scalar ndarray with the specified offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar withoffset- the offset of the ndarray- Returns:
- the created ndarray
-
scalar
public IComplexNDArray scalar(IComplexFloat value)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalar- Returns:
- the scalar nd array
-
scalar
public IComplexNDArray scalar(IComplexDouble value)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalar- Returns:
- the scalar nd array
-
scalar
public IComplexNDArray scalar(IComplexNumber value)
Create a scalar ndarray with the specified offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value to initialize the scalar with- Returns:
- the created ndarray
-
scalar
public IComplexNDArray scalar(IComplexFloat value, int offset)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
scalar
public IComplexNDArray scalar(IComplexDouble value, int offset)
Create a scalar nd array with the specified value and offset- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
createComplex
public abstract IComplexNDArray createComplex(double[] data, int[] shape, int[] stride, int offset, char ordering)
Create a complex ndarray with the given data- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarrayordering- the ordering for the ndarray- Returns:
- the created complex ndarray
-
createComplex
public IComplexNDArray createComplex(double[] data, int[] shape, int offset, char ordering)
- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data-shape-offset-ordering-- Returns:
-
createComplex
public IComplexNDArray createComplex(double[] data, int[] shape, int offset)
- Specified by:
createComplexin interfaceNDArrayFactory- Parameters:
data-shape-offset-- Returns:
-
create
public INDArray create(float[] data, int[] shape, int offset)
- Specified by:
createin interfaceNDArrayFactory
-
-
DMelt 3.0 © DataMelt by jWork.ORG