Skip to content

Commit eaf3deb

Browse files
committed
Document C APIs
1 parent 0cc8f43 commit eaf3deb

File tree

1 file changed

+211
-1
lines changed
  • lib/node_modules/@stdlib/ndarray/ctor

1 file changed

+211
-1
lines changed

lib/node_modules/@stdlib/ndarray/ctor/README.md

Lines changed: 211 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ The function accepts the following arguments:
22992299

23002300
- **arr**: `[in] struct ndarray*` input ndarray.
23012301
- **idx**: `[in] int64_t` linear view index.
2302-
- **v**: `[in] void *` value to set.
2302+
- **v**: `[in] void*` value to set.
23032303

23042304
Notes:
23052305

@@ -2495,6 +2495,216 @@ Notes:
24952495

24962496
- The function returns `-1` if unable to set an element and `0` otherwise.
24972497

2498+
* * *
2499+
2500+
#### stdlib_ndarray_set( \*arr, \*sub, \*v )
2501+
2502+
Sets an ndarray data element.
2503+
2504+
```c
2505+
int8_t stdlib_ndarray_set( const struct ndarray *arr, const int64_t *sub, const void *v );
2506+
```
2507+
2508+
The function accepts the following arguments:
2509+
2510+
- **arr**: `[in] struct ndarray*` input ndarray.
2511+
- **sub**: `[in] int64_t*` ndarray subscripts.
2512+
- **v**: `[in] void*` value to set.
2513+
2514+
Notes
2515+
2516+
- The function returns `-1` if unable to set an element and `0` otherwise.
2517+
- The function requires a pointer to a data value `v` in order to provide a generic API supporting ndarrays having different data types.
2518+
- The function has no way of determining whether `v` actually points to a memory address compatible with the underlying input ndarray data type. Accordingly, accessing **unowned** memory is possible, and this function **assumes** you know what you are doing.
2519+
2520+
#### stdlib_ndarray_set_float64( \*arr, \*sub, v )
2521+
2522+
Sets a double-precision floating-point ndarray data element.
2523+
2524+
```c
2525+
int8_t stdlib_ndarray_set_float64( const struct ndarray *arr, const int64_t *sub, const double v );
2526+
```
2527+
2528+
The function accepts the following arguments:
2529+
2530+
- **arr**: `[in] struct ndarray*` input ndarray.
2531+
- **sub**: `[in] int64_t*` ndarray subscripts.
2532+
- **v**: `[in] double` value to set.
2533+
2534+
Notes
2535+
2536+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2537+
- The function returns `-1` if unable to set an element and `0` otherwise.
2538+
2539+
#### stdlib_ndarray_set_float32( \*arr, \*sub, v )
2540+
2541+
Sets a single-precision floating-point ndarray data element.
2542+
2543+
```c
2544+
int8_t stdlib_ndarray_set_float32( const struct ndarray *arr, const int64_t *sub, const float v );
2545+
```
2546+
2547+
The function accepts the following arguments:
2548+
2549+
- **arr**: `[in] struct ndarray*` input ndarray.
2550+
- **sub**: `[in] int64_t*` ndarray subscripts.
2551+
- **v**: `[in] float` value to set.
2552+
2553+
Notes
2554+
2555+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2556+
- The function returns `-1` if unable to set an element and `0` otherwise.
2557+
2558+
#### stdlib_ndarray_set_uint64( \*arr, \*sub, v )
2559+
2560+
Sets an unsigned 64-bit integer ndarray data element.
2561+
2562+
```c
2563+
int8_t stdlib_ndarray_set_uint64( const struct ndarray *arr, const int64_t *sub, const uint64_t v );
2564+
```
2565+
2566+
The function accepts the following arguments:
2567+
2568+
- **arr**: `[in] struct ndarray*` input ndarray.
2569+
- **sub**: `[in] int64_t*` ndarray subscripts.
2570+
- **v**: `[in] uint64_t` value to set.
2571+
2572+
Notes
2573+
2574+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2575+
- The function returns `-1` if unable to set an element and `0` otherwise.
2576+
2577+
#### stdlib_ndarray_set_int64( \*arr, \*sub, v )
2578+
2579+
Sets a signed 64-bit integer ndarray data element.
2580+
2581+
```c
2582+
int8_t stdlib_ndarray_set_int64( const struct ndarray *arr, const int64_t *sub, const int64_t v );
2583+
```
2584+
2585+
The function accepts the following arguments:
2586+
2587+
- **arr**: `[in] struct ndarray*` input ndarray.
2588+
- **sub**: `[in] int64_t*` ndarray subscripts.
2589+
- **v**: `[in] int64_t` value to set.
2590+
2591+
Notes
2592+
2593+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2594+
- The function returns `-1` if unable to set an element and `0` otherwise.
2595+
2596+
#### stdlib_ndarray_set_uint32( \*arr, \*sub, v )
2597+
2598+
Sets an unsigned 32-bit integer ndarray data element.
2599+
2600+
```c
2601+
int8_t stdlib_ndarray_set_uint32( const struct ndarray *arr, const int64_t *sub, const uint32_t v );
2602+
```
2603+
2604+
The function accepts the following arguments:
2605+
2606+
- **arr**: `[in] struct ndarray*` input ndarray.
2607+
- **sub**: `[in] int64_t*` ndarray subscripts.
2608+
- **v**: `[in] uint32_t` value to set.
2609+
2610+
Notes
2611+
2612+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2613+
- The function returns `-1` if unable to set an element and `0` otherwise.
2614+
2615+
#### stdlib_ndarray_set_int32( \*arr, \*sub, v )
2616+
2617+
Sets a signed 32-bit integer ndarray data element.
2618+
2619+
```c
2620+
int8_t stdlib_ndarray_set_int32( const struct ndarray *arr, const int64_t *sub, const int32_t v );
2621+
```
2622+
2623+
The function accepts the following arguments:
2624+
2625+
- **arr**: `[in] struct ndarray*` input ndarray.
2626+
- **sub**: `[in] int64_t*` ndarray subscripts.
2627+
- **v**: `[in] int32_t` value to set.
2628+
2629+
Notes
2630+
2631+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2632+
- The function returns `-1` if unable to set an element and `0` otherwise.
2633+
2634+
#### stdlib_ndarray_set_uint16( \*arr, \*sub, v )
2635+
2636+
Sets an unsigned 16-bit integer ndarray data element.
2637+
2638+
```c
2639+
int8_t stdlib_ndarray_set_uint16( const struct ndarray *arr, const int64_t *sub, const uint16_t v );
2640+
```
2641+
2642+
The function accepts the following arguments:
2643+
2644+
- **arr**: `[in] struct ndarray*` input ndarray.
2645+
- **sub**: `[in] int64_t*` ndarray subscripts.
2646+
- **v**: `[in] uint16_t` value to set.
2647+
2648+
Notes
2649+
2650+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2651+
- The function returns `-1` if unable to set an element and `0` otherwise.
2652+
2653+
#### stdlib_ndarray_set_int16( \*arr, \*sub, v )
2654+
2655+
Sets a signed 16-bit integer ndarray data element.
2656+
2657+
```c
2658+
int8_t stdlib_ndarray_set_int16( const struct ndarray *arr, const int64_t *sub, const int16_t v );
2659+
```
2660+
2661+
The function accepts the following arguments:
2662+
2663+
- **arr**: `[in] struct ndarray*` input ndarray.
2664+
- **sub**: `[in] int64_t*` ndarray subscripts.
2665+
- **v**: `[in] int16_t` value to set.
2666+
2667+
Notes
2668+
2669+
- The function does **not** verify that the type of `v` matches the underlying input ndarray data type, and, thus, overwriting **unowned** memory is possible. The function **assumes** that you know what you are doing.
2670+
- The function returns `-1` if unable to set an element and `0` otherwise.
2671+
2672+
#### stdlib_ndarray_set_uint8( \*arr, \*sub, v )
2673+
2674+
Sets an unsigned 8-bit integer ndarray data element.
2675+
2676+
```c
2677+
int8_t stdlib_ndarray_set_uint8( const struct ndarray *arr, const int64_t *sub, const uint8_t v );
2678+
```
2679+
2680+
The function accepts the following arguments:
2681+
2682+
- **arr**: `[in] struct ndarray*` input ndarray.
2683+
- **sub**: `[in] int64_t*` ndarray subscripts.
2684+
- **v**: `[in] uint8_t` value to set.
2685+
2686+
Notes
2687+
2688+
- The function returns `-1` if unable to set an element and `0` otherwise.
2689+
2690+
#### stdlib_ndarray_set_int8( \*arr, \*sub, v )
2691+
2692+
Sets a signed 8-bit integer ndarray data element.
2693+
2694+
```c
2695+
int8_t stdlib_ndarray_set_int8( const struct ndarray *arr, const int64_t *sub, const int8_t v );
2696+
```
2697+
2698+
The function accepts the following arguments:
2699+
2700+
- **arr**: `[in] struct ndarray*` input ndarray.
2701+
- **sub**: `[in] int64_t*` ndarray subscripts.
2702+
- **v**: `[in] int8_t` value to set.
2703+
2704+
Notes
2705+
2706+
- The function returns `-1` if unable to set an element and `0` otherwise.
2707+
24982708
</section>
24992709
25002710
<!-- /.usage -->

0 commit comments

Comments
 (0)