From 9db7165d12b9a0ef302907f4c781dbca42e70642 Mon Sep 17 00:00:00 2001 From: yb175 Date: Sun, 11 Oct 2026 13:11:32 +0000 Subject: [PATCH 1/9] feat: add C implementation for blas/ext/base/ndarray/ztril --- .../blas/ext/base/ndarray/ztril/README.md | 168 ++++++++++++ .../ztril/benchmark/benchmark.native.js | 120 +++++++++ .../base/ndarray/ztril/benchmark/c/Makefile | 146 +++++++++++ .../ztril/benchmark/c/benchmark.length.c | 219 ++++++++++++++++ .../blas/ext/base/ndarray/ztril/binding.gyp | 170 ++++++++++++ .../base/ndarray/ztril/examples/c/Makefile | 146 +++++++++++ .../base/ndarray/ztril/examples/c/example.c | 85 ++++++ .../blas/ext/base/ndarray/ztril/include.gypi | 53 ++++ .../stdlib/blas/ext/base/ndarray/ztril.h | 40 +++ .../blas/ext/base/ndarray/ztril/lib/index.js | 16 +- .../blas/ext/base/ndarray/ztril/lib/native.js | 78 ++++++ .../blas/ext/base/ndarray/ztril/manifest.json | 112 ++++++++ .../blas/ext/base/ndarray/ztril/src/Makefile | 70 +++++ .../blas/ext/base/ndarray/ztril/src/addon.c | 67 +++++ .../blas/ext/base/ndarray/ztril/src/main.c | 67 +++++ .../blas/ext/base/ndarray/ztril/test/test.js | 213 ++------------- .../ext/base/ndarray/ztril/test/test.main.js | 237 +++++++++++++++++ .../base/ndarray/ztril/test/test.native.js | 246 ++++++++++++++++++ 18 files changed, 2065 insertions(+), 188 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/include/stdlib/blas/ext/base/ndarray/ztril.h create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md index e4a9aee65e50..e0be86cfa6b2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md @@ -119,6 +119,174 @@ console.log( ndarray2array( out ) ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/ndarray/ztril.h" +``` + +#### stdlib_blas_ext_ztril( arrays ) + +Copies the lower triangular part of a double-precision complex floating-point matrix `A` to another matrix `B`. + +```c +#include "stdlib/ndarray/ctor.h" +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/base/bytes_per_element.h" +#include + +// Create ndarrays: +const double dataA[] = { 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 }; +double dataB[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; +double dataK[] = { 0.0 }; +int64_t shape[] = { 2, 2 }; +int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; +int64_t kstrides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT }; +int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR }; + +struct ndarray *A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, 2, shape, strides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); +struct ndarray *B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, 2, shape, strides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); +struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)dataK, 0, NULL, kstrides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); + +// Perform computation: +const struct ndarray *arrays[] = { A, B, k }; +stdlib_blas_ext_ztril( arrays ); + +// Free allocated memory: +stdlib_ndarray_free( A ); +stdlib_ndarray_free( B ); +stdlib_ndarray_free( k ); +``` + +The function accepts the following arguments: + +- **arrays**: `[in] struct ndarray**` list containing the following ndarrays: + + - `[in] struct ndarray*` a two-dimensional input ndarray corresponding to `A`. + - `[inout] struct ndarray*` a two-dimensional output ndarray corresponding to `B`. + - `[in] struct ndarray*` a zero-dimensional float64 ndarray specifying the diagonal above which to ignore. + +```c +void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ); +``` + +
+ + + + + +
+ +- Elements outside of the copied region are left unchanged. + +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/ndarray/ztril.h" +#include "stdlib/ndarray/ctor.h" +#include "stdlib/ndarray/dtypes.h" +#include "stdlib/ndarray/index_modes.h" +#include "stdlib/ndarray/orders.h" +#include "stdlib/ndarray/base/bytes_per_element.h" +#include +#include +#include + +int main( void ) { + // Create data buffers (interleaved real and imaginary components): + const double dataA[] = { 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 }; + double dataB[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + double dataK[] = { 0.0 }; + + // Specify the number of matrix dimensions: + const int64_t ndims = 2; + + // Specify the matrix shape: + int64_t shape[] = { 2, 2 }; + + // Specify the array strides (in bytes): + int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; + int64_t kstrides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT }; + + // Specify the byte offset: + const int64_t offset = 0; + + // Specify the array order: + const enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR; + + // Specify the index mode: + const enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR; + + // Specify the subscript index modes: + int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR }; + const int64_t nsubmodes = 1; + + // Create ndarrays: + struct ndarray *A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); + struct ndarray *B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); + struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)dataK, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); + if ( A == NULL || B == NULL || k == NULL ) { + fprintf( stderr, "Error allocating memory.\n" ); + exit( 1 ); + } + + // Define a list of ndarrays: + const struct ndarray *arrays[] = { A, B, k }; + + // Copy the lower triangular part of A into B: + stdlib_blas_ext_ztril( arrays ); + + // Print the output buffer: + for ( int i = 0; i < 8; i++ ) { + printf( "dataB[ %i ] = %lf\n", i, dataB[ i ] ); + } + + // Free allocated memory: + stdlib_ndarray_free( A ); + stdlib_ndarray_free( B ); + stdlib_ndarray_free( k ); +} +``` + +
+ + + +
+ + + @@ -108,7 +108,7 @@ var B = new Complex128Matrix( discreteUniform( 5*5*2, -50, 50, opts ).buffer, 0, console.log( ndarray2array( B ) ); var k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); var out = ztril( [ A, B, k ] ); @@ -155,20 +155,31 @@ Copies the lower triangular part of a double-precision complex floating-point ma #include "stdlib/ndarray/index_modes.h" #include "stdlib/ndarray/orders.h" #include "stdlib/ndarray/base/bytes_per_element.h" +#include "stdlib/complex/float64/ctor.h" #include // Create ndarrays: -const double dataA[] = { 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 }; -double dataB[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; -double dataK[] = { 0.0 }; +const stdlib_complex128_t dataA[] = { + stdlib_complex128( 1.0, 1.0 ), + stdlib_complex128( 2.0, 2.0 ), + stdlib_complex128( 3.0, 3.0 ), + stdlib_complex128( 4.0, 4.0 ) +}; +stdlib_complex128_t dataB[] = { + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ) +}; +int32_t dataK[] = { 0 }; int64_t shape[] = { 2, 2 }; int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; -int64_t kstrides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT }; +int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR }; struct ndarray *A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, 2, shape, strides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); struct ndarray *B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, 2, shape, strides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); -struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)dataK, 0, NULL, kstrides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); +struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_INT32, (uint8_t *)dataK, 0, NULL, kstrides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); // Perform computation: const struct ndarray *arrays[] = { A, B, k }; @@ -186,7 +197,7 @@ The function accepts the following arguments: - `[in] struct ndarray*` a two-dimensional input ndarray corresponding to `A`. - `[inout] struct ndarray*` a two-dimensional output ndarray corresponding to `B`. - - `[in] struct ndarray*` a zero-dimensional float64 ndarray specifying the diagonal above which to ignore. + - `[in] struct ndarray*` a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. ```c void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ); @@ -221,15 +232,28 @@ void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ); #include "stdlib/ndarray/index_modes.h" #include "stdlib/ndarray/orders.h" #include "stdlib/ndarray/base/bytes_per_element.h" +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/complex/float64/real.h" +#include "stdlib/complex/float64/imag.h" #include #include #include int main( void ) { - // Create data buffers (interleaved real and imaginary components): - const double dataA[] = { 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 }; - double dataB[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; - double dataK[] = { 0.0 }; + // Create data buffers: + const stdlib_complex128_t dataA[] = { + stdlib_complex128( 1.0, 1.0 ), + stdlib_complex128( 2.0, 2.0 ), + stdlib_complex128( 3.0, 3.0 ), + stdlib_complex128( 4.0, 4.0 ) + }; + stdlib_complex128_t dataB[] = { + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ) + }; + int32_t dataK[] = { 0 }; // Specify the number of matrix dimensions: const int64_t ndims = 2; @@ -239,7 +263,7 @@ int main( void ) { // Specify the array strides (in bytes): int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; - int64_t kstrides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT }; + int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; // Specify the byte offset: const int64_t offset = 0; @@ -257,7 +281,7 @@ int main( void ) { // Create ndarrays: struct ndarray *A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); struct ndarray *B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); - struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)dataK, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); + struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_INT32, (uint8_t *)dataK, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); if ( A == NULL || B == NULL || k == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( 1 ); @@ -270,8 +294,8 @@ int main( void ) { stdlib_blas_ext_ztril( arrays ); // Print the output buffer: - for ( int i = 0; i < 8; i++ ) { - printf( "dataB[ %i ] = %lf\n", i, dataB[ i ] ); + for ( int i = 0; i < 4; i++ ) { + printf( "dataB[ %i ] = (%lf, %lf)\n", i, stdlib_complex128_real( dataB[ i ] ), stdlib_complex128_imag( dataB[ i ] ) ); } // Free allocated memory: diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js index 0e40549a877b..00869ced86aa 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js @@ -61,7 +61,7 @@ function createBenchmark( N ) { B = new Complex128Matrix( bbuf.buffer, 0, N, N ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); return benchmark; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js index 03472c59a5a6..de0f9214b9bf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js @@ -28,6 +28,7 @@ var Complex128Matrix = require( '@stdlib/ndarray/matrix/complex128' ); var uniform = require( '@stdlib/random/array/uniform' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -66,7 +67,7 @@ function createBenchmark( N ) { A = new Complex128Matrix( abuf.buffer, 0, N, N ); B = new Complex128Matrix( bbuf.buffer, 0, N, N ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); return benchmark; @@ -89,7 +90,10 @@ function createBenchmark( N ) { } } b.toc(); - if ( isnan( real( out.get( i%N, i%N ) ) ) ) { + if ( + isnan( real( out.get( i%N, i%N ) ) ) || + isnan( imag( out.get( i%N, i%N ) ) ) + ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c index df95a30a22ca..656047c12777 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c @@ -57,7 +57,7 @@ static void print_summary( int total, int passing ) { printf( "# total %d\n", total ); printf( "# pass %d\n", passing ); printf( "#\n" ); - printf( "# ok\n" ); + printf( "# %s\n", passing == total ? "ok" : "not ok" ); } /** @@ -103,9 +103,10 @@ static double random_uniform( const double min, const double max ) { * * @param iterations number of iterations * @param n number of matrix rows and columns +* @param passed whether the benchmark passed * @return elapsed time in seconds */ -static double benchmark( int iterations, int n ) { +static double benchmark( int iterations, int n, int *passed ) { const struct ndarray *arrays[ 3 ]; enum STDLIB_NDARRAY_INDEX_MODE imode; enum STDLIB_NDARRAY_ORDER order; @@ -120,7 +121,7 @@ static double benchmark( int iterations, int n ) { stdlib_complex128_t *dataA; stdlib_complex128_t *dataB; int64_t offset; - double kdata[ 1 ]; + int32_t kdata[ 1 ]; double elapsed; double t; int64_t ndims; @@ -132,7 +133,7 @@ static double benchmark( int iterations, int n ) { shape[ 1 ] = n; strides[ 0 ] = (int64_t)n * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT; strides[ 1 ] = STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT; - kstrides[ 0 ] = STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT; + kstrides[ 0 ] = STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT; offset = 0; order = STDLIB_NDARRAY_ROW_MAJOR; imode = STDLIB_NDARRAY_INDEX_ERROR; @@ -150,14 +151,14 @@ static double benchmark( int iterations, int n ) { dataA[ i ] = stdlib_complex128( random_uniform( -100.0, 100.0 ), random_uniform( -100.0, 100.0 ) ); dataB[ i ] = stdlib_complex128( 0.0, 0.0 ); } - kdata[ 0 ] = 0.0; + kdata[ 0 ] = 0; // cppcheck-suppress invalidPointerCast A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); // cppcheck-suppress invalidPointerCast B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); // cppcheck-suppress invalidPointerCast - k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)kdata, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); + k = stdlib_ndarray_allocate( STDLIB_NDARRAY_INT32, (uint8_t *)kdata, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); if ( A == NULL || B == NULL || k == NULL ) { fprintf( stderr, "Error allocating ndarray metadata.\n" ); exit( 1 ); @@ -166,6 +167,7 @@ static double benchmark( int iterations, int n ) { arrays[ 1 ] = B; arrays[ 2 ] = k; + *passed = 1; t = tic(); for ( i = 0; i < iterations; i++ ) { stdlib_blas_ext_ztril( arrays ); @@ -174,6 +176,7 @@ static double benchmark( int iterations, int n ) { stdlib_complex128_imag( dataB[ 0 ] ) != stdlib_complex128_imag( dataB[ 0 ] ) ) { fprintf( stderr, "should not return NaN\n" ); + *passed = 0; break; } } @@ -195,6 +198,8 @@ static double benchmark( int iterations, int n ) { int main( void ) { double elapsed; int count; + int passing; + int passed; int iter; int n; int i; @@ -203,17 +208,23 @@ int main( void ) { srand( (unsigned int)time( NULL ) ); print_version(); count = 0; + passing = 0; for ( i = MIN; i <= MAX; i++ ) { n = (int)pow( 10.0, (double)i ); iter = ITERATIONS / (int)pow( 10.0, (double)(2*(i-1)) ); for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:size=%d\n", NAME, n*n ); - elapsed = benchmark( iter, n ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); + elapsed = benchmark( iter, n, &passed ); + if ( passed ) { + print_results( iter, elapsed ); + passing += 1; + printf( "ok %d benchmark finished\n", count ); + } else { + printf( "not ok %d benchmark detected NaN\n", count ); + } } } - print_summary( count, count ); - return 0; + print_summary( count, passing ); + return ( passing == count ) ? 0 : 1; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt index 8a619f47de1a..7c38d51c71aa 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt @@ -15,7 +15,7 @@ - a two-dimensional input ndarray corresponding to `A`. - a two-dimensional output ndarray corresponding to `B`. - - a zero-dimensional ndarray specifying the diagonal above which to + - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. Returns @@ -31,7 +31,7 @@ > var bbuf = [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]; > var B = new {{alias:@stdlib/ndarray/matrix/complex128}}( bbuf ); - > var k = {{alias:@stdlib/ndarray/from-scalar}}( 0, { 'dtype': 'generic' } ); + > var k = {{alias:@stdlib/ndarray/from-scalar}}( 0, { 'dtype': 'int32' } ); > {{alias}}( [ A, B, k ] ); > B diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts index 87de2afaf477..144f5ade0660 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { complex128ndarray, typedndarray } from '@stdlib/types/ndarray'; +import { complex128ndarray, int32ndarray } from '@stdlib/types/ndarray'; /** * Copies the lower triangular part of a double-precision complex floating-point matrix `A` to another matrix `B`. @@ -31,7 +31,7 @@ import { complex128ndarray, typedndarray } from '@stdlib/types/ndarray'; * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. * * @param arrays - array-like object containing ndarrays * @returns output ndarray @@ -44,7 +44,7 @@ import { complex128ndarray, typedndarray } from '@stdlib/types/ndarray'; * var B = new Complex128Matrix( [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ] ); * * var k = scalar2ndarray( 0, { -* 'dtype': 'generic' +* 'dtype': 'int32' * }); * * var out = ztril( [ A, B, k ] ); @@ -53,7 +53,7 @@ import { complex128ndarray, typedndarray } from '@stdlib/types/ndarray'; * var bool = ( out === B ); * // returns true */ -declare function ztril( arrays: [ complex128ndarray, complex128ndarray, typedndarray ] ): complex128ndarray; +declare function ztril( arrays: [ complex128ndarray, complex128ndarray, int32ndarray ] ): complex128ndarray; // EXPORTS // diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/test.ts index bfc48cca942f..3b942b01778a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/test.ts @@ -34,7 +34,7 @@ import ztril = require( './index' ); 'dtype': 'complex128' }); const k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); ztril( [ A, B, k ] ); // $ExpectType complex128ndarray @@ -62,7 +62,7 @@ import ztril = require( './index' ); 'dtype': 'complex128' }); const k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); ztril(); // $ExpectError diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c index 23865317db38..de63ab596d80 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c @@ -22,15 +22,28 @@ #include "stdlib/ndarray/index_modes.h" #include "stdlib/ndarray/orders.h" #include "stdlib/ndarray/base/bytes_per_element.h" +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/complex/float64/real.h" +#include "stdlib/complex/float64/imag.h" #include #include #include int main( void ) { - // Create data buffers (interleaved real and imaginary components): - const double dataA[] = { 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 }; - double dataB[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; - double dataK[] = { 0.0 }; + // Create data buffers: + const stdlib_complex128_t dataA[] = { + stdlib_complex128( 1.0, 1.0 ), + stdlib_complex128( 2.0, 2.0 ), + stdlib_complex128( 3.0, 3.0 ), + stdlib_complex128( 4.0, 4.0 ) + }; + stdlib_complex128_t dataB[] = { + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ), + stdlib_complex128( 0.0, 0.0 ) + }; + int32_t dataK[] = { 0 }; // Specify the number of matrix dimensions: const int64_t ndims = 2; @@ -40,7 +53,7 @@ int main( void ) { // Specify the array strides (in bytes): int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; - int64_t kstrides[] = { STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT }; + int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; // Specify the byte offset: const int64_t offset = 0; @@ -61,7 +74,7 @@ int main( void ) { // cppcheck-suppress invalidPointerCast struct ndarray *B = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataB, ndims, shape, strides, offset, order, imode, nsubmodes, submodes ); // cppcheck-suppress invalidPointerCast - struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)dataK, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); + struct ndarray *k = stdlib_ndarray_allocate( STDLIB_NDARRAY_INT32, (uint8_t *)dataK, 0, NULL, kstrides, offset, order, imode, nsubmodes, submodes ); if ( A == NULL || B == NULL || k == NULL ) { fprintf( stderr, "Error allocating memory.\n" ); exit( 1 ); @@ -74,8 +87,8 @@ int main( void ) { stdlib_blas_ext_ztril( arrays ); // Print the output buffer: - for ( int i = 0; i < 8; i++ ) { - printf( "dataB[ %i ] = %lf\n", i, dataB[ i ] ); + for ( int i = 0; i < 4; i++ ) { + printf( "dataB[ %i ] = (%lf, %lf)\n", i, stdlib_complex128_real( dataB[ i ] ), stdlib_complex128_imag( dataB[ i ] ) ); } // Free allocated memory: diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/index.js index 65cf4d0963cd..9721b89b64f7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/index.js @@ -35,7 +35,7 @@ var B = new Complex128Matrix( discreteUniform( 5*5*2, -50, 50, opts ).buffer, 0, console.log( ndarray2array( B ) ); var k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); var out = ztril( [ A, B, k ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/index.js index 5bcffc290ac5..98539e22893b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/index.js @@ -32,7 +32,7 @@ * var B = new Complex128Matrix( [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ] ); * * var k = scalar2ndarray( 0, { -* 'dtype': 'generic' +* 'dtype': 'int32' * }); * * var out = ztril( [ A, B, k ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js index 592f271f16d7..0eb12d62e5a6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js @@ -39,7 +39,7 @@ var strided = require( '@stdlib/blas/ext/base/ztril' ).ndarray; * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. * * @param {ArrayLikeObject} arrays - array-like object containing ndarrays * @returns {Object} output ndarray @@ -52,7 +52,7 @@ var strided = require( '@stdlib/blas/ext/base/ztril' ).ndarray; * var B = new Complex128Matrix( [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ] ); * * var k = scalar2ndarray( 0, { -* 'dtype': 'generic' +* 'dtype': 'int32' * }); * * var out = ztril( [ A, B, k ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js index 6d82335bafa8..b09686bce2df 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js @@ -22,8 +22,6 @@ var serialize = require( '@stdlib/ndarray/base/serialize-meta-data' ); var getData = require( '@stdlib/ndarray/base/data-buffer' ); -var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); -var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); var addon = require( './../src/addon.node' ); @@ -39,7 +37,7 @@ var addon = require( './../src/addon.node' ); * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. * * @private * @param {ArrayLikeObject} arrays - array-like object containing ndarrays @@ -53,7 +51,7 @@ var addon = require( './../src/addon.node' ); * var B = new Complex128Matrix( [ [ 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ] ] ); * * var k = scalar2ndarray( 0, { -* 'dtype': 'generic' +* 'dtype': 'int32' * }); * * var out = ztril( [ A, B, k ] ); @@ -65,9 +63,7 @@ var addon = require( './../src/addon.node' ); function ztril( arrays ) { var A = arrays[ 0 ]; var B = arrays[ 1 ]; - var k = scalar2ndarray( ndarraylike2scalar( arrays[ 2 ] ), { - 'dtype': 'float64' - }); + var k = arrays[ 2 ]; addon( reinterpret( getData( A ), 0 ), serialize( A ), reinterpret( getData( B ), 0 ), serialize( B ), getData( k ), serialize( k ) ); // eslint-disable-line max-len return B; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/manifest.json index bb790b7eee76..067ddd85021b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/manifest.json @@ -90,7 +90,9 @@ "@stdlib/ndarray/index-modes", "@stdlib/ndarray/orders", "@stdlib/ndarray/base/bytes-per-element", - "@stdlib/complex/float64/ctor" + "@stdlib/complex/float64/ctor", + "@stdlib/complex/float64/real", + "@stdlib/complex/float64/imag" ] }, { diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/package.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/package.json index cb7538048057..38f9ee7ff462 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/package.json @@ -14,6 +14,7 @@ } ], "main": "./lib", + "browser": "./lib/main.js", "gypfile": true, "directories": { "benchmark": "./benchmark", diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c index ee21d54c4641..16639f46dc49 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c @@ -31,7 +31,7 @@ * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional float64 ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. * * @param arrays list containing ndarrays */ @@ -52,14 +52,14 @@ void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ) { const CBLAS_INT offsetB = (CBLAS_INT)stdlib_ndarray_offset_elements( B ); // The typed getter assumes that the output type matches the ndarray dtype: - if ( stdlib_ndarray_dtype( karr ) != STDLIB_NDARRAY_FLOAT64 ) { + if ( stdlib_ndarray_dtype( karr ) != STDLIB_NDARRAY_INT32 ) { return; } - double kValue; - if ( stdlib_ndarray_get_float64( karr, NULL, &kValue ) != 0 ) { + int32_t k_value; + if ( stdlib_ndarray_get_int32( karr, NULL, &k_value ) != 0 ) { return; } - const CBLAS_INT k = (CBLAS_INT)kValue; + const CBLAS_INT k = (CBLAS_INT)k_value; const stdlib_complex128_t *dataA = (const stdlib_complex128_t *)stdlib_ndarray_data( A ); stdlib_complex128_t *dataB = (stdlib_complex128_t *)stdlib_ndarray_data( B ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.main.js index a5a7f3e0395c..ea9462f81704 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.main.js @@ -76,7 +76,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -101,7 +101,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 1, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -126,7 +126,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( -1, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -151,7 +151,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 1, 3, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -176,7 +176,7 @@ tape( 'the function supports non-square matrices (row-major)', function test( t B = matrix( Bbuf, 2, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -201,7 +201,7 @@ tape( 'the function supports ndarrays having non-zero offsets', function test( t B = matrix( Bbuf, 2, 2, 2, 1, 1 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -226,7 +226,7 @@ tape( 'the function leaves elements outside of the copied region unchanged', fun B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.native.js index 6c12c8dec5ee..0038b0457c0c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/test/test.native.js @@ -85,7 +85,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -110,7 +110,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 1, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -135,7 +135,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( -1, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -160,7 +160,7 @@ tape( 'the function copies the lower triangular part of a two-dimensional ndarra B = matrix( Bbuf, 3, 3, 1, 3, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -185,7 +185,7 @@ tape( 'the function supports non-square matrices (row-major)', opts, function te B = matrix( Bbuf, 2, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -210,7 +210,7 @@ tape( 'the function supports ndarrays having non-zero offsets', opts, function t B = matrix( Bbuf, 2, 2, 2, 1, 1 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); @@ -235,7 +235,7 @@ tape( 'the function leaves elements outside of the copied region unchanged', opt B = matrix( Bbuf, 3, 3, 3, 1, 0 ); k = scalar2ndarray( 0, { - 'dtype': 'generic' + 'dtype': 'int32' }); v = ztril( [ A, B, k ] ); From d4fbd6f46676d906fedc861dec444a50e5c9b38e Mon Sep 17 00:00:00 2001 From: yb175 Date: Wed, 14 Oct 2026 11:21:41 +0000 Subject: [PATCH 6/9] fix : fixed the ci failure --- .../@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt index 7c38d51c71aa..97d8bce11eea 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt @@ -15,8 +15,8 @@ - a two-dimensional input ndarray corresponding to `A`. - a two-dimensional output ndarray corresponding to `B`. - - a zero-dimensional int32 ndarray specifying the diagonal above which to - ignore. + - a zero-dimensional int32 ndarray specifying the diagonal above + which to ignore. Returns ------- From 1dc85ecf519e04e0fbb5484043511725541ec6ff Mon Sep 17 00:00:00 2001 From: yb175 Date: Wed, 14 Oct 2026 11:32:49 +0000 Subject: [PATCH 7/9] fix: wrap ztril REPL help text to satisfy lint --- .../@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt index 97d8bce11eea..fce345efa18f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt @@ -15,8 +15,7 @@ - a two-dimensional input ndarray corresponding to `A`. - a two-dimensional output ndarray corresponding to `B`. - - a zero-dimensional int32 ndarray specifying the diagonal above - which to ignore. + - an int32 scalar ndarray for the diagonal above which to ignore. Returns ------- From 534793963d9d65286e7fb2120d6acab41935437c Mon Sep 17 00:00:00 2001 From: yb175 Date: Wed, 14 Oct 2026 18:04:56 +0000 Subject: [PATCH 8/9] fix : adressed the changes requested --- .../blas/ext/base/ndarray/ztril/README.md | 8 ++-- .../base/ndarray/ztril/benchmark/benchmark.js | 2 +- .../ztril/benchmark/benchmark.native.js | 19 ++++---- .../ztril/benchmark/c/benchmark.length.c | 45 ++++++++----------- .../blas/ext/base/ndarray/ztril/docs/repl.txt | 3 +- .../base/ndarray/ztril/docs/types/index.d.ts | 2 +- .../base/ndarray/ztril/examples/c/example.c | 2 +- .../blas/ext/base/ndarray/ztril/lib/main.js | 2 +- .../blas/ext/base/ndarray/ztril/lib/native.js | 2 +- .../blas/ext/base/ndarray/ztril/src/main.c | 18 +++----- 10 files changed, 44 insertions(+), 59 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md index 6df10d9345af..785bada54a74 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/README.md @@ -66,7 +66,7 @@ The function has the following parameters: - a two-dimensional input ndarray corresponding to `A`. - a two-dimensional output ndarray corresponding to `B`. - - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. A value equal to zero refers to the main diagonal, greater than zero refers to a diagonal above the main diagonal, and less than zero refers to a diagonal below the main diagonal. + - a zero-dimensional ndarray specifying the diagonal above which to ignore. A value equal to zero refers to the main diagonal, greater than zero refers to a diagonal above the main diagonal, and less than zero refers to a diagonal below the main diagonal. @@ -174,7 +174,7 @@ stdlib_complex128_t dataB[] = { int32_t dataK[] = { 0 }; int64_t shape[] = { 2, 2 }; int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; -int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; +int64_t kstrides[] = { 0 }; int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR }; struct ndarray *A = stdlib_ndarray_allocate( STDLIB_NDARRAY_COMPLEX128, (uint8_t *)dataA, 2, shape, strides, 0, STDLIB_NDARRAY_ROW_MAJOR, STDLIB_NDARRAY_INDEX_ERROR, 1, submodes ); @@ -197,7 +197,7 @@ The function accepts the following arguments: - `[in] struct ndarray*` a two-dimensional input ndarray corresponding to `A`. - `[inout] struct ndarray*` a two-dimensional output ndarray corresponding to `B`. - - `[in] struct ndarray*` a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. + - `[in] struct ndarray*` a zero-dimensional ndarray specifying the diagonal above which to ignore. ```c void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ); @@ -263,7 +263,7 @@ int main( void ) { // Specify the array strides (in bytes): int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; - int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; + int64_t kstrides[] = { 0 }; // Specify the byte offset: const int64_t offset = 0; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js index 00869ced86aa..c8a4ad2c7dff 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.js @@ -29,7 +29,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var pkg = require( './../package.json' ).name; -var ztril = require( './../lib' ); +var ztril = require( './../lib/main.js' ); // VARIABLES // diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js index de0f9214b9bf..de051df7d354 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js @@ -27,9 +27,8 @@ var format = require( '@stdlib/string/format' ); var Complex128Matrix = require( '@stdlib/ndarray/matrix/complex128' ); var uniform = require( '@stdlib/random/array/uniform' ); var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var real = require( '@stdlib/complex/float64/real' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -90,10 +89,7 @@ function createBenchmark( N ) { } } b.toc(); - if ( - isnan( real( out.get( i%N, i%N ) ) ) || - isnan( imag( out.get( i%N, i%N ) ) ) - ) { + if ( isnan( real( out.get( i%N, i%N ) ) ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -110,14 +106,19 @@ function createBenchmark( N ) { * @private */ function main() { - var min = 1; - var max = 3; + var min; + var max; var N; + var f; var i; + min = 1; // 10^min + max = 3; // 10^max + for ( i = min; i <= max; i++ ) { N = pow( 10, i ); - bench( format( '%s::native:size=%d', pkg, N*N ), opts, createBenchmark( N ) ); + f = createBenchmark( N ); + bench( format( '%s::native:size=%d', pkg, N*N ), opts, f ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c index 656047c12777..ae21888ef096 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c @@ -57,7 +57,7 @@ static void print_summary( int total, int passing ) { printf( "# total %d\n", total ); printf( "# pass %d\n", passing ); printf( "#\n" ); - printf( "# %s\n", passing == total ? "ok" : "not ok" ); + printf( "# ok\n" ); } /** @@ -76,9 +76,9 @@ static void print_results( int iterations, double elapsed ) { } /** -* Returns the current time. +* Returns a clock time. * -* @return current time in seconds +* @return clock time */ static double tic( void ) { struct timeval now; @@ -103,10 +103,9 @@ static double random_uniform( const double min, const double max ) { * * @param iterations number of iterations * @param n number of matrix rows and columns -* @param passed whether the benchmark passed * @return elapsed time in seconds */ -static double benchmark( int iterations, int n, int *passed ) { +static double benchmark( int iterations, int n ) { const struct ndarray *arrays[ 3 ]; enum STDLIB_NDARRAY_INDEX_MODE imode; enum STDLIB_NDARRAY_ORDER order; @@ -133,13 +132,14 @@ static double benchmark( int iterations, int n, int *passed ) { shape[ 1 ] = n; strides[ 0 ] = (int64_t)n * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT; strides[ 1 ] = STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT; - kstrides[ 0 ] = STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT; + kstrides[ 0 ] = 0; offset = 0; order = STDLIB_NDARRAY_ROW_MAJOR; imode = STDLIB_NDARRAY_INDEX_ERROR; submodes[ 0 ] = imode; submodes[ 1 ] = imode; nsubmodes = 1; + len = (int64_t)n * (int64_t)n; dataA = (stdlib_complex128_t *)malloc( (size_t)len * sizeof(stdlib_complex128_t) ); dataB = (stdlib_complex128_t *)malloc( (size_t)len * sizeof(stdlib_complex128_t) ); @@ -167,20 +167,18 @@ static double benchmark( int iterations, int n, int *passed ) { arrays[ 1 ] = B; arrays[ 2 ] = k; - *passed = 1; t = tic(); for ( i = 0; i < iterations; i++ ) { stdlib_blas_ext_ztril( arrays ); - if ( - stdlib_complex128_real( dataB[ 0 ] ) != stdlib_complex128_real( dataB[ 0 ] ) || - stdlib_complex128_imag( dataB[ 0 ] ) != stdlib_complex128_imag( dataB[ 0 ] ) - ) { - fprintf( stderr, "should not return NaN\n" ); - *passed = 0; + if ( stdlib_complex128_real( dataB[ 0 ] ) != stdlib_complex128_real( dataB[ 0 ] ) || stdlib_complex128_imag( dataB[ 0 ] ) != stdlib_complex128_imag( dataB[ 0 ] ) ) { + printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; + if ( stdlib_complex128_real( dataB[ 0 ] ) != stdlib_complex128_real( dataB[ 0 ] ) || stdlib_complex128_imag( dataB[ 0 ] ) != stdlib_complex128_imag( dataB[ 0 ] ) ) { + printf( "should not return NaN\n" ); + } stdlib_ndarray_free( A ); stdlib_ndarray_free( B ); stdlib_ndarray_free( k ); @@ -198,33 +196,26 @@ static double benchmark( int iterations, int n, int *passed ) { int main( void ) { double elapsed; int count; - int passing; - int passed; int iter; int n; int i; int j; - srand( (unsigned int)time( NULL ) ); + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + print_version(); count = 0; - passing = 0; for ( i = MIN; i <= MAX; i++ ) { n = (int)pow( 10.0, (double)i ); iter = ITERATIONS / (int)pow( 10.0, (double)(2*(i-1)) ); for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:size=%d\n", NAME, n*n ); - elapsed = benchmark( iter, n, &passed ); - if ( passed ) { - print_results( iter, elapsed ); - passing += 1; - printf( "ok %d benchmark finished\n", count ); - } else { - printf( "not ok %d benchmark detected NaN\n", count ); - } + elapsed = benchmark( iter, n ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); } } - print_summary( count, passing ); - return ( passing == count ) ? 0 : 1; + print_summary( count, count ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt index fce345efa18f..46b609d88736 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/repl.txt @@ -15,7 +15,8 @@ - a two-dimensional input ndarray corresponding to `A`. - a two-dimensional output ndarray corresponding to `B`. - - an int32 scalar ndarray for the diagonal above which to ignore. + - a zero-dimensional ndarray specifying the diagonal above which to + ignore. Returns ------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts index 144f5ade0660..5ccf31fc111b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/docs/types/index.d.ts @@ -31,7 +31,7 @@ import { complex128ndarray, int32ndarray } from '@stdlib/types/ndarray'; * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional ndarray specifying the diagonal above which to ignore. * * @param arrays - array-like object containing ndarrays * @returns output ndarray diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c index de63ab596d80..bc1488e6f9ae 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/examples/c/example.c @@ -53,7 +53,7 @@ int main( void ) { // Specify the array strides (in bytes): int64_t strides[] = { 2 * STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT, STDLIB_NDARRAY_COMPLEX128_BYTES_PER_ELEMENT }; - int64_t kstrides[] = { STDLIB_NDARRAY_INT32_BYTES_PER_ELEMENT }; + int64_t kstrides[] = { 0 }; // Specify the byte offset: const int64_t offset = 0; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js index 0eb12d62e5a6..358a6f3fdd86 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/main.js @@ -39,7 +39,7 @@ var strided = require( '@stdlib/blas/ext/base/ztril' ).ndarray; * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional ndarray specifying the diagonal above which to ignore. * * @param {ArrayLikeObject} arrays - array-like object containing ndarrays * @returns {Object} output ndarray diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js index b09686bce2df..35003534f894 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/lib/native.js @@ -37,7 +37,7 @@ var addon = require( './../src/addon.node' ); * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional ndarray specifying the diagonal above which to ignore. * * @private * @param {ArrayLikeObject} arrays - array-like object containing ndarrays diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c index 16639f46dc49..ba68e68c4dc1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c @@ -31,18 +31,18 @@ * * - a two-dimensional input ndarray corresponding to `A`. * - a two-dimensional output ndarray corresponding to `B`. -* - a zero-dimensional int32 ndarray specifying the diagonal above which to ignore. +* - a zero-dimensional ndarray specifying the diagonal above which to ignore. * * @param arrays list containing ndarrays */ void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ) { const struct ndarray *A = arrays[ 0 ]; const struct ndarray *B = arrays[ 1 ]; - const struct ndarray *karr = arrays[ 2 ]; + int32_t k_value; + const CBLAS_INT M = stdlib_ndarray_dimension( A, 0 ); + const CBLAS_INT N = stdlib_ndarray_dimension( A, 1 ); - const int64_t *shape = stdlib_ndarray_shape( A ); - const CBLAS_INT M = (CBLAS_INT)shape[ 0 ]; - const CBLAS_INT N = (CBLAS_INT)shape[ 1 ]; + stdlib_ndarray_get_int32( arrays[ 2 ], NULL, &k_value ); const CBLAS_INT strideA1 = (CBLAS_INT)stdlib_ndarray_stride_elements( A, 0 ); const CBLAS_INT strideA2 = (CBLAS_INT)stdlib_ndarray_stride_elements( A, 1 ); @@ -51,14 +51,6 @@ void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ) { const CBLAS_INT strideB2 = (CBLAS_INT)stdlib_ndarray_stride_elements( B, 1 ); const CBLAS_INT offsetB = (CBLAS_INT)stdlib_ndarray_offset_elements( B ); - // The typed getter assumes that the output type matches the ndarray dtype: - if ( stdlib_ndarray_dtype( karr ) != STDLIB_NDARRAY_INT32 ) { - return; - } - int32_t k_value; - if ( stdlib_ndarray_get_int32( karr, NULL, &k_value ) != 0 ) { - return; - } const CBLAS_INT k = (CBLAS_INT)k_value; const stdlib_complex128_t *dataA = (const stdlib_complex128_t *)stdlib_ndarray_data( A ); From c5b55911874940a9fc7cc3dfacd8ee97a343c45c Mon Sep 17 00:00:00 2001 From: yb175 Date: Thu, 15 Oct 2026 05:32:21 +0000 Subject: [PATCH 9/9] chore : adressed review comments --- .../ztril/benchmark/benchmark.native.js | 21 +++++++++---------- .../ztril/benchmark/c/benchmark.length.c | 2 +- .../blas/ext/base/ndarray/ztril/src/main.c | 21 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js index de051df7d354..6a83f028581d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/benchmark.native.js @@ -22,13 +22,13 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var format = require( '@stdlib/string/format' ); -var Complex128Matrix = require( '@stdlib/ndarray/matrix/complex128' ); var uniform = require( '@stdlib/random/array/uniform' ); -var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var Complex128Matrix = require( '@stdlib/ndarray/matrix/complex128' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var real = require( '@stdlib/complex/float64/real' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -39,6 +39,9 @@ var ztril = tryRequire( resolve( __dirname, './../lib/native.js' ) ); var opts = { 'skip': ( ztril instanceof Error ) }; +var options = { + 'dtype': 'float64' +}; // FUNCTIONS // @@ -47,7 +50,7 @@ var opts = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} N - number of rows and columns +* @param {PositiveInteger} N - number of elements along each dimension * @returns {Function} benchmark function */ function createBenchmark( N ) { @@ -57,12 +60,8 @@ function createBenchmark( N ) { var B; var k; - abuf = uniform( N*N*2, -100.0, 100.0, { - 'dtype': 'float64' - }); - bbuf = uniform( N*N*2, -100.0, 100.0, { - 'dtype': 'float64' - }); + abuf = uniform( N*N*2, -100.0, 100.0, options ); + bbuf = uniform( N*N*2, -100.0, 100.0, options ); A = new Complex128Matrix( abuf.buffer, 0, N, N ); B = new Complex128Matrix( bbuf.buffer, 0, N, N ); k = scalar2ndarray( 0, { diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c index ae21888ef096..b2c01965cb81 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/benchmark/c/benchmark.length.c @@ -61,7 +61,7 @@ static void print_summary( int total, int passing ) { } /** -* Prints benchmark results. +* Prints benchmarks results. * * @param iterations number of iterations * @param elapsed elapsed time in seconds diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c index ba68e68c4dc1..41ded5dc4018 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/ztril/src/main.c @@ -38,20 +38,19 @@ void stdlib_blas_ext_ztril( const struct ndarray *arrays[] ) { const struct ndarray *A = arrays[ 0 ]; const struct ndarray *B = arrays[ 1 ]; - int32_t k_value; - const CBLAS_INT M = stdlib_ndarray_dimension( A, 0 ); - const CBLAS_INT N = stdlib_ndarray_dimension( A, 1 ); - stdlib_ndarray_get_int32( arrays[ 2 ], NULL, &k_value ); + int32_t k; + stdlib_ndarray_get_int32( arrays[ 2 ], NULL, &k ); - const CBLAS_INT strideA1 = (CBLAS_INT)stdlib_ndarray_stride_elements( A, 0 ); - const CBLAS_INT strideA2 = (CBLAS_INT)stdlib_ndarray_stride_elements( A, 1 ); - const CBLAS_INT offsetA = (CBLAS_INT)stdlib_ndarray_offset_elements( A ); - const CBLAS_INT strideB1 = (CBLAS_INT)stdlib_ndarray_stride_elements( B, 0 ); - const CBLAS_INT strideB2 = (CBLAS_INT)stdlib_ndarray_stride_elements( B, 1 ); - const CBLAS_INT offsetB = (CBLAS_INT)stdlib_ndarray_offset_elements( B ); + const CBLAS_INT M = stdlib_ndarray_dimension( A, 0 ); + const CBLAS_INT N = stdlib_ndarray_dimension( A, 1 ); - const CBLAS_INT k = (CBLAS_INT)k_value; + const CBLAS_INT strideA1 = stdlib_ndarray_stride_elements( A, 0 ); + const CBLAS_INT strideA2 = stdlib_ndarray_stride_elements( A, 1 ); + const CBLAS_INT offsetA = stdlib_ndarray_offset_elements( A ); + const CBLAS_INT strideB1 = stdlib_ndarray_stride_elements( B, 0 ); + const CBLAS_INT strideB2 = stdlib_ndarray_stride_elements( B, 1 ); + const CBLAS_INT offsetB = stdlib_ndarray_offset_elements( B ); const stdlib_complex128_t *dataA = (const stdlib_complex128_t *)stdlib_ndarray_data( A ); stdlib_complex128_t *dataB = (stdlib_complex128_t *)stdlib_ndarray_data( B );