Class CUDATensor<T>
java.lang.Object
org.episteme.nativ.mathematics.linearalgebra.tensors.CUDATensor<T>
- Type Parameters:
T- the element type (currently supports Float, Double)
- All Implemented Interfaces:
Serializable, Tensor<T>
CUDA implementation of Tensor backed by device (GPU) memory.
Supports Float and Double element types. Operations use cuBLAS where possible, with GPU↔CPU roundtrip fallbacks for operations that require custom CUDA kernels not yet available.
- Since:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionElement-wise addition.broadcast(int... newShape) Broadcasts this tensor to a new shape.copy()Returns a copy of this tensor.get(int... indices) Gets the element at the specified indices.jcuda.PointerApplies a function to each element of the tensor.Element-wise multiplication (Hadamard product).intrank()Returns the rank (number of dimensions) of this tensor.reshape(int... newShape) Reshapes this tensor to a new shape.Scalar multiplication.voidSets the element at the specified indices.int[]shape()Returns the shape of this tensor.intsize()Returns the total number of elements.slice(int[] starts, int[] sizes) Returns a slice (sub-tensor) of this tensor.Element-wise subtraction.sum()Sums all elements.sum(int axis) Sums along the specified axis.toArray()Converts this tensor to a multidimensional array.transpose(int... permutation) Transposes dimensions according to the given permutation.
-
Constructor Details
-
CUDATensor
-
-
Method Details
-
getDevicePointer
public jcuda.Pointer getDevicePointer() -
getElementType
-
shape
-
rank
-
size
-
get
-
set
-
add
-
subtract
-
multiply
-
scale
-
reshape
-
broadcast
Description copied from interface:TensorBroadcasts this tensor to a new shape.Follows standard broadcasting rules (dimensions of size 1 can be expanded).
-
transpose
Description copied from interface:TensorTransposes dimensions according to the given permutation.For a matrix (rank 2), transpose() swaps rows and columns. For higher-rank tensors, specify the permutation explicitly.
-
slice
Description copied from interface:TensorReturns a slice (sub-tensor) of this tensor. -
map
-
sum
-
sum
-
copy
-
toArray
-