Package org.nd4j.linalg.factory
Class BaseNDArrayFactory
- java.lang.Object
-
- org.nd4j.linalg.factory.BaseNDArrayFactory
-
- All Implemented Interfaces:
NDArrayFactory
public abstract class BaseNDArrayFactory extends Object implements NDArrayFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description BaseNDArrayFactory()protectedBaseNDArrayFactory(DataType dtype, char order)protectedBaseNDArrayFactory(DataType dtype, Character order)Initialize with the given data opType and ordering The ndarray factory will use this for
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description INDArrayappendBias(INDArray... vectors)Merge the vectors and append a bias.INDArrayarange(double begin, double end, double step)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.Blasblas()Return extra blas operationsINDArrayconcat(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, char order)INDArraycreate(double[] data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(double[] data, int[] shape, int[] stride, char order, long offset)abstract INDArraycreate(double[] data, int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(double[] data, long[] shape)INDArraycreate(double[] data, long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data)Creates a row vector with the dataINDArraycreate(float[] data, char order)INDArraycreate(float[] data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(float[] data, int[] shape, char ordering)INDArraycreate(float[] data, int[] shape, int[] stride, char order, long offset)abstract INDArraycreate(float[] data, int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data, int[] shape, long offset)INDArraycreate(float[] data, long[] shape)abstract INDArraycreate(float[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(float[] data, long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(int[] shape)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(int[] data, int[] shape, int[] stride, char order, long offset)INDArraycreate(int[] ints, int[] ints1, int[] stride, long offset)INDArraycreate(int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] stride, long offset, char ordering)INDArraycreate(int[] shape, DataType dataType, MemoryWorkspace workspace)INDArraycreate(long columns)Creates a row vector with the specified number of columnsINDArraycreate(long[] shape)Creates an ndarray with the specified shapeINDArraycreate(long[] shape, long[] stride)INDArraycreate(long[] shape, long[] stride, long offset)INDArraycreate(long[] shape, long[] stride, long offset, char ordering)INDArraycreate(long rows, long columns)Creates an ndarray with the specified shapeINDArraycreate(long rows, long columns, char ordering)INDArraycreate(long rows, long columns, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeabstract INDArraycreate(List<INDArray> list, int[] shape)Creates an ndarray with the specified shapeINDArraycreate(DataBuffer buffer, int[] shape, int[] stride, char order, long offset)DataTypedtype()Returns the data opType for this ndarrayINDArrayeye(long n)Create the identity ndarrayINDArrayhstack(@NonNull INDArray... arrs)Concatenates two matrices horizontally.Lapacklapack()Level1level1()Return the level 1 blas operationsLevel2level2()Return the level 2 blas operationsLevel3level3()Return the level 3 blas operationsINDArrayones(int[] shape)Create an ndarray of onesINDArrayones(long columns)Creates a row vector with the specified number of columnsINDArrayones(long[] shape)INDArrayones(long rows, long columns)Creates a row vector with the specified number of columnscharorder()Returns the order for this ndarray for internal data storageINDArraypullRows(INDArray source, int sourceDimension, int[] indexes)This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexesINDArraypullRows(INDArray source, int sourceDimension, int[] indexes, char order)This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexesINDArrayrand(char order, int[] shape)Create a random ndarray with the given shape and orderINDArrayrand(char order, long[] shape)Create a random ndarray with the given shape and specified output orderINDArrayrand(char order, long rows, long columns)Create a random (uniform 0-1) NDArray with the specified shape and orderINDArrayrand(int[] shape)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(int[] shape, double min, double max, Random rng)INDArrayrand(int[] shape, float min, float max, Random 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, Distribution r)Create a random ndarray with the given shape using the given rngINDArrayrand(int[] shape, Random r)Create a random ndarray with the given shape using the given rngINDArrayrand(long[] shape)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(long[] shape, double min, double max, Random rng)INDArrayrand(long[] shape, float min, float max, Random rng)INDArrayrand(long[] shape, long seed)INDArrayrand(long[] shape, Random r)INDArrayrand(long rows, long columns)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(long rows, long columns, double min, double max, Random rng)INDArrayrand(long rows, long columns, float min, float max, Random rng)Generates a random matrix between min and maxINDArrayrand(long rows, long columns, long seed)Create a random ndarray with the given shape using the given rngINDArrayrand(long rows, long columns, Random r)Create a random ndarray with the given shape using the given rngINDArrayrandn(char order, int[] shape)Random normal using the current time stamp as the seedINDArrayrandn(char order, long[] shape)Random normal N(0,1) with the specified shape and orderINDArrayrandn(char order, long rows, long columns)Generate a random normal N(0,1) with the specified order and shapeINDArrayrandn(int[] shape)Random normal N(0,1) with the specified shape andINDArrayrandn(int[] shape, long seed)Random normal using the specified seedINDArrayrandn(int[] shape, Random r)Random normal using the given rngINDArrayrandn(long[] shape)Random normal N(0,1) using the current time stamp as the seedINDArrayrandn(long[] shape, long seed)Random normal using the specified seedINDArrayrandn(long[] shape, Random r)INDArrayrandn(long rows, long columns)Random normal using the current time stamp as the seedINDArrayrandn(long rows, long columns, long seed)Random normal using the specified seedINDArrayrandn(long rows, long columns, Random 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, long 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, long offset)Create a scalar nd array with the specified value and offsetINDArrayscalar(int value, long offset)Create a scalar nd array with the specified value and offsetINDArrayscalar(Number value)Create a scalar ndarray with the specified offsetINDArrayscalar(DataType dataType)Create a scalar nd array with the data type and a default value depending on the data type.voidsetDType(DataType dtype)Sets the data opTypevoidsetOrder(char order)Sets the order.INDArraytoFlattened(char order, INDArray... matrices)Flatten all of the ndarrays in to one long vectorINDArraytoFlattened(int length, Iterator<? extends INDArray>... matrices)Returns a flattened ndarray with all of the elements in each ndarray regardless of dimensionINDArraytoFlattened(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)Flatten all of the ndarrays in to one long vectorINDArrayvalueArrayOf(int[] shape, double value)Creates an ndarray with the specified value as the only value in the ndarrayINDArrayvalueArrayOf(long[] shape, double value)INDArrayvalueArrayOf(long rows, long columns, double value)Creates a row vector with the specified number of columnsINDArrayvstack(INDArray... arrs)Concatenates two matrices vertically.INDArrayzeros(int[] shape)Create an ndarray of zerosINDArrayzeros(long columns)Creates a row vector with the specified number of columnsINDArrayzeros(long[] shape)INDArrayzeros(long rows, long columns)Creates a row vector with the specified number of columns-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.factory.NDArrayFactory
accumulate, average, average, average, average, convertDataEx, convertDataEx, convertDataEx, convertDataEx, convertDataEx, convertToNumpy, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, createBlas, createFromNpyFile, createFromNpyHeaderPointer, createFromNpyPointer, createFromNpzFile, createLapack, createLevel1, createLevel2, createLevel3, createUninitialized, createUninitialized, createUninitialized, createUninitializedDetached, empty, pullRows, pullRows, shuffle, shuffle, shuffle, sort, sort, sortCooIndices, specialConcat, tear, toFlattened
-
-
-
-
Constructor Detail
-
BaseNDArrayFactory
public BaseNDArrayFactory()
-
BaseNDArrayFactory
protected BaseNDArrayFactory(DataType dtype, Character order)
Initialize with the given data opType and ordering The ndarray factory will use this for- Parameters:
dtype- the data opTypeorder- the ordering in mem
-
BaseNDArrayFactory
protected BaseNDArrayFactory(DataType dtype, char order)
- Parameters:
dtype- the data opTypeorder- the ordering
-
-
Method Detail
-
lapack
public Lapack lapack()
- Specified by:
lapackin interfaceNDArrayFactory
-
blas
public Blas blas()
Description copied from interface:NDArrayFactoryReturn extra blas operations- Specified by:
blasin interfaceNDArrayFactory- Returns:
-
level1
public Level1 level1()
Description copied from interface:NDArrayFactoryReturn the level 1 blas operations- Specified by:
level1in interfaceNDArrayFactory- Returns:
-
level2
public Level2 level2()
Description copied from interface:NDArrayFactoryReturn the level 2 blas operations- Specified by:
level2in interfaceNDArrayFactory- Returns:
-
level3
public Level3 level3()
Description copied from interface:NDArrayFactoryReturn the level 3 blas operations- Specified by:
level3in interfaceNDArrayFactory- Returns:
-
setOrder
public void setOrder(char order)
Sets the order. Primarily for testing purposes- Specified by:
setOrderin interfaceNDArrayFactory- Parameters:
order-
-
rand
public INDArray rand(long[] shape, double min, double max, Random rng)
- Specified by:
randin interfaceNDArrayFactory
-
rand
public INDArray rand(int[] shape, double min, double max, Random rng)
- Specified by:
randin interfaceNDArrayFactory- Returns:
-
rand
public INDArray rand(long rows, long columns, double min, double max, Random rng)
- Specified by:
randin interfaceNDArrayFactory- Returns:
-
setDType
public void setDType(DataType dtype)
Sets the data opType- Specified by:
setDTypein interfaceNDArrayFactory- Parameters:
dtype-
-
create
public INDArray create(int[] shape, DataType dataType, MemoryWorkspace workspace)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
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 DataType dtype()
Returns the data opType for this ndarray- Specified by:
dtypein interfaceNDArrayFactory- Returns:
- the data opType for this ndarray
-
create
public INDArray create(int[] ints, int[] ints1, int[] stride, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(long rows, long columns, char ordering)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
toFlattened
public INDArray toFlattened(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, 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)
Description copied from interface:NDArrayFactoryFlatten all of the ndarrays in to one long vector- Specified by:
toFlattenedin interfaceNDArrayFactory- Parameters:
matrices- the matrices to flatten- Returns:
- the flattened vector
-
toFlattened
public INDArray toFlattened(char order, INDArray... matrices)
Description copied from interface:NDArrayFactoryFlatten all of the ndarrays in to one long vector- Specified by:
toFlattenedin interfaceNDArrayFactorymatrices- the matrices to flatten- Returns:
- the flattened vector
-
eye
public INDArray eye(long 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, double step)
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
-
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, Random 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(long[] shape, float min, float max, Random rng)
- Specified by:
randin interfaceNDArrayFactory
-
rand
public INDArray rand(long rows, long columns, float min, float max, Random 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
-
rand
public INDArray rand(long rows, long columns, Random 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(long rows, long 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(long rows, long 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
-
rand
public INDArray rand(char order, long rows, long columns)
Create a random (uniform 0-1) NDArray with the specified shape and order- Specified by:
randin interfaceNDArrayFactory- Parameters:
order- Order ('c' or 'f') of the output arrayrows- Number of rows of the output arraycolumns- Number of columns of the output array
-
randn
public INDArray randn(long rows, long columns, Random 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(long rows, long 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(char order, long rows, long columns)
Generate a random normal N(0,1) with the specified order and shape- Specified by:
randnin interfaceNDArrayFactory- Parameters:
order- Order of the output arrayrows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
-
randn
public INDArray randn(long rows, long 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, Distribution 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, Random 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(long[] shape, Random r)
- Specified by:
randin interfaceNDArrayFactory
-
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(long[] shape, long seed)
- Specified by:
randin interfaceNDArrayFactory
-
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
-
rand
public INDArray rand(long[] shape)
Description copied from interface:NDArrayFactoryCreate 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
-
rand
public INDArray rand(char order, int[] shape)
Create a random ndarray with the given shape and order- Specified by:
randin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
- the random ndarray with the specified shape
-
rand
public INDArray rand(char order, long[] shape)
Description copied from interface:NDArrayFactoryCreate a random ndarray with the given shape and specified output order- Specified by:
randin interfaceNDArrayFactory- Parameters:
order- the order of the arrayshape- the shape of the array- Returns:
- the created ndarray
-
randn
public INDArray randn(int[] shape, Random 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(long[] shape, Random r)
- Specified by:
randnin interfaceNDArrayFactory
-
randn
public INDArray randn(char order, int[] shape)
Random normal using the current time stamp as the seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarrayorder- the order ('c' or 'f') of the output array- Returns:
-
randn
public INDArray randn(char order, long[] shape)
Description copied from interface:NDArrayFactoryRandom normal N(0,1) with the specified shape and order- Specified by:
randnin interfaceNDArrayFactory- Parameters:
order- the order ('c' or 'f') of the output arrayshape- the shape of the ndarray
-
randn
public INDArray randn(int[] shape)
Random normal N(0,1) with the specified shape and- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray- Returns:
-
randn
public INDArray randn(long[] shape)
Description copied from interface:NDArrayFactoryRandom normal N(0,1) using the current time stamp as the seed- Specified by:
randnin interfaceNDArrayFactory- Parameters:
shape- the shape of the ndarray
-
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:
-
randn
public INDArray randn(long[] shape, long seed)
Description copied from interface:NDArrayFactoryRandom 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
-
create
public INDArray create(long 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
-
zeros
public INDArray zeros(long rows, long 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
-
pullRows
public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order)
This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes- Specified by:
pullRowsin interfaceNDArrayFactory- Parameters:
source- source tensorsourceDimension- dimension of source tensorindexes- indexes from source arrayorder- order for result array- Returns:
-
pullRows
public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes)
This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes- Specified by:
pullRowsin interfaceNDArrayFactory- Parameters:
source- source tensorsourceDimension- dimension of source tensorindexes- indexes from source array- Returns:
-
zeros
public INDArray zeros(long 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
-
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(long[] shape, double value)
- Specified by:
valueArrayOfin interfaceNDArrayFactory
-
create
public INDArray create(int[] shape, int[] stride, long offset, char ordering)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
valueArrayOf
public INDArray valueArrayOf(long rows, long 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(long rows, long 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
-
ones
public INDArray ones(long 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
-
create
public INDArray create(float[] data, int[] shape, char ordering)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
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
-
hstack
public INDArray hstack(@NonNull @NonNull 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
-
zeros
public INDArray zeros(long[] shape)
- Specified by:
zerosin interfaceNDArrayFactory
-
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
-
ones
public INDArray ones(long[] shape)
- Specified by:
onesin interfaceNDArrayFactory
-
create
public INDArray create(float[] data, long rows, long columns, int[] stride, long 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
-
create
public abstract INDArray create(float[] data, int[] shape, int[] stride, long 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
-
create
public INDArray create(float[] data, long[] shape)
- Specified by:
createin interfaceNDArrayFactory
-
create
public INDArray create(double[] data, long[] shape)
- Specified by:
createin interfaceNDArrayFactory
-
create
public INDArray create(double[] data, long rows, long columns, int[] stride, long 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
-
create
public abstract INDArray create(double[] data, int[] shape, int[] stride, long 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(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
-
create
public INDArray create(long rows, long columns, int[] stride, long 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
-
create
public INDArray create(int[] shape, int[] stride, long 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(long[] shape, long[] stride, long offset)
- Specified by:
createin interfaceNDArrayFactory
-
scalar
public INDArray scalar(DataType dataType)
Description copied from interface:NDArrayFactoryCreate a scalar nd array with the data type and a default value depending on the data type. Generally this will be an empty string for UTF8 or 0.0 for numerical values, or true for booleans.- Specified by:
scalarin interfaceNDArrayFactory- Parameters:
dataType- the dataType of the scalar * @return the scalar nd array
-
create
public INDArray create(long rows, long 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
-
create
public INDArray create(long[] shape, long[] stride)
- Specified by:
createin interfaceNDArrayFactory
-
create
public INDArray create(long[] shape, long[] stride, long offset, char ordering)
- Specified by:
createin interfaceNDArrayFactory
-
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
-
create
public INDArray create(long rows, long 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
-
create
public INDArray create(long[] shape)
Creates an ndarray with the specified shape- Specified by:
createin 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(float value, long 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, long 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(int value, long 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(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(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 INDArray scalar(float value)
Description copied from interface:NDArrayFactoryCreate 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
-
create
public INDArray create(float[] data, int[] shape, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public abstract INDArray create(float[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
- Specified by:
createin interfaceNDArrayFactory
-
create
public INDArray create(float[] data, char order)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(float[] data, int[] shape, int[] stride, char order, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(double[] data, char order)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(double[] data, int[] shape, int[] stride, char order, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(DataBuffer buffer, int[] shape, int[] stride, char order, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
create
public INDArray create(int[] data, int[] shape, int[] stride, char order, long offset)
- Specified by:
createin interfaceNDArrayFactory- Returns:
-
-