time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

f_c.c (75149B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2021 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 #include "stdlib/ndarray/base/unary/f_c.h"
     20 #include "stdlib/ndarray/base/unary/typedefs.h"
     21 #include "stdlib/ndarray/base/unary/macros.h"
     22 #include "stdlib/ndarray/base/unary/dispatch_object.h"
     23 #include "stdlib/ndarray/base/unary/dispatch.h"
     24 #include "stdlib/ndarray/ctor.h"
     25 #include <stdint.h>
     26 #include <complex.h>
     27 
     28 /**
     29 * Applies a unary callback accepting and returning single-precision floating-point numbers to a zero-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a zero-dimensional single-precision complex floating-point output ndarray.
     30 *
     31 * ## Notes
     32 *
     33 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
     34 *
     35 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
     36 * @param fcn      callback
     37 * @return         status code
     38 *
     39 * @example
     40 * #include "stdlib/ndarray/base/unary/f_c.h"
     41 * #include "stdlib/ndarray/dtypes.h"
     42 * #include "stdlib/ndarray/index_modes.h"
     43 * #include "stdlib/ndarray/orders.h"
     44 * #include "stdlib/ndarray/ctor.h"
     45 * #include <stdint.h>
     46 * #include <stdlib.h>
     47 * #include <stdio.h>
     48 *
     49 * // Define the ndarray data types:
     50 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
     51 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
     52 *
     53 * // Create underlying byte arrays:
     54 * uint8_t xbuf[] = { 0, 0, 0, 0 };
     55 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     56 *
     57 * // Define the number of dimensions:
     58 * int64_t ndims = 0;
     59 *
     60 * // Define the array shapes:
     61 * int64_t shape[] = {};
     62 *
     63 * // Define the strides:
     64 * int64_t sx[] = { 0 };
     65 * int64_t sy[] = { 0 };
     66 *
     67 * // Define the offsets:
     68 * int64_t ox = 0;
     69 * int64_t oy = 0;
     70 *
     71 * // Define the array order:
     72 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
     73 *
     74 * // Specify the index mode:
     75 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
     76 *
     77 * // Specify the subscript index modes:
     78 * int8_t submodes[] = { imode };
     79 * int64_t nsubmodes = 1;
     80 *
     81 * // Create an input ndarray:
     82 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
     83 * if ( x == NULL ) {
     84 *     fprintf( stderr, "Error allocating memory.\n" );
     85 *     exit( EXIT_FAILURE );
     86 * }
     87 *
     88 * // Create an output ndarray:
     89 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
     90 * if ( y == NULL ) {
     91 *     fprintf( stderr, "Error allocating memory.\n" );
     92 *     exit( EXIT_FAILURE );
     93 * }
     94 *
     95 * // Create an array containing the ndarrays:
     96 * struct ndarray *arrays[] = { x, y };
     97 *
     98 * // Define a callback:
     99 * float scale( const float x ) {
    100 *     return x + 10.0f;
    101 * }
    102 *
    103 * // Apply the callback:
    104 * int8_t status = stdlib_ndarray_f_c_0d( arrays, (void *)scale );
    105 * if ( status != 0 ) {
    106 *     fprintf( stderr, "Error during computation.\n" );
    107 *     exit( EXIT_FAILURE );
    108 * }
    109 *
    110 * // ...
    111 *
    112 * // Free allocated memory:
    113 * stdlib_ndarray_free( x );
    114 * stdlib_ndarray_free( y );
    115 */
    116 int8_t stdlib_ndarray_f_c_0d( struct ndarray *arrays[], void *fcn ) {
    117 	float v;
    118 	int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v );
    119 	if ( status != 0 ) {
    120 		return -1;
    121 	}
    122 	typedef float func_type( const float x );
    123 	func_type *f = (func_type *)fcn;
    124 	status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, (float complex)f( v ) );
    125 	if ( status != 0 ) {
    126 		return -1;
    127 	}
    128 	return 0;
    129 }
    130 
    131 /**
    132 * Applies a unary callback accepting and returning single-precision floating-point numbers to a one-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a one-dimensional single-precision complex floating-point output ndarray.
    133 *
    134 * ## Notes
    135 *
    136 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    137 *
    138 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    139 * @param fcn      callback
    140 * @return         status code
    141 *
    142 * @example
    143 * #include "stdlib/ndarray/base/unary/f_c.h"
    144 * #include "stdlib/ndarray/dtypes.h"
    145 * #include "stdlib/ndarray/index_modes.h"
    146 * #include "stdlib/ndarray/orders.h"
    147 * #include "stdlib/ndarray/ctor.h"
    148 * #include <stdint.h>
    149 * #include <stdlib.h>
    150 * #include <stdio.h>
    151 *
    152 * // Define the ndarray data types:
    153 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    154 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    155 *
    156 * // Create underlying byte arrays:
    157 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    158 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    159 *
    160 * // Define the number of dimensions:
    161 * int64_t ndims = 1;
    162 *
    163 * // Define the array shapes:
    164 * int64_t shape[] = { 2 };
    165 *
    166 * // Define the strides:
    167 * int64_t sx[] = { 4 };
    168 * int64_t sy[] = { 8 };
    169 *
    170 * // Define the offsets:
    171 * int64_t ox = 0;
    172 * int64_t oy = 0;
    173 *
    174 * // Define the array order:
    175 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    176 *
    177 * // Specify the index mode:
    178 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    179 *
    180 * // Specify the subscript index modes:
    181 * int8_t submodes[] = { imode };
    182 * int64_t nsubmodes = 1;
    183 *
    184 * // Create an input ndarray:
    185 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    186 * if ( x == NULL ) {
    187 *     fprintf( stderr, "Error allocating memory.\n" );
    188 *     exit( EXIT_FAILURE );
    189 * }
    190 *
    191 * // Create an output ndarray:
    192 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    193 * if ( y == NULL ) {
    194 *     fprintf( stderr, "Error allocating memory.\n" );
    195 *     exit( EXIT_FAILURE );
    196 * }
    197 *
    198 * // Create an array containing the ndarrays:
    199 * struct ndarray *arrays[] = { x, y };
    200 *
    201 * // Define a callback:
    202 * float scale( const float x ) {
    203 *     return x + 10.0f;
    204 * }
    205 *
    206 * // Apply the callback:
    207 * int8_t status = stdlib_ndarray_f_c_1d( arrays, (void *)scale );
    208 * if ( status != 0 ) {
    209 *     fprintf( stderr, "Error during computation.\n" );
    210 *     exit( EXIT_FAILURE );
    211 * }
    212 *
    213 * // ...
    214 *
    215 * // Free allocated memory:
    216 * stdlib_ndarray_free( x );
    217 * stdlib_ndarray_free( y );
    218 */
    219 int8_t stdlib_ndarray_f_c_1d( struct ndarray *arrays[], void *fcn ) {
    220 	typedef float func_type( const float x );
    221 	func_type *f = (func_type *)fcn;
    222 	STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( float, float complex )
    223 	return 0;
    224 }
    225 
    226 /**
    227 * Applies a unary callback accepting and returning single-precision floating-point numbers to a two-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a two-dimensional single-precision complex floating-point output ndarray.
    228 *
    229 * ## Notes
    230 *
    231 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    232 *
    233 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    234 * @param fcn      callback
    235 * @return         status code
    236 *
    237 * @example
    238 * #include "stdlib/ndarray/base/unary/f_c.h"
    239 * #include "stdlib/ndarray/dtypes.h"
    240 * #include "stdlib/ndarray/index_modes.h"
    241 * #include "stdlib/ndarray/orders.h"
    242 * #include "stdlib/ndarray/ctor.h"
    243 * #include <stdint.h>
    244 * #include <stdlib.h>
    245 * #include <stdio.h>
    246 *
    247 * // Define the ndarray data types:
    248 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    249 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    250 *
    251 * // Create underlying byte arrays:
    252 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    253 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    254 *
    255 * // Define the number of dimensions:
    256 * int64_t ndims = 2;
    257 *
    258 * // Define the array shapes:
    259 * int64_t shape[] = { 2, 2 };
    260 *
    261 * // Define the strides:
    262 * int64_t sx[] = { 8, 4 };
    263 * int64_t sy[] = { 16, 8 };
    264 *
    265 * // Define the offsets:
    266 * int64_t ox = 0;
    267 * int64_t oy = 0;
    268 *
    269 * // Define the array order:
    270 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    271 *
    272 * // Specify the index mode:
    273 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    274 *
    275 * // Specify the subscript index modes:
    276 * int8_t submodes[] = { imode };
    277 * int64_t nsubmodes = 1;
    278 *
    279 * // Create an input ndarray:
    280 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    281 * if ( x == NULL ) {
    282 *     fprintf( stderr, "Error allocating memory.\n" );
    283 *     exit( EXIT_FAILURE );
    284 * }
    285 *
    286 * // Create an output ndarray:
    287 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    288 * if ( y == NULL ) {
    289 *     fprintf( stderr, "Error allocating memory.\n" );
    290 *     exit( EXIT_FAILURE );
    291 * }
    292 *
    293 * // Create an array containing the ndarrays:
    294 * struct ndarray *arrays[] = { x, y };
    295 *
    296 * // Define a callback:
    297 * float scale( const float x ) {
    298 *     return x + 10.0f;
    299 * }
    300 *
    301 * // Apply the callback:
    302 * int8_t status = stdlib_ndarray_f_c_2d( arrays, (void *)scale );
    303 * if ( status != 0 ) {
    304 *     fprintf( stderr, "Error during computation.\n" );
    305 *     exit( EXIT_FAILURE );
    306 * }
    307 *
    308 * // ...
    309 *
    310 * // Free allocated memory:
    311 * stdlib_ndarray_free( x );
    312 * stdlib_ndarray_free( y );
    313 */
    314 int8_t stdlib_ndarray_f_c_2d( struct ndarray *arrays[], void *fcn ) {
    315 	typedef float func_type( const float x );
    316 	func_type *f = (func_type *)fcn;
    317 	STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( float, float complex )
    318 	return 0;
    319 }
    320 
    321 /**
    322 * Applies a unary callback accepting and returning single-precision floating-point numbers to a two-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a two-dimensional single-precision complex floating-point output ndarray.
    323 *
    324 * ## Notes
    325 *
    326 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    327 *
    328 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    329 * @param fcn      callback
    330 * @return         status code
    331 *
    332 * @example
    333 * #include "stdlib/ndarray/base/unary/f_c.h"
    334 * #include "stdlib/ndarray/dtypes.h"
    335 * #include "stdlib/ndarray/index_modes.h"
    336 * #include "stdlib/ndarray/orders.h"
    337 * #include "stdlib/ndarray/ctor.h"
    338 * #include <stdint.h>
    339 * #include <stdlib.h>
    340 * #include <stdio.h>
    341 *
    342 * // Define the ndarray data types:
    343 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    344 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    345 *
    346 * // Create underlying byte arrays:
    347 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    348 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    349 *
    350 * // Define the number of dimensions:
    351 * int64_t ndims = 2;
    352 *
    353 * // Define the array shapes:
    354 * int64_t shape[] = { 2, 2 };
    355 *
    356 * // Define the strides:
    357 * int64_t sx[] = { 8, 4 };
    358 * int64_t sy[] = { 16, 8 };
    359 *
    360 * // Define the offsets:
    361 * int64_t ox = 0;
    362 * int64_t oy = 0;
    363 *
    364 * // Define the array order:
    365 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    366 *
    367 * // Specify the index mode:
    368 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    369 *
    370 * // Specify the subscript index modes:
    371 * int8_t submodes[] = { imode };
    372 * int64_t nsubmodes = 1;
    373 *
    374 * // Create an input ndarray:
    375 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    376 * if ( x == NULL ) {
    377 *     fprintf( stderr, "Error allocating memory.\n" );
    378 *     exit( EXIT_FAILURE );
    379 * }
    380 *
    381 * // Create an output ndarray:
    382 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    383 * if ( y == NULL ) {
    384 *     fprintf( stderr, "Error allocating memory.\n" );
    385 *     exit( EXIT_FAILURE );
    386 * }
    387 *
    388 * // Create an array containing the ndarrays:
    389 * struct ndarray *arrays[] = { x, y };
    390 *
    391 * // Define a callback:
    392 * float scale( const float x ) {
    393 *     return x + 10.0f;
    394 * }
    395 *
    396 * // Apply the callback:
    397 * int8_t status = stdlib_ndarray_f_c_2d_blocked( arrays, (void *)scale );
    398 * if ( status != 0 ) {
    399 *     fprintf( stderr, "Error during computation.\n" );
    400 *     exit( EXIT_FAILURE );
    401 * }
    402 *
    403 * // ...
    404 *
    405 * // Free allocated memory:
    406 * stdlib_ndarray_free( x );
    407 * stdlib_ndarray_free( y );
    408 */
    409 int8_t stdlib_ndarray_f_c_2d_blocked( struct ndarray *arrays[], void *fcn ) {
    410 	typedef float func_type( const float x );
    411 	func_type *f = (func_type *)fcn;
    412 	STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( float, float complex )
    413 	return 0;
    414 }
    415 
    416 /**
    417 * Applies a unary callback accepting and returning single-precision floating-point numbers to a three-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a three-dimensional single-precision complex floating-point output ndarray.
    418 *
    419 * ## Notes
    420 *
    421 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    422 *
    423 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    424 * @param fcn      callback
    425 * @return         status code
    426 *
    427 * @example
    428 * #include "stdlib/ndarray/base/unary/f_c.h"
    429 * #include "stdlib/ndarray/dtypes.h"
    430 * #include "stdlib/ndarray/index_modes.h"
    431 * #include "stdlib/ndarray/orders.h"
    432 * #include "stdlib/ndarray/ctor.h"
    433 * #include <stdint.h>
    434 * #include <stdlib.h>
    435 * #include <stdio.h>
    436 *
    437 * // Define the ndarray data types:
    438 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    439 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    440 *
    441 * // Create underlying byte arrays:
    442 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    443 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    444 *
    445 * // Define the number of dimensions:
    446 * int64_t ndims = 3;
    447 *
    448 * // Define the array shapes:
    449 * int64_t shape[] = { 2, 2, 2 };
    450 *
    451 * // Define the strides:
    452 * int64_t sx[] = { 16, 8, 4 };
    453 * int64_t sy[] = { 32, 16, 8 };
    454 *
    455 * // Define the offsets:
    456 * int64_t ox = 0;
    457 * int64_t oy = 0;
    458 *
    459 * // Define the array order:
    460 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    461 *
    462 * // Specify the index mode:
    463 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    464 *
    465 * // Specify the subscript index modes:
    466 * int8_t submodes[] = { imode };
    467 * int64_t nsubmodes = 1;
    468 *
    469 * // Create an input ndarray:
    470 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    471 * if ( x == NULL ) {
    472 *     fprintf( stderr, "Error allocating memory.\n" );
    473 *     exit( EXIT_FAILURE );
    474 * }
    475 *
    476 * // Create an output ndarray:
    477 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    478 * if ( y == NULL ) {
    479 *     fprintf( stderr, "Error allocating memory.\n" );
    480 *     exit( EXIT_FAILURE );
    481 * }
    482 *
    483 * // Create an array containing the ndarrays:
    484 * struct ndarray *arrays[] = { x, y };
    485 *
    486 * // Define a callback:
    487 * float scale( const float x ) {
    488 *     return x + 10.0f;
    489 * }
    490 *
    491 * // Apply the callback:
    492 * int8_t status = stdlib_ndarray_f_c_3d( arrays, (void *)scale );
    493 * if ( status != 0 ) {
    494 *     fprintf( stderr, "Error during computation.\n" );
    495 *     exit( EXIT_FAILURE );
    496 * }
    497 *
    498 * // ...
    499 *
    500 * // Free allocated memory:
    501 * stdlib_ndarray_free( x );
    502 * stdlib_ndarray_free( y );
    503 */
    504 int8_t stdlib_ndarray_f_c_3d( struct ndarray *arrays[], void *fcn ) {
    505 	typedef float func_type( const float x );
    506 	func_type *f = (func_type *)fcn;
    507 	STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( float, float complex )
    508 	return 0;
    509 }
    510 
    511 /**
    512 * Applies a unary callback accepting and returning single-precision floating-point numbers to a three-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a three-dimensional single-precision complex floating-point output ndarray.
    513 *
    514 * ## Notes
    515 *
    516 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    517 *
    518 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    519 * @param fcn      callback
    520 * @return         status code
    521 *
    522 * @example
    523 * #include "stdlib/ndarray/base/unary/f_c.h"
    524 * #include "stdlib/ndarray/dtypes.h"
    525 * #include "stdlib/ndarray/index_modes.h"
    526 * #include "stdlib/ndarray/orders.h"
    527 * #include "stdlib/ndarray/ctor.h"
    528 * #include <stdint.h>
    529 * #include <stdlib.h>
    530 * #include <stdio.h>
    531 *
    532 * // Define the ndarray data types:
    533 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    534 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    535 *
    536 * // Create underlying byte arrays:
    537 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    538 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    539 *
    540 * // Define the number of dimensions:
    541 * int64_t ndims = 3;
    542 *
    543 * // Define the array shapes:
    544 * int64_t shape[] = { 2, 2, 2 };
    545 *
    546 * // Define the strides:
    547 * int64_t sx[] = { 16, 8, 4 };
    548 * int64_t sy[] = { 32, 16, 8 };
    549 *
    550 * // Define the offsets:
    551 * int64_t ox = 0;
    552 * int64_t oy = 0;
    553 *
    554 * // Define the array order:
    555 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    556 *
    557 * // Specify the index mode:
    558 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    559 *
    560 * // Specify the subscript index modes:
    561 * int8_t submodes[] = { imode };
    562 * int64_t nsubmodes = 1;
    563 *
    564 * // Create an input ndarray:
    565 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    566 * if ( x == NULL ) {
    567 *     fprintf( stderr, "Error allocating memory.\n" );
    568 *     exit( EXIT_FAILURE );
    569 * }
    570 *
    571 * // Create an output ndarray:
    572 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    573 * if ( y == NULL ) {
    574 *     fprintf( stderr, "Error allocating memory.\n" );
    575 *     exit( EXIT_FAILURE );
    576 * }
    577 *
    578 * // Create an array containing the ndarrays:
    579 * struct ndarray *arrays[] = { x, y };
    580 *
    581 * // Define a callback:
    582 * float scale( const float x ) {
    583 *     return x + 10.0f;
    584 * }
    585 *
    586 * // Apply the callback:
    587 * int8_t status = stdlib_ndarray_f_c_3d_blocked( arrays, (void *)scale );
    588 * if ( status != 0 ) {
    589 *     fprintf( stderr, "Error during computation.\n" );
    590 *     exit( EXIT_FAILURE );
    591 * }
    592 *
    593 * // ...
    594 *
    595 * // Free allocated memory:
    596 * stdlib_ndarray_free( x );
    597 * stdlib_ndarray_free( y );
    598 */
    599 int8_t stdlib_ndarray_f_c_3d_blocked( struct ndarray *arrays[], void *fcn ) {
    600 	typedef float func_type( const float x );
    601 	func_type *f = (func_type *)fcn;
    602 	STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( float, float complex )
    603 	return 0;
    604 }
    605 
    606 /**
    607 * Applies a unary callback accepting and returning single-precision floating-point numbers to a four-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a four-dimensional single-precision complex floating-point output ndarray.
    608 *
    609 * ## Notes
    610 *
    611 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    612 *
    613 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    614 * @param fcn      callback
    615 * @return         status code
    616 *
    617 * @example
    618 * #include "stdlib/ndarray/base/unary/f_c.h"
    619 * #include "stdlib/ndarray/dtypes.h"
    620 * #include "stdlib/ndarray/index_modes.h"
    621 * #include "stdlib/ndarray/orders.h"
    622 * #include "stdlib/ndarray/ctor.h"
    623 * #include <stdint.h>
    624 * #include <stdlib.h>
    625 * #include <stdio.h>
    626 *
    627 * // Define the ndarray data types:
    628 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    629 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    630 *
    631 * // Create underlying byte arrays:
    632 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    633 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    634 *
    635 * // Define the number of dimensions:
    636 * int64_t ndims = 4;
    637 *
    638 * // Define the array shapes:
    639 * int64_t shape[] = { 1, 2, 2, 2 };
    640 *
    641 * // Define the strides:
    642 * int64_t sx[] = { 16, 16, 8, 4 };
    643 * int64_t sy[] = { 32, 32, 16, 8 };
    644 *
    645 * // Define the offsets:
    646 * int64_t ox = 0;
    647 * int64_t oy = 0;
    648 *
    649 * // Define the array order:
    650 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    651 *
    652 * // Specify the index mode:
    653 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    654 *
    655 * // Specify the subscript index modes:
    656 * int8_t submodes[] = { imode };
    657 * int64_t nsubmodes = 1;
    658 *
    659 * // Create an input ndarray:
    660 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    661 * if ( x == NULL ) {
    662 *     fprintf( stderr, "Error allocating memory.\n" );
    663 *     exit( EXIT_FAILURE );
    664 * }
    665 *
    666 * // Create an output ndarray:
    667 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    668 * if ( y == NULL ) {
    669 *     fprintf( stderr, "Error allocating memory.\n" );
    670 *     exit( EXIT_FAILURE );
    671 * }
    672 *
    673 * // Create an array containing the ndarrays:
    674 * struct ndarray *arrays[] = { x, y };
    675 *
    676 * // Define a callback:
    677 * float scale( const float x ) {
    678 *     return x + 10.0f;
    679 * }
    680 *
    681 * // Apply the callback:
    682 * int8_t status = stdlib_ndarray_f_c_4d( arrays, (void *)scale );
    683 * if ( status != 0 ) {
    684 *     fprintf( stderr, "Error during computation.\n" );
    685 *     exit( EXIT_FAILURE );
    686 * }
    687 *
    688 * // ...
    689 *
    690 * // Free allocated memory:
    691 * stdlib_ndarray_free( x );
    692 * stdlib_ndarray_free( y );
    693 */
    694 int8_t stdlib_ndarray_f_c_4d( struct ndarray *arrays[], void *fcn ) {
    695 	typedef float func_type( const float x );
    696 	func_type *f = (func_type *)fcn;
    697 	STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( float, float complex )
    698 	return 0;
    699 }
    700 
    701 /**
    702 * Applies a unary callback accepting and returning single-precision floating-point numbers to a four-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a four-dimensional single-precision complex floating-point output ndarray.
    703 *
    704 * ## Notes
    705 *
    706 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    707 *
    708 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    709 * @param fcn      callback
    710 * @return         status code
    711 *
    712 * @example
    713 * #include "stdlib/ndarray/base/unary/f_c.h"
    714 * #include "stdlib/ndarray/dtypes.h"
    715 * #include "stdlib/ndarray/index_modes.h"
    716 * #include "stdlib/ndarray/orders.h"
    717 * #include "stdlib/ndarray/ctor.h"
    718 * #include <stdint.h>
    719 * #include <stdlib.h>
    720 * #include <stdio.h>
    721 *
    722 * // Define the ndarray data types:
    723 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    724 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    725 *
    726 * // Create underlying byte arrays:
    727 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    728 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    729 *
    730 * // Define the number of dimensions:
    731 * int64_t ndims = 4;
    732 *
    733 * // Define the array shapes:
    734 * int64_t shape[] = { 1, 2, 2, 2 };
    735 *
    736 * // Define the strides:
    737 * int64_t sx[] = { 16, 16, 8, 4 };
    738 * int64_t sy[] = { 32, 32, 16, 8 };
    739 *
    740 * // Define the offsets:
    741 * int64_t ox = 0;
    742 * int64_t oy = 0;
    743 *
    744 * // Define the array order:
    745 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    746 *
    747 * // Specify the index mode:
    748 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    749 *
    750 * // Specify the subscript index modes:
    751 * int8_t submodes[] = { imode };
    752 * int64_t nsubmodes = 1;
    753 *
    754 * // Create an input ndarray:
    755 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    756 * if ( x == NULL ) {
    757 *     fprintf( stderr, "Error allocating memory.\n" );
    758 *     exit( EXIT_FAILURE );
    759 * }
    760 *
    761 * // Create an output ndarray:
    762 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    763 * if ( y == NULL ) {
    764 *     fprintf( stderr, "Error allocating memory.\n" );
    765 *     exit( EXIT_FAILURE );
    766 * }
    767 *
    768 * // Create an array containing the ndarrays:
    769 * struct ndarray *arrays[] = { x, y };
    770 *
    771 * // Define a callback:
    772 * float scale( const float x ) {
    773 *     return x + 10.0f;
    774 * }
    775 *
    776 * // Apply the callback:
    777 * int8_t status = stdlib_ndarray_f_c_4d_blocked( arrays, (void *)scale );
    778 * if ( status != 0 ) {
    779 *     fprintf( stderr, "Error during computation.\n" );
    780 *     exit( EXIT_FAILURE );
    781 * }
    782 *
    783 * // ...
    784 *
    785 * // Free allocated memory:
    786 * stdlib_ndarray_free( x );
    787 * stdlib_ndarray_free( y );
    788 */
    789 int8_t stdlib_ndarray_f_c_4d_blocked( struct ndarray *arrays[], void *fcn ) {
    790 	typedef float func_type( const float x );
    791 	func_type *f = (func_type *)fcn;
    792 	STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( float, float complex )
    793 	return 0;
    794 }
    795 
    796 /**
    797 * Applies a unary callback accepting and returning single-precision floating-point numbers to a five-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a five-dimensional single-precision complex floating-point output ndarray.
    798 *
    799 * ## Notes
    800 *
    801 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    802 *
    803 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    804 * @param fcn      callback
    805 * @return         status code
    806 *
    807 * @example
    808 * #include "stdlib/ndarray/base/unary/f_c.h"
    809 * #include "stdlib/ndarray/dtypes.h"
    810 * #include "stdlib/ndarray/index_modes.h"
    811 * #include "stdlib/ndarray/orders.h"
    812 * #include "stdlib/ndarray/ctor.h"
    813 * #include <stdint.h>
    814 * #include <stdlib.h>
    815 * #include <stdio.h>
    816 *
    817 * // Define the ndarray data types:
    818 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    819 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    820 *
    821 * // Create underlying byte arrays:
    822 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    823 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    824 *
    825 * // Define the number of dimensions:
    826 * int64_t ndims = 5;
    827 *
    828 * // Define the array shapes:
    829 * int64_t shape[] = { 1, 1, 2, 2, 2 };
    830 *
    831 * // Define the strides:
    832 * int64_t sx[] = { 16, 16, 16, 8, 4 };
    833 * int64_t sy[] = { 32, 32, 32, 16, 8 };
    834 *
    835 * // Define the offsets:
    836 * int64_t ox = 0;
    837 * int64_t oy = 0;
    838 *
    839 * // Define the array order:
    840 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    841 *
    842 * // Specify the index mode:
    843 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    844 *
    845 * // Specify the subscript index modes:
    846 * int8_t submodes[] = { imode };
    847 * int64_t nsubmodes = 1;
    848 *
    849 * // Create an input ndarray:
    850 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    851 * if ( x == NULL ) {
    852 *     fprintf( stderr, "Error allocating memory.\n" );
    853 *     exit( EXIT_FAILURE );
    854 * }
    855 *
    856 * // Create an output ndarray:
    857 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    858 * if ( y == NULL ) {
    859 *     fprintf( stderr, "Error allocating memory.\n" );
    860 *     exit( EXIT_FAILURE );
    861 * }
    862 *
    863 * // Create an array containing the ndarrays:
    864 * struct ndarray *arrays[] = { x, y };
    865 *
    866 * // Define a callback:
    867 * float scale( const float x ) {
    868 *     return x + 10.0f;
    869 * }
    870 *
    871 * // Apply the callback:
    872 * int8_t status = stdlib_ndarray_f_c_5d( arrays, (void *)scale );
    873 * if ( status != 0 ) {
    874 *     fprintf( stderr, "Error during computation.\n" );
    875 *     exit( EXIT_FAILURE );
    876 * }
    877 *
    878 * // ...
    879 *
    880 * // Free allocated memory:
    881 * stdlib_ndarray_free( x );
    882 * stdlib_ndarray_free( y );
    883 */
    884 int8_t stdlib_ndarray_f_c_5d( struct ndarray *arrays[], void *fcn ) {
    885 	typedef float func_type( const float x );
    886 	func_type *f = (func_type *)fcn;
    887 	STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( float, float complex )
    888 	return 0;
    889 }
    890 
    891 /**
    892 * Applies a unary callback accepting and returning single-precision floating-point numbers to a five-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a five-dimensional single-precision complex floating-point output ndarray.
    893 *
    894 * ## Notes
    895 *
    896 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    897 *
    898 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    899 * @param fcn      callback
    900 * @return         status code
    901 *
    902 * @example
    903 * #include "stdlib/ndarray/base/unary/f_c.h"
    904 * #include "stdlib/ndarray/dtypes.h"
    905 * #include "stdlib/ndarray/index_modes.h"
    906 * #include "stdlib/ndarray/orders.h"
    907 * #include "stdlib/ndarray/ctor.h"
    908 * #include <stdint.h>
    909 * #include <stdlib.h>
    910 * #include <stdio.h>
    911 *
    912 * // Define the ndarray data types:
    913 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
    914 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
    915 *
    916 * // Create underlying byte arrays:
    917 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    918 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    919 *
    920 * // Define the number of dimensions:
    921 * int64_t ndims = 5;
    922 *
    923 * // Define the array shapes:
    924 * int64_t shape[] = { 1, 1, 2, 2, 2 };
    925 *
    926 * // Define the strides:
    927 * int64_t sx[] = { 16, 16, 16, 8, 4 };
    928 * int64_t sy[] = { 32, 32, 32, 16, 8 };
    929 *
    930 * // Define the offsets:
    931 * int64_t ox = 0;
    932 * int64_t oy = 0;
    933 *
    934 * // Define the array order:
    935 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
    936 *
    937 * // Specify the index mode:
    938 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
    939 *
    940 * // Specify the subscript index modes:
    941 * int8_t submodes[] = { imode };
    942 * int64_t nsubmodes = 1;
    943 *
    944 * // Create an input ndarray:
    945 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
    946 * if ( x == NULL ) {
    947 *     fprintf( stderr, "Error allocating memory.\n" );
    948 *     exit( EXIT_FAILURE );
    949 * }
    950 *
    951 * // Create an output ndarray:
    952 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
    953 * if ( y == NULL ) {
    954 *     fprintf( stderr, "Error allocating memory.\n" );
    955 *     exit( EXIT_FAILURE );
    956 * }
    957 *
    958 * // Create an array containing the ndarrays:
    959 * struct ndarray *arrays[] = { x, y };
    960 *
    961 * // Define a callback:
    962 * float scale( const float x ) {
    963 *     return x + 10.0f;
    964 * }
    965 *
    966 * // Apply the callback:
    967 * int8_t status = stdlib_ndarray_f_c_5d_blocked( arrays, (void *)scale );
    968 * if ( status != 0 ) {
    969 *     fprintf( stderr, "Error during computation.\n" );
    970 *     exit( EXIT_FAILURE );
    971 * }
    972 *
    973 * // ...
    974 *
    975 * // Free allocated memory:
    976 * stdlib_ndarray_free( x );
    977 * stdlib_ndarray_free( y );
    978 */
    979 int8_t stdlib_ndarray_f_c_5d_blocked( struct ndarray *arrays[], void *fcn ) {
    980 	typedef float func_type( const float x );
    981 	func_type *f = (func_type *)fcn;
    982 	STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( float, float complex )
    983 	return 0;
    984 }
    985 
    986 /**
    987 * Applies a unary callback accepting and returning single-precision floating-point numbers to a six-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a six-dimensional single-precision complex floating-point output ndarray.
    988 *
    989 * ## Notes
    990 *
    991 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
    992 *
    993 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
    994 * @param fcn      callback
    995 * @return         status code
    996 *
    997 * @example
    998 * #include "stdlib/ndarray/base/unary/f_c.h"
    999 * #include "stdlib/ndarray/dtypes.h"
   1000 * #include "stdlib/ndarray/index_modes.h"
   1001 * #include "stdlib/ndarray/orders.h"
   1002 * #include "stdlib/ndarray/ctor.h"
   1003 * #include <stdint.h>
   1004 * #include <stdlib.h>
   1005 * #include <stdio.h>
   1006 *
   1007 * // Define the ndarray data types:
   1008 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1009 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1010 *
   1011 * // Create underlying byte arrays:
   1012 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1013 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1014 *
   1015 * // Define the number of dimensions:
   1016 * int64_t ndims = 6;
   1017 *
   1018 * // Define the array shapes:
   1019 * int64_t shape[] = { 1, 1, 1, 2, 2, 2 };
   1020 *
   1021 * // Define the strides:
   1022 * int64_t sx[] = { 16, 16, 16, 16, 8, 4 };
   1023 * int64_t sy[] = { 32, 32, 32, 32, 16, 8 };
   1024 *
   1025 * // Define the offsets:
   1026 * int64_t ox = 0;
   1027 * int64_t oy = 0;
   1028 *
   1029 * // Define the array order:
   1030 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1031 *
   1032 * // Specify the index mode:
   1033 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1034 *
   1035 * // Specify the subscript index modes:
   1036 * int8_t submodes[] = { imode };
   1037 * int64_t nsubmodes = 1;
   1038 *
   1039 * // Create an input ndarray:
   1040 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1041 * if ( x == NULL ) {
   1042 *     fprintf( stderr, "Error allocating memory.\n" );
   1043 *     exit( EXIT_FAILURE );
   1044 * }
   1045 *
   1046 * // Create an output ndarray:
   1047 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1048 * if ( y == NULL ) {
   1049 *     fprintf( stderr, "Error allocating memory.\n" );
   1050 *     exit( EXIT_FAILURE );
   1051 * }
   1052 *
   1053 * // Create an array containing the ndarrays:
   1054 * struct ndarray *arrays[] = { x, y };
   1055 *
   1056 * // Define a callback:
   1057 * float scale( const float x ) {
   1058 *     return x + 10.0f;
   1059 * }
   1060 *
   1061 * // Apply the callback:
   1062 * int8_t status = stdlib_ndarray_f_c_6d( arrays, (void *)scale );
   1063 * if ( status != 0 ) {
   1064 *     fprintf( stderr, "Error during computation.\n" );
   1065 *     exit( EXIT_FAILURE );
   1066 * }
   1067 *
   1068 * // ...
   1069 *
   1070 * // Free allocated memory:
   1071 * stdlib_ndarray_free( x );
   1072 * stdlib_ndarray_free( y );
   1073 */
   1074 int8_t stdlib_ndarray_f_c_6d( struct ndarray *arrays[], void *fcn ) {
   1075 	typedef float func_type( const float x );
   1076 	func_type *f = (func_type *)fcn;
   1077 	STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( float, float complex )
   1078 	return 0;
   1079 }
   1080 
   1081 /**
   1082 * Applies a unary callback accepting and returning single-precision floating-point numbers to a six-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a six-dimensional single-precision complex floating-point output ndarray.
   1083 *
   1084 * ## Notes
   1085 *
   1086 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1087 *
   1088 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1089 * @param fcn      callback
   1090 * @return         status code
   1091 *
   1092 * @example
   1093 * #include "stdlib/ndarray/base/unary/f_c.h"
   1094 * #include "stdlib/ndarray/dtypes.h"
   1095 * #include "stdlib/ndarray/index_modes.h"
   1096 * #include "stdlib/ndarray/orders.h"
   1097 * #include "stdlib/ndarray/ctor.h"
   1098 * #include <stdint.h>
   1099 * #include <stdlib.h>
   1100 * #include <stdio.h>
   1101 *
   1102 * // Define the ndarray data types:
   1103 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1104 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1105 *
   1106 * // Create underlying byte arrays:
   1107 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1108 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1109 *
   1110 * // Define the number of dimensions:
   1111 * int64_t ndims = 6;
   1112 *
   1113 * // Define the array shapes:
   1114 * int64_t shape[] = { 1, 1, 1, 2, 2, 2 };
   1115 *
   1116 * // Define the strides:
   1117 * int64_t sx[] = { 16, 16, 16, 16, 8, 4 };
   1118 * int64_t sy[] = { 32, 32, 32, 32, 16, 8 };
   1119 *
   1120 * // Define the offsets:
   1121 * int64_t ox = 0;
   1122 * int64_t oy = 0;
   1123 *
   1124 * // Define the array order:
   1125 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1126 *
   1127 * // Specify the index mode:
   1128 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1129 *
   1130 * // Specify the subscript index modes:
   1131 * int8_t submodes[] = { imode };
   1132 * int64_t nsubmodes = 1;
   1133 *
   1134 * // Create an input ndarray:
   1135 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1136 * if ( x == NULL ) {
   1137 *     fprintf( stderr, "Error allocating memory.\n" );
   1138 *     exit( EXIT_FAILURE );
   1139 * }
   1140 *
   1141 * // Create an output ndarray:
   1142 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1143 * if ( y == NULL ) {
   1144 *     fprintf( stderr, "Error allocating memory.\n" );
   1145 *     exit( EXIT_FAILURE );
   1146 * }
   1147 *
   1148 * // Create an array containing the ndarrays:
   1149 * struct ndarray *arrays[] = { x, y };
   1150 *
   1151 * // Define a callback:
   1152 * float scale( const float x ) {
   1153 *     return x + 10.0f;
   1154 * }
   1155 *
   1156 * // Apply the callback:
   1157 * int8_t status = stdlib_ndarray_f_c_6d_blocked( arrays, (void *)scale );
   1158 * if ( status != 0 ) {
   1159 *     fprintf( stderr, "Error during computation.\n" );
   1160 *     exit( EXIT_FAILURE );
   1161 * }
   1162 *
   1163 * // ...
   1164 *
   1165 * // Free allocated memory:
   1166 * stdlib_ndarray_free( x );
   1167 * stdlib_ndarray_free( y );
   1168 */
   1169 int8_t stdlib_ndarray_f_c_6d_blocked( struct ndarray *arrays[], void *fcn ) {
   1170 	typedef float func_type( const float x );
   1171 	func_type *f = (func_type *)fcn;
   1172 	STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( float, float complex )
   1173 	return 0;
   1174 }
   1175 
   1176 /**
   1177 * Applies a unary callback accepting and returning single-precision floating-point numbers to a seven-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a seven-dimensional single-precision complex floating-point output ndarray.
   1178 *
   1179 * ## Notes
   1180 *
   1181 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1182 *
   1183 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1184 * @param fcn      callback
   1185 * @return         status code
   1186 *
   1187 * @example
   1188 * #include "stdlib/ndarray/base/unary/f_c.h"
   1189 * #include "stdlib/ndarray/dtypes.h"
   1190 * #include "stdlib/ndarray/index_modes.h"
   1191 * #include "stdlib/ndarray/orders.h"
   1192 * #include "stdlib/ndarray/ctor.h"
   1193 * #include <stdint.h>
   1194 * #include <stdlib.h>
   1195 * #include <stdio.h>
   1196 *
   1197 * // Define the ndarray data types:
   1198 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1199 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1200 *
   1201 * // Create underlying byte arrays:
   1202 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1203 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1204 *
   1205 * // Define the number of dimensions:
   1206 * int64_t ndims = 7;
   1207 *
   1208 * // Define the array shapes:
   1209 * int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 };
   1210 *
   1211 * // Define the strides:
   1212 * int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4 };
   1213 * int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8 };
   1214 *
   1215 * // Define the offsets:
   1216 * int64_t ox = 0;
   1217 * int64_t oy = 0;
   1218 *
   1219 * // Define the array order:
   1220 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1221 *
   1222 * // Specify the index mode:
   1223 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1224 *
   1225 * // Specify the subscript index modes:
   1226 * int8_t submodes[] = { imode };
   1227 * int64_t nsubmodes = 1;
   1228 *
   1229 * // Create an input ndarray:
   1230 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1231 * if ( x == NULL ) {
   1232 *     fprintf( stderr, "Error allocating memory.\n" );
   1233 *     exit( EXIT_FAILURE );
   1234 * }
   1235 *
   1236 * // Create an output ndarray:
   1237 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1238 * if ( y == NULL ) {
   1239 *     fprintf( stderr, "Error allocating memory.\n" );
   1240 *     exit( EXIT_FAILURE );
   1241 * }
   1242 *
   1243 * // Create an array containing the ndarrays:
   1244 * struct ndarray *arrays[] = { x, y };
   1245 *
   1246 * // Define a callback:
   1247 * float scale( const float x ) {
   1248 *     return x + 10.0f;
   1249 * }
   1250 *
   1251 * // Apply the callback:
   1252 * int8_t status = stdlib_ndarray_f_c_7d( arrays, (void *)scale );
   1253 * if ( status != 0 ) {
   1254 *     fprintf( stderr, "Error during computation.\n" );
   1255 *     exit( EXIT_FAILURE );
   1256 * }
   1257 *
   1258 * // ...
   1259 *
   1260 * // Free allocated memory:
   1261 * stdlib_ndarray_free( x );
   1262 * stdlib_ndarray_free( y );
   1263 */
   1264 int8_t stdlib_ndarray_f_c_7d( struct ndarray *arrays[], void *fcn ) {
   1265 	typedef float func_type( const float x );
   1266 	func_type *f = (func_type *)fcn;
   1267 	STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( float, float complex )
   1268 	return 0;
   1269 }
   1270 
   1271 /**
   1272 * Applies a unary callback accepting and returning single-precision floating-point numbers to a seven-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a seven-dimensional single-precision complex floating-point output ndarray.
   1273 *
   1274 * ## Notes
   1275 *
   1276 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1277 *
   1278 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1279 * @param fcn      callback
   1280 * @return         status code
   1281 *
   1282 * @example
   1283 * #include "stdlib/ndarray/base/unary/f_c.h"
   1284 * #include "stdlib/ndarray/dtypes.h"
   1285 * #include "stdlib/ndarray/index_modes.h"
   1286 * #include "stdlib/ndarray/orders.h"
   1287 * #include "stdlib/ndarray/ctor.h"
   1288 * #include <stdint.h>
   1289 * #include <stdlib.h>
   1290 * #include <stdio.h>
   1291 *
   1292 * // Define the ndarray data types:
   1293 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1294 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1295 *
   1296 * // Create underlying byte arrays:
   1297 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1298 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1299 *
   1300 * // Define the number of dimensions:
   1301 * int64_t ndims = 7;
   1302 *
   1303 * // Define the array shapes:
   1304 * int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 };
   1305 *
   1306 * // Define the strides:
   1307 * int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4 };
   1308 * int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8 };
   1309 *
   1310 * // Define the offsets:
   1311 * int64_t ox = 0;
   1312 * int64_t oy = 0;
   1313 *
   1314 * // Define the array order:
   1315 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1316 *
   1317 * // Specify the index mode:
   1318 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1319 *
   1320 * // Specify the subscript index modes:
   1321 * int8_t submodes[] = { imode };
   1322 * int64_t nsubmodes = 1;
   1323 *
   1324 * // Create an input ndarray:
   1325 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1326 * if ( x == NULL ) {
   1327 *     fprintf( stderr, "Error allocating memory.\n" );
   1328 *     exit( EXIT_FAILURE );
   1329 * }
   1330 *
   1331 * // Create an output ndarray:
   1332 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1333 * if ( y == NULL ) {
   1334 *     fprintf( stderr, "Error allocating memory.\n" );
   1335 *     exit( EXIT_FAILURE );
   1336 * }
   1337 *
   1338 * // Create an array containing the ndarrays:
   1339 * struct ndarray *arrays[] = { x, y };
   1340 *
   1341 * // Define a callback:
   1342 * float scale( const float x ) {
   1343 *     return x + 10.0f;
   1344 * }
   1345 *
   1346 * // Apply the callback:
   1347 * int8_t status = stdlib_ndarray_f_c_7d_blocked( arrays, (void *)scale );
   1348 * if ( status != 0 ) {
   1349 *     fprintf( stderr, "Error during computation.\n" );
   1350 *     exit( EXIT_FAILURE );
   1351 * }
   1352 *
   1353 * // ...
   1354 *
   1355 * // Free allocated memory:
   1356 * stdlib_ndarray_free( x );
   1357 * stdlib_ndarray_free( y );
   1358 */
   1359 int8_t stdlib_ndarray_f_c_7d_blocked( struct ndarray *arrays[], void *fcn ) {
   1360 	typedef float func_type( const float x );
   1361 	func_type *f = (func_type *)fcn;
   1362 	STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( float, float complex )
   1363 	return 0;
   1364 }
   1365 
   1366 /**
   1367 * Applies a unary callback accepting and returning single-precision floating-point numbers to an eight-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in an eight-dimensional single-precision complex floating-point output ndarray.
   1368 *
   1369 * ## Notes
   1370 *
   1371 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1372 *
   1373 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1374 * @param fcn      callback
   1375 * @return         status code
   1376 *
   1377 * @example
   1378 * #include "stdlib/ndarray/base/unary/f_c.h"
   1379 * #include "stdlib/ndarray/dtypes.h"
   1380 * #include "stdlib/ndarray/index_modes.h"
   1381 * #include "stdlib/ndarray/orders.h"
   1382 * #include "stdlib/ndarray/ctor.h"
   1383 * #include <stdint.h>
   1384 * #include <stdlib.h>
   1385 * #include <stdio.h>
   1386 *
   1387 * // Define the ndarray data types:
   1388 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1389 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1390 *
   1391 * // Create underlying byte arrays:
   1392 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1393 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1394 *
   1395 * // Define the number of dimensions:
   1396 * int64_t ndims = 8;
   1397 *
   1398 * // Define the array shapes:
   1399 * int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 };
   1400 *
   1401 * // Define the strides:
   1402 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4 };
   1403 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8 };
   1404 *
   1405 * // Define the offsets:
   1406 * int64_t ox = 0;
   1407 * int64_t oy = 0;
   1408 *
   1409 * // Define the array order:
   1410 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1411 *
   1412 * // Specify the index mode:
   1413 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1414 *
   1415 * // Specify the subscript index modes:
   1416 * int8_t submodes[] = { imode };
   1417 * int64_t nsubmodes = 1;
   1418 *
   1419 * // Create an input ndarray:
   1420 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1421 * if ( x == NULL ) {
   1422 *     fprintf( stderr, "Error allocating memory.\n" );
   1423 *     exit( EXIT_FAILURE );
   1424 * }
   1425 *
   1426 * // Create an output ndarray:
   1427 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1428 * if ( y == NULL ) {
   1429 *     fprintf( stderr, "Error allocating memory.\n" );
   1430 *     exit( EXIT_FAILURE );
   1431 * }
   1432 *
   1433 * // Create an array containing the ndarrays:
   1434 * struct ndarray *arrays[] = { x, y };
   1435 *
   1436 * // Define a callback:
   1437 * float scale( const float x ) {
   1438 *     return x + 10.0f;
   1439 * }
   1440 *
   1441 * // Apply the callback:
   1442 * int8_t status = stdlib_ndarray_f_c_8d( arrays, (void *)scale );
   1443 * if ( status != 0 ) {
   1444 *     fprintf( stderr, "Error during computation.\n" );
   1445 *     exit( EXIT_FAILURE );
   1446 * }
   1447 *
   1448 * // ...
   1449 *
   1450 * // Free allocated memory:
   1451 * stdlib_ndarray_free( x );
   1452 * stdlib_ndarray_free( y );
   1453 */
   1454 int8_t stdlib_ndarray_f_c_8d( struct ndarray *arrays[], void *fcn ) {
   1455 	typedef float func_type( const float x );
   1456 	func_type *f = (func_type *)fcn;
   1457 	STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( float, float complex )
   1458 	return 0;
   1459 }
   1460 
   1461 /**
   1462 * Applies a unary callback accepting and returning single-precision floating-point numbers to an eight-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in an eight-dimensional single-precision complex floating-point output ndarray.
   1463 *
   1464 * ## Notes
   1465 *
   1466 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1467 *
   1468 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1469 * @param fcn      callback
   1470 * @return         status code
   1471 *
   1472 * @example
   1473 * #include "stdlib/ndarray/base/unary/f_c.h"
   1474 * #include "stdlib/ndarray/dtypes.h"
   1475 * #include "stdlib/ndarray/index_modes.h"
   1476 * #include "stdlib/ndarray/orders.h"
   1477 * #include "stdlib/ndarray/ctor.h"
   1478 * #include <stdint.h>
   1479 * #include <stdlib.h>
   1480 * #include <stdio.h>
   1481 *
   1482 * // Define the ndarray data types:
   1483 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1484 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1485 *
   1486 * // Create underlying byte arrays:
   1487 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1488 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1489 *
   1490 * // Define the number of dimensions:
   1491 * int64_t ndims = 8;
   1492 *
   1493 * // Define the array shapes:
   1494 * int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 };
   1495 *
   1496 * // Define the strides:
   1497 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4 };
   1498 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8 };
   1499 *
   1500 * // Define the offsets:
   1501 * int64_t ox = 0;
   1502 * int64_t oy = 0;
   1503 *
   1504 * // Define the array order:
   1505 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1506 *
   1507 * // Specify the index mode:
   1508 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1509 *
   1510 * // Specify the subscript index modes:
   1511 * int8_t submodes[] = { imode };
   1512 * int64_t nsubmodes = 1;
   1513 *
   1514 * // Create an input ndarray:
   1515 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1516 * if ( x == NULL ) {
   1517 *     fprintf( stderr, "Error allocating memory.\n" );
   1518 *     exit( EXIT_FAILURE );
   1519 * }
   1520 *
   1521 * // Create an output ndarray:
   1522 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1523 * if ( y == NULL ) {
   1524 *     fprintf( stderr, "Error allocating memory.\n" );
   1525 *     exit( EXIT_FAILURE );
   1526 * }
   1527 *
   1528 * // Create an array containing the ndarrays:
   1529 * struct ndarray *arrays[] = { x, y };
   1530 *
   1531 * // Define a callback:
   1532 * float scale( const float x ) {
   1533 *     return x + 10.0f;
   1534 * }
   1535 *
   1536 * // Apply the callback:
   1537 * int8_t status = stdlib_ndarray_f_c_8d_blocked( arrays, (void *)scale );
   1538 * if ( status != 0 ) {
   1539 *     fprintf( stderr, "Error during computation.\n" );
   1540 *     exit( EXIT_FAILURE );
   1541 * }
   1542 *
   1543 * // ...
   1544 *
   1545 * // Free allocated memory:
   1546 * stdlib_ndarray_free( x );
   1547 * stdlib_ndarray_free( y );
   1548 */
   1549 int8_t stdlib_ndarray_f_c_8d_blocked( struct ndarray *arrays[], void *fcn ) {
   1550 	typedef float func_type( const float x );
   1551 	func_type *f = (func_type *)fcn;
   1552 	STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( float, float complex )
   1553 	return 0;
   1554 }
   1555 
   1556 /**
   1557 * Applies a unary callback accepting and returning single-precision floating-point numbers to a nine-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a nine-dimensional single-precision complex floating-point output ndarray.
   1558 *
   1559 * ## Notes
   1560 *
   1561 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1562 *
   1563 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1564 * @param fcn      callback
   1565 * @return         status code
   1566 *
   1567 * @example
   1568 * #include "stdlib/ndarray/base/unary/f_c.h"
   1569 * #include "stdlib/ndarray/dtypes.h"
   1570 * #include "stdlib/ndarray/index_modes.h"
   1571 * #include "stdlib/ndarray/orders.h"
   1572 * #include "stdlib/ndarray/ctor.h"
   1573 * #include <stdint.h>
   1574 * #include <stdlib.h>
   1575 * #include <stdio.h>
   1576 *
   1577 * // Define the ndarray data types:
   1578 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1579 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1580 *
   1581 * // Create underlying byte arrays:
   1582 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1583 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1584 *
   1585 * // Define the number of dimensions:
   1586 * int64_t ndims = 9;
   1587 *
   1588 * // Define the array shapes:
   1589 * int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 };
   1590 *
   1591 * // Define the strides:
   1592 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4 };
   1593 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8 };
   1594 *
   1595 * // Define the offsets:
   1596 * int64_t ox = 0;
   1597 * int64_t oy = 0;
   1598 *
   1599 * // Define the array order:
   1600 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1601 *
   1602 * // Specify the index mode:
   1603 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1604 *
   1605 * // Specify the subscript index modes:
   1606 * int8_t submodes[] = { imode };
   1607 * int64_t nsubmodes = 1;
   1608 *
   1609 * // Create an input ndarray:
   1610 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1611 * if ( x == NULL ) {
   1612 *     fprintf( stderr, "Error allocating memory.\n" );
   1613 *     exit( EXIT_FAILURE );
   1614 * }
   1615 *
   1616 * // Create an output ndarray:
   1617 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1618 * if ( y == NULL ) {
   1619 *     fprintf( stderr, "Error allocating memory.\n" );
   1620 *     exit( EXIT_FAILURE );
   1621 * }
   1622 *
   1623 * // Create an array containing the ndarrays:
   1624 * struct ndarray *arrays[] = { x, y };
   1625 *
   1626 * // Define a callback:
   1627 * float scale( const float x ) {
   1628 *     return x + 10.0f;
   1629 * }
   1630 *
   1631 * // Apply the callback:
   1632 * int8_t status = stdlib_ndarray_f_c_9d( arrays, (void *)scale );
   1633 * if ( status != 0 ) {
   1634 *     fprintf( stderr, "Error during computation.\n" );
   1635 *     exit( EXIT_FAILURE );
   1636 * }
   1637 *
   1638 * // ...
   1639 *
   1640 * // Free allocated memory:
   1641 * stdlib_ndarray_free( x );
   1642 * stdlib_ndarray_free( y );
   1643 */
   1644 int8_t stdlib_ndarray_f_c_9d( struct ndarray *arrays[], void *fcn ) {
   1645 	typedef float func_type( const float x );
   1646 	func_type *f = (func_type *)fcn;
   1647 	STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( float, float complex )
   1648 	return 0;
   1649 }
   1650 
   1651 /**
   1652 * Applies a unary callback accepting and returning single-precision floating-point numbers to a nine-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a nine-dimensional single-precision complex floating-point output ndarray.
   1653 *
   1654 * ## Notes
   1655 *
   1656 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1657 *
   1658 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1659 * @param fcn      callback
   1660 * @return         status code
   1661 *
   1662 * @example
   1663 * #include "stdlib/ndarray/base/unary/f_c.h"
   1664 * #include "stdlib/ndarray/dtypes.h"
   1665 * #include "stdlib/ndarray/index_modes.h"
   1666 * #include "stdlib/ndarray/orders.h"
   1667 * #include "stdlib/ndarray/ctor.h"
   1668 * #include <stdint.h>
   1669 * #include <stdlib.h>
   1670 * #include <stdio.h>
   1671 *
   1672 * // Define the ndarray data types:
   1673 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1674 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1675 *
   1676 * // Create underlying byte arrays:
   1677 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1678 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1679 *
   1680 * // Define the number of dimensions:
   1681 * int64_t ndims = 9;
   1682 *
   1683 * // Define the array shapes:
   1684 * int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 };
   1685 *
   1686 * // Define the strides:
   1687 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4 };
   1688 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8 };
   1689 *
   1690 * // Define the offsets:
   1691 * int64_t ox = 0;
   1692 * int64_t oy = 0;
   1693 *
   1694 * // Define the array order:
   1695 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1696 *
   1697 * // Specify the index mode:
   1698 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1699 *
   1700 * // Specify the subscript index modes:
   1701 * int8_t submodes[] = { imode };
   1702 * int64_t nsubmodes = 1;
   1703 *
   1704 * // Create an input ndarray:
   1705 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1706 * if ( x == NULL ) {
   1707 *     fprintf( stderr, "Error allocating memory.\n" );
   1708 *     exit( EXIT_FAILURE );
   1709 * }
   1710 *
   1711 * // Create an output ndarray:
   1712 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1713 * if ( y == NULL ) {
   1714 *     fprintf( stderr, "Error allocating memory.\n" );
   1715 *     exit( EXIT_FAILURE );
   1716 * }
   1717 *
   1718 * // Create an array containing the ndarrays:
   1719 * struct ndarray *arrays[] = { x, y };
   1720 *
   1721 * // Define a callback:
   1722 * float scale( const float x ) {
   1723 *     return x + 10.0f;
   1724 * }
   1725 *
   1726 * // Apply the callback:
   1727 * int8_t status = stdlib_ndarray_f_c_9d_blocked( arrays, (void *)scale );
   1728 * if ( status != 0 ) {
   1729 *     fprintf( stderr, "Error during computation.\n" );
   1730 *     exit( EXIT_FAILURE );
   1731 * }
   1732 *
   1733 * // ...
   1734 *
   1735 * // Free allocated memory:
   1736 * stdlib_ndarray_free( x );
   1737 * stdlib_ndarray_free( y );
   1738 */
   1739 int8_t stdlib_ndarray_f_c_9d_blocked( struct ndarray *arrays[], void *fcn ) {
   1740 	typedef float func_type( const float x );
   1741 	func_type *f = (func_type *)fcn;
   1742 	STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( float, float complex )
   1743 	return 0;
   1744 }
   1745 
   1746 /**
   1747 * Applies a unary callback accepting and returning single-precision floating-point numbers to a ten-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a ten-dimensional single-precision complex floating-point output ndarray.
   1748 *
   1749 * ## Notes
   1750 *
   1751 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1752 *
   1753 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1754 * @param fcn      callback
   1755 * @return         status code
   1756 *
   1757 * @example
   1758 * #include "stdlib/ndarray/base/unary/f_c.h"
   1759 * #include "stdlib/ndarray/dtypes.h"
   1760 * #include "stdlib/ndarray/index_modes.h"
   1761 * #include "stdlib/ndarray/orders.h"
   1762 * #include "stdlib/ndarray/ctor.h"
   1763 * #include <stdint.h>
   1764 * #include <stdlib.h>
   1765 * #include <stdio.h>
   1766 *
   1767 * // Define the ndarray data types:
   1768 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1769 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1770 *
   1771 * // Create underlying byte arrays:
   1772 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1773 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1774 *
   1775 * // Define the number of dimensions:
   1776 * int64_t ndims = 10;
   1777 *
   1778 * // Define the array shapes:
   1779 * int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 };
   1780 *
   1781 * // Define the strides:
   1782 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 16, 8, 4 };
   1783 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 32, 16, 8 };
   1784 *
   1785 * // Define the offsets:
   1786 * int64_t ox = 0;
   1787 * int64_t oy = 0;
   1788 *
   1789 * // Define the array order:
   1790 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1791 *
   1792 * // Specify the index mode:
   1793 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1794 *
   1795 * // Specify the subscript index modes:
   1796 * int8_t submodes[] = { imode };
   1797 * int64_t nsubmodes = 1;
   1798 *
   1799 * // Create an input ndarray:
   1800 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1801 * if ( x == NULL ) {
   1802 *     fprintf( stderr, "Error allocating memory.\n" );
   1803 *     exit( EXIT_FAILURE );
   1804 * }
   1805 *
   1806 * // Create an output ndarray:
   1807 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1808 * if ( y == NULL ) {
   1809 *     fprintf( stderr, "Error allocating memory.\n" );
   1810 *     exit( EXIT_FAILURE );
   1811 * }
   1812 *
   1813 * // Create an array containing the ndarrays:
   1814 * struct ndarray *arrays[] = { x, y };
   1815 *
   1816 * // Define a callback:
   1817 * float scale( const float x ) {
   1818 *     return x + 10.0f;
   1819 * }
   1820 *
   1821 * // Apply the callback:
   1822 * int8_t status = stdlib_ndarray_f_c_10d( arrays, (void *)scale );
   1823 * if ( status != 0 ) {
   1824 *     fprintf( stderr, "Error during computation.\n" );
   1825 *     exit( EXIT_FAILURE );
   1826 * }
   1827 *
   1828 * // ...
   1829 *
   1830 * // Free allocated memory:
   1831 * stdlib_ndarray_free( x );
   1832 * stdlib_ndarray_free( y );
   1833 */
   1834 int8_t stdlib_ndarray_f_c_10d( struct ndarray *arrays[], void *fcn ) {
   1835 	typedef float func_type( const float x );
   1836 	func_type *f = (func_type *)fcn;
   1837 	STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( float, float complex )
   1838 	return 0;
   1839 }
   1840 
   1841 /**
   1842 * Applies a unary callback accepting and returning single-precision floating-point numbers to a ten-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a ten-dimensional single-precision complex floating-point output ndarray.
   1843 *
   1844 * ## Notes
   1845 *
   1846 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1847 *
   1848 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1849 * @param fcn      callback
   1850 * @return         status code
   1851 *
   1852 * @example
   1853 * #include "stdlib/ndarray/base/unary/f_c.h"
   1854 * #include "stdlib/ndarray/dtypes.h"
   1855 * #include "stdlib/ndarray/index_modes.h"
   1856 * #include "stdlib/ndarray/orders.h"
   1857 * #include "stdlib/ndarray/ctor.h"
   1858 * #include <stdint.h>
   1859 * #include <stdlib.h>
   1860 * #include <stdio.h>
   1861 *
   1862 * // Define the ndarray data types:
   1863 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1864 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1865 *
   1866 * // Create underlying byte arrays:
   1867 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1868 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1869 *
   1870 * // Define the number of dimensions:
   1871 * int64_t ndims = 10;
   1872 *
   1873 * // Define the array shapes:
   1874 * int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 };
   1875 *
   1876 * // Define the strides:
   1877 * int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 16, 8, 4 };
   1878 * int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 32, 16, 8 };
   1879 *
   1880 * // Define the offsets:
   1881 * int64_t ox = 0;
   1882 * int64_t oy = 0;
   1883 *
   1884 * // Define the array order:
   1885 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1886 *
   1887 * // Specify the index mode:
   1888 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1889 *
   1890 * // Specify the subscript index modes:
   1891 * int8_t submodes[] = { imode };
   1892 * int64_t nsubmodes = 1;
   1893 *
   1894 * // Create an input ndarray:
   1895 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1896 * if ( x == NULL ) {
   1897 *     fprintf( stderr, "Error allocating memory.\n" );
   1898 *     exit( EXIT_FAILURE );
   1899 * }
   1900 *
   1901 * // Create an output ndarray:
   1902 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1903 * if ( y == NULL ) {
   1904 *     fprintf( stderr, "Error allocating memory.\n" );
   1905 *     exit( EXIT_FAILURE );
   1906 * }
   1907 *
   1908 * // Create an array containing the ndarrays:
   1909 * struct ndarray *arrays[] = { x, y };
   1910 *
   1911 * // Define a callback:
   1912 * float scale( const float x ) {
   1913 *     return x + 10.0f;
   1914 * }
   1915 *
   1916 * // Apply the callback:
   1917 * int8_t status = stdlib_ndarray_f_c_10d_blocked( arrays, (void *)scale );
   1918 * if ( status != 0 ) {
   1919 *     fprintf( stderr, "Error during computation.\n" );
   1920 *     exit( EXIT_FAILURE );
   1921 * }
   1922 *
   1923 * // ...
   1924 *
   1925 * // Free allocated memory:
   1926 * stdlib_ndarray_free( x );
   1927 * stdlib_ndarray_free( y );
   1928 */
   1929 int8_t stdlib_ndarray_f_c_10d_blocked( struct ndarray *arrays[], void *fcn ) {
   1930 	typedef float func_type( const float x );
   1931 	func_type *f = (func_type *)fcn;
   1932 	STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( float, float complex )
   1933 	return 0;
   1934 }
   1935 
   1936 /**
   1937 * Applies a unary callback accepting and returning single-precision floating-point numbers to an n-dimensional single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in an n-dimensional single-precision complex floating-point output ndarray.
   1938 *
   1939 * ## Notes
   1940 *
   1941 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   1942 *
   1943 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   1944 * @param fcn      callback
   1945 * @return         status code
   1946 *
   1947 * @example
   1948 * #include "stdlib/ndarray/base/unary/f_c.h"
   1949 * #include "stdlib/ndarray/dtypes.h"
   1950 * #include "stdlib/ndarray/index_modes.h"
   1951 * #include "stdlib/ndarray/orders.h"
   1952 * #include "stdlib/ndarray/ctor.h"
   1953 * #include <stdint.h>
   1954 * #include <stdlib.h>
   1955 * #include <stdio.h>
   1956 *
   1957 * // Define the ndarray data types:
   1958 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   1959 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   1960 *
   1961 * // Create underlying byte arrays:
   1962 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1963 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   1964 *
   1965 * // Define the number of dimensions:
   1966 * int64_t ndims = 3;
   1967 *
   1968 * // Define the array shapes:
   1969 * int64_t shape[] = { 2, 2, 2 };
   1970 *
   1971 * // Define the strides:
   1972 * int64_t sx[] = { 16, 8, 4 };
   1973 * int64_t sy[] = { 32, 16, 8 };
   1974 *
   1975 * // Define the offsets:
   1976 * int64_t ox = 0;
   1977 * int64_t oy = 0;
   1978 *
   1979 * // Define the array order:
   1980 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   1981 *
   1982 * // Specify the index mode:
   1983 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   1984 *
   1985 * // Specify the subscript index modes:
   1986 * int8_t submodes[] = { imode };
   1987 * int64_t nsubmodes = 1;
   1988 *
   1989 * // Create an input ndarray:
   1990 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   1991 * if ( x == NULL ) {
   1992 *     fprintf( stderr, "Error allocating memory.\n" );
   1993 *     exit( EXIT_FAILURE );
   1994 * }
   1995 *
   1996 * // Create an output ndarray:
   1997 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   1998 * if ( y == NULL ) {
   1999 *     fprintf( stderr, "Error allocating memory.\n" );
   2000 *     exit( EXIT_FAILURE );
   2001 * }
   2002 *
   2003 * // Create an array containing the ndarrays:
   2004 * struct ndarray *arrays[] = { x, y };
   2005 *
   2006 * // Define a callback:
   2007 * float scale( const float x ) {
   2008 *     return x + 10.0f;
   2009 * }
   2010 *
   2011 * // Apply the callback:
   2012 * int8_t status = stdlib_ndarray_f_c_nd( arrays, (void *)scale );
   2013 * if ( status != 0 ) {
   2014 *     fprintf( stderr, "Error during computation.\n" );
   2015 *     exit( EXIT_FAILURE );
   2016 * }
   2017 *
   2018 * // ...
   2019 *
   2020 * // Free allocated memory:
   2021 * stdlib_ndarray_free( x );
   2022 * stdlib_ndarray_free( y );
   2023 */
   2024 int8_t stdlib_ndarray_f_c_nd( struct ndarray *arrays[], void *fcn ) {
   2025 	typedef float func_type( const float x );
   2026 	func_type *f = (func_type *)fcn;
   2027 	STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( float, float complex )
   2028 	return 0;
   2029 }
   2030 
   2031 // Define a list of unary ndarray functions:
   2032 static ndarrayUnaryFcn functions[] = {
   2033 	stdlib_ndarray_f_c_0d,
   2034 	stdlib_ndarray_f_c_1d,
   2035 	stdlib_ndarray_f_c_2d,
   2036 	stdlib_ndarray_f_c_3d,
   2037 	stdlib_ndarray_f_c_4d,
   2038 	stdlib_ndarray_f_c_5d,
   2039 	stdlib_ndarray_f_c_6d,
   2040 	stdlib_ndarray_f_c_7d,
   2041 	stdlib_ndarray_f_c_8d,
   2042 	stdlib_ndarray_f_c_9d,
   2043 	stdlib_ndarray_f_c_10d,
   2044 	stdlib_ndarray_f_c_nd
   2045 };
   2046 
   2047 // Define a list of unary ndarray functions implementing loop blocking...
   2048 static ndarrayUnaryFcn blocked_functions[] = {
   2049 	stdlib_ndarray_f_c_2d_blocked,
   2050 	stdlib_ndarray_f_c_3d_blocked,
   2051 	stdlib_ndarray_f_c_4d_blocked,
   2052 	stdlib_ndarray_f_c_5d_blocked,
   2053 	stdlib_ndarray_f_c_6d_blocked,
   2054 	stdlib_ndarray_f_c_7d_blocked,
   2055 	stdlib_ndarray_f_c_8d_blocked,
   2056 	stdlib_ndarray_f_c_9d_blocked,
   2057 	stdlib_ndarray_f_c_10d_blocked
   2058 };
   2059 
   2060 // Create a unary function dispatch object:
   2061 static const struct ndarrayUnaryDispatchObject obj = {
   2062 	// Array containing unary ndarray functions:
   2063 	functions,
   2064 
   2065 	// Number of unary ndarray functions:
   2066 	12,
   2067 
   2068 	// Array containing unary ndarray functions using loop blocking:
   2069 	blocked_functions,
   2070 
   2071 	// Number of unary ndarray functions using loop blocking:
   2072 	9
   2073 };
   2074 
   2075 /**
   2076 * Applies a unary callback accepting and returning single-precision floating-point numbers to a single-precision floating-point input ndarray, casts the callback's single-precision floating-point return value to a single-precision complex floating-point number, and assigns results to elements in a single-precision complex floating-point output ndarray.
   2077 *
   2078 * ## Notes
   2079 *
   2080 * -   If successful, the functions returns `0`; otherwise, the function returns an error code.
   2081 *
   2082 * @param arrays   array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray
   2083 * @param fcn      callback
   2084 * @return         status code
   2085 *
   2086 * @example
   2087 * #include "stdlib/ndarray/base/unary/f_c.h"
   2088 * #include "stdlib/ndarray/dtypes.h"
   2089 * #include "stdlib/ndarray/index_modes.h"
   2090 * #include "stdlib/ndarray/orders.h"
   2091 * #include "stdlib/ndarray/ctor.h"
   2092 * #include <stdint.h>
   2093 * #include <stdlib.h>
   2094 * #include <stdio.h>
   2095 *
   2096 * // Define the ndarray data types:
   2097 * enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32;
   2098 * enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64;
   2099 *
   2100 * // Create underlying byte arrays:
   2101 * uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   2102 * uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
   2103 *
   2104 * // Define the number of dimensions:
   2105 * int64_t ndims = 2;
   2106 *
   2107 * // Define the array shapes:
   2108 * int64_t shape[] = { 2, 2 };
   2109 *
   2110 * // Define the strides:
   2111 * int64_t sx[] = { 8, 4 };
   2112 * int64_t sy[] = { 16, 8 };
   2113 *
   2114 * // Define the offsets:
   2115 * int64_t ox = 0;
   2116 * int64_t oy = 0;
   2117 *
   2118 * // Define the array order:
   2119 * enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
   2120 *
   2121 * // Specify the index mode:
   2122 * enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
   2123 *
   2124 * // Specify the subscript index modes:
   2125 * int8_t submodes[] = { imode };
   2126 * int64_t nsubmodes = 1;
   2127 *
   2128 * // Create an input ndarray:
   2129 * struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes );
   2130 * if ( x == NULL ) {
   2131 *     fprintf( stderr, "Error allocating memory.\n" );
   2132 *     exit( EXIT_FAILURE );
   2133 * }
   2134 *
   2135 * // Create an output ndarray:
   2136 * struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes );
   2137 * if ( y == NULL ) {
   2138 *     fprintf( stderr, "Error allocating memory.\n" );
   2139 *     exit( EXIT_FAILURE );
   2140 * }
   2141 *
   2142 * // Create an array containing the ndarrays:
   2143 * struct ndarray *arrays[] = { x, y };
   2144 *
   2145 * // Define a callback:
   2146 * float scale( const float x ) {
   2147 *     return x + 10.0f;
   2148 * }
   2149 *
   2150 * // Apply the callback:
   2151 * int8_t status = stdlib_ndarray_f_c( arrays, (void *)scale );
   2152 * if ( status != 0 ) {
   2153 *     fprintf( stderr, "Error during computation.\n" );
   2154 *     exit( EXIT_FAILURE );
   2155 * }
   2156 *
   2157 * // ...
   2158 *
   2159 * // Free allocated memory:
   2160 * stdlib_ndarray_free( x );
   2161 * stdlib_ndarray_free( y );
   2162 */
   2163 int8_t stdlib_ndarray_f_c( struct ndarray *arrays[], void *fcn ) {
   2164 	return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn );
   2165 }