src/ndarray

Nim bindings for ndarray-c library

A numpy-like ndarray library for C with multi-dimensional arrays, OpenMP parallelization, and BLAS-optimized operations.

Features automatic memory management using Nim's destructors and move semantics.

Examples

Basic usage:

import ndarray

# Create a 2x3 array of ones (simple int syntax)
let arr = newOnes(@[2, 3])

# Set value at position (1, 2)
arr.set(@[1, 2], 42.0)

# Get value at position
let val = arr.get(@[1, 2])

# Print the array
arr.print("My Array", 2)

Procs

proc get(arr: NDArray; pos: openArray[int]): float {....raises: [ValueError],
    tags: [], forbids: [].}

Gets the value at the specified position (int version).

Convenience overload that accepts int arrays instead of csize_t.

See also:

proc mapFn(arr: var NDArray; fn: proc (x: cdouble): cdouble {.cdecl.}): var NDArray {.
    discardable, ...raises: [], tags: [], forbids: [].}
proc mapFnPar(arr: var NDArray;
              fn: proc (a: cdouble; b: cdouble): cdouble {.cdecl.}; value: float): var NDArray {.
    discardable, ...raises: [], tags: [], forbids: [].}
proc mapMul(arr: var NDArray; fn: proc (x: cdouble): cdouble {.cdecl.};
            other: NDArray; alpha: cdouble): var NDArray {.discardable,
    ...raises: [], tags: [], forbids: [].}
proc mulAdd(arr: var NDArray; other: NDArray; dest: NDArray; alpha: cdouble;
            beta: cdouble): var NDArray {.discardable, ...raises: [], tags: [],
    forbids: [].}
proc set(arr: NDArray; pos: openArray[int]; value: float) {.
    ...raises: [ValueError], tags: [], forbids: [].}

Sets the value at the specified position (int version).

Convenience overload that accepts int arrays instead of csize_t.

See also: