Skip to content

Commit 0cc8f43

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

File tree

1 file changed

+210
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/ctor

1 file changed

+210
-0
lines changed

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

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,216 @@ The function accepts the following arguments:
22852285
- **arr**: `[in] struct ndarray*` input ndarray.
22862286
- **idx**: `[in] int64_t` linear view index.
22872287
2288+
* * *
2289+
2290+
#### stdlib_ndarray_iset( \*arr, idx, \*v )
2291+
2292+
Sets an ndarray data element located at a specified linear index.
2293+
2294+
```c
2295+
int8_t stdlib_ndarray_iset( const struct ndarray *arr, const int64_t idx, const void *v );
2296+
```
2297+
2298+
The function accepts the following arguments:
2299+
2300+
- **arr**: `[in] struct ndarray*` input ndarray.
2301+
- **idx**: `[in] int64_t` linear view index.
2302+
- **v**: `[in] void *` value to set.
2303+
2304+
Notes:
2305+
2306+
- The function returns `-1` if unable to set an element and `0` otherwise.
2307+
- The function requires a pointer to a data value `v` in order to provide a generic API supporting ndarrays having different data types.
2308+
- 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.
2309+
2310+
#### stdlib_ndarray_iset_float64( \*arr, idx, v )
2311+
2312+
Sets a double-precision floating-point ndarray data element located at a specified linear index.
2313+
2314+
```c
2315+
int8_t stdlib_ndarray_iset_float64( const struct ndarray *arr, const int64_t idx, const double v );
2316+
```
2317+
2318+
The function accepts the following arguments:
2319+
2320+
- **arr**: `[in] struct ndarray*` input ndarray.
2321+
- **idx**: `[in] int64_t` linear view index.
2322+
- **v**: `[in] double` value to set.
2323+
2324+
Notes:
2325+
2326+
- 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.
2327+
- The function returns `-1` if unable to set an element and `0` otherwise.
2328+
2329+
#### stdlib_ndarray_iset_float32( \*arr, idx, v )
2330+
2331+
Sets a single-precision floating-point ndarray data element located at a specified linear index.
2332+
2333+
```c
2334+
int8_t stdlib_ndarray_iset_float32( const struct ndarray *arr, const int64_t idx, const float v );
2335+
```
2336+
2337+
The function accepts the following arguments:
2338+
2339+
- **arr**: `[in] struct ndarray*` input ndarray.
2340+
- **idx**: `[in] int64_t` linear view index.
2341+
- **v**: `[in] float` value to set.
2342+
2343+
Notes:
2344+
2345+
- 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.
2346+
- The function returns `-1` if unable to set an element and `0` otherwise.
2347+
2348+
#### stdlib_ndarray_iset_uint64( \*arr, idx, v )
2349+
2350+
Sets an unsigned 64-bit integer ndarray data element located at a specified linear index.
2351+
2352+
```c
2353+
int8_t stdlib_ndarray_iset_uint64( const struct ndarray *arr, const int64_t idx, const uint64_t v );
2354+
```
2355+
2356+
The function accepts the following arguments:
2357+
2358+
- **arr**: `[in] struct ndarray*` input ndarray.
2359+
- **idx**: `[in] int64_t` linear view index.
2360+
- **v**: `[in] uint64_t` value to set.
2361+
2362+
Notes:
2363+
2364+
- 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.
2365+
- The function returns `-1` if unable to set an element and `0` otherwise.
2366+
2367+
#### stdlib_ndarray_iset_int64( \*arr, idx, v )
2368+
2369+
Sets a signed 64-bit integer ndarray data element located at a specified linear index.
2370+
2371+
```c
2372+
int8_t stdlib_ndarray_iset_int64( const struct ndarray *arr, const int64_t idx, const int64_t v );
2373+
```
2374+
2375+
The function accepts the following arguments:
2376+
2377+
- **arr**: `[in] struct ndarray*` input ndarray.
2378+
- **idx**: `[in] int64_t` linear view index.
2379+
- **v**: `[in] int64_t` value to set.
2380+
2381+
Notes:
2382+
2383+
- 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.
2384+
- The function returns `-1` if unable to set an element and `0` otherwise.
2385+
2386+
#### stdlib_ndarray_iset_uint32( \*arr, idx, v )
2387+
2388+
Sets an unsigned 32-bit integer ndarray data element located at a specified linear index.
2389+
2390+
```c
2391+
int8_t stdlib_ndarray_iset_uint32( const struct ndarray *arr, const int64_t idx, const uint32_t v );
2392+
```
2393+
2394+
The function accepts the following arguments:
2395+
2396+
- **arr**: `[in] struct ndarray*` input ndarray.
2397+
- **idx**: `[in] int64_t` linear view index.
2398+
- **v**: `[in] uint32_t` value to set.
2399+
2400+
Notes:
2401+
2402+
- 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.
2403+
- The function returns `-1` if unable to set an element and `0` otherwise.
2404+
2405+
#### stdlib_ndarray_iset_int32( \*arr, idx, v )
2406+
2407+
Sets a signed 32-bit integer ndarray data element located at a specified linear index.
2408+
2409+
```c
2410+
int8_t stdlib_ndarray_iset_int32( const struct ndarray *arr, const int64_t idx, const int32_t v );
2411+
```
2412+
2413+
The function accepts the following arguments:
2414+
2415+
- **arr**: `[in] struct ndarray*` input ndarray.
2416+
- **idx**: `[in] int64_t` linear view index.
2417+
- **v**: `[in] int32_t` value to set.
2418+
2419+
Notes:
2420+
2421+
- 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.
2422+
- The function returns `-1` if unable to set an element and `0` otherwise.
2423+
2424+
#### stdlib_ndarray_iset_uint16( \*arr, idx, v )
2425+
2426+
Sets an unsigned 16-bit integer ndarray data element located at a specified linear index.
2427+
2428+
```c
2429+
int8_t stdlib_ndarray_iset_uint16( const struct ndarray *arr, const int64_t idx, const uint16_t v );
2430+
```
2431+
2432+
The function accepts the following arguments:
2433+
2434+
- **arr**: `[in] struct ndarray*` input ndarray.
2435+
- **idx**: `[in] int64_t` linear view index.
2436+
- **v**: `[in] uint16_t` value to set.
2437+
2438+
Notes:
2439+
2440+
- 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.
2441+
- The function returns `-1` if unable to set an element and `0` otherwise.
2442+
2443+
#### stdlib_ndarray_iset_int16( \*arr, idx, v )
2444+
2445+
Sets a signed 16-bit integer ndarray data element located at a specified linear index.
2446+
2447+
```c
2448+
int8_t stdlib_ndarray_iset_int16( const struct ndarray *arr, const int64_t idx, const int16_t v );
2449+
```
2450+
2451+
The function accepts the following arguments:
2452+
2453+
- **arr**: `[in] struct ndarray*` input ndarray.
2454+
- **idx**: `[in] int64_t` linear view index.
2455+
- **v**: `[in] int16_t` value to set.
2456+
2457+
Notes:
2458+
2459+
- 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.
2460+
- The function returns `-1` if unable to set an element and `0` otherwise.
2461+
2462+
#### stdlib_ndarray_iset_uint8( \*arr, idx, v )
2463+
2464+
Sets an unsigned 8-bit integer ndarray data element located at a specified linear index.
2465+
2466+
```c
2467+
int8_t stdlib_ndarray_iset_uint8( const struct ndarray *arr, const int64_t idx, const uint8_t v );
2468+
```
2469+
2470+
The function accepts the following arguments:
2471+
2472+
- **arr**: `[in] struct ndarray*` input ndarray.
2473+
- **idx**: `[in] int64_t` linear view index.
2474+
- **v**: `[in] uint8_t` value to set.
2475+
2476+
Notes:
2477+
2478+
- The function returns `-1` if unable to set an element and `0` otherwise.
2479+
2480+
#### stdlib_ndarray_iset_int8( \*arr, idx, v )
2481+
2482+
Sets a signed 8-bit integer ndarray data element located at a specified linear index.
2483+
2484+
```c
2485+
int8_t stdlib_ndarray_iset_int8( const struct ndarray *arr, const int64_t idx, const int8_t v );
2486+
```
2487+
2488+
The function accepts the following arguments:
2489+
2490+
- **arr**: `[in] struct ndarray*` input ndarray.
2491+
- **idx**: `[in] int64_t` linear view index.
2492+
- **v**: `[in] int8_t` value to set.
2493+
2494+
Notes:
2495+
2496+
- The function returns `-1` if unable to set an element and `0` otherwise.
2497+
22882498
</section>
22892499

22902500
<!-- /.usage -->

0 commit comments

Comments
 (0)