Types
AggrType = enum aggrSum = 0, aggrMean = 1, aggrStd = 2, aggrMax = 3, aggrMin = 4
- Aggregation types
NDArray = object handle*: NdarrayPtr
- A handle to a ndarray structure with automatic memory management
NdarrayPtr = ptr NdarrayInternal
Consts
ALL_AXES = -1
- Constant to indicate operations on all axes
MAX_ARRAYS = 64
MAX_DIMS = 16
Procs
proc c_free(t: NdarrayPtr) {.importc: "ndarray_free", header: "ndarray.h", ...raises: [], tags: [], forbids: [].}
proc c_new_copy(t: NdarrayPtr): NdarrayPtr {.importc: "ndarray_new_copy", header: "ndarray.h", ...raises: [], tags: [], forbids: [].}
proc copy(arr: NDArray): NDArray {....raises: [ValueError], tags: [], forbids: [].}
-
Creates a deep copy of the array.
Allocates a new array with the same dimensions and copies all data.
Returns: New NDArray with copied data
Raises: ValueError if copy fails
Example:
let arr = newOnes(@[3, 4]) let arrCopy = arr.copy() # Independent copy arrCopy.set(@[0, 0], 5.0) # Doesn't affect arr
proc wrapHandle(handle: NdarrayPtr): NDArray {....raises: [], tags: [], forbids: [].}