diff --git a/lib/node_modules/@stdlib/blas/ext/base/README.md b/lib/node_modules/@stdlib/blas/ext/base/README.md index 09d6197e4d9b..3a92fa33f756 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/README.md @@ -198,7 +198,6 @@ var o = ns; - [`szeroTo( N, x, strideX )`][@stdlib/blas/ext/base/szero-to]: fill a single-precision floating-point strided array with linearly spaced numeric elements which increment by `1` starting from zero. - [`wasm`][@stdlib/blas/ext/base/wasm]: extensions to basic linear algebra subprograms (BLAS) compiled to WebAssembly. - [`zfill( N, alpha, x, strideX )`][@stdlib/blas/ext/base/zfill]: fill a double-precision complex floating-point strided array with a specified scalar constant. -- [`zindexOfRow( order, M, N, A, LDA, x, strideX, workspace, strideW )`][@stdlib/blas/ext/base/zindex-of-row]: return the index of the first row in a double-precision complex floating-point input matrix which has the same elements as a provided search vector. - [`zsum( N, x, strideX )`][@stdlib/blas/ext/base/zsum]: calculate the sum of double-precision complex floating-point strided array elements. - [`zsumkbn( N, x, strideX )`][@stdlib/blas/ext/base/zsumkbn]: calculate the sum of double-precision complex floating-point strided array elements using an improved Kahan–Babuška algorithm. - [`zzeroTo( N, x, strideX )`][@stdlib/blas/ext/base/zzero-to]: fill a double-precision complex floating-point strided array with linearly spaced numeric elements which increment by `1` starting from zero. @@ -562,8 +561,6 @@ console.log( objectKeys( ns ) ); [@stdlib/blas/ext/base/zfill]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/zfill -[@stdlib/blas/ext/base/zindex-of-row]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/zindex-of-row - [@stdlib/blas/ext/base/zsum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/zsum [@stdlib/blas/ext/base/zsumkbn]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/zsumkbn diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/README.md b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/README.md deleted file mode 100644 index 459e19506a2d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/README.md +++ /dev/null @@ -1,450 +0,0 @@ - - -# cindexOfRow - -> Return the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var cindexOfRow = require( '@stdlib/blas/ext/base/cindex-of-row' ); -``` - -#### cindexOfRow( order, M, N, A, LDA, x, strideX, workspace, strideW ) - -Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -/* - A = [ - [ 1+0i, 3+0i ], - [ 2+0i, 4+0i ] - ] -*/ -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -var workspace = new Uint8Array( 2 ); -var out = cindexOfRow( 'column-major', 2, 2, A, 2, x, 1, workspace, 1 ); -// returns 1 -``` - -The function has the following parameters: - -- **order**: storage layout. -- **M**: number of rows in `A`. -- **N**: number of columns in `A`. -- **A**: input matrix stored as a [`Complex64Array`][@stdlib/array/complex64]. -- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). -- **x**: search vector stored as a [`Complex64Array`][@stdlib/array/complex64]. -- **strideX**: stride length of `x`. -- **workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order. -- **strideW**: stride length of `workspace`. - -When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may provide an empty workspace array. - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -/* - A = [ - [ 1+0i, 2+0i ], - [ 3+0i, 4+0i ] - ] -*/ -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -var x = new Complex64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); -var workspace = new Uint8Array( 0 ); -var out = cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, workspace, 1 ); -// returns 1 -``` - -If the function is unable to find a matching row, the function returns `-1`. - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -/* - A = [ - [ 1+0i, 3+0i ], - [ 2+0i, 4+0i ] - ] -*/ -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -var x = new Complex64Array( [ -3.0, 0.0, -4.0, 0.0 ] ); -var workspace = new Uint8Array( 2 ); -var out = cindexOfRow( 'column-major', 2, 2, A, 2, x, 1, workspace, 1 ); -// returns -1 -``` - -Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. - - - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -// Initial arrays: -var A0 = new Complex64Array( [ 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -var x0 = new Complex64Array( [ 0.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -// Create offset views: -var A1 = new Complex64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); -var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - -var workspace = new Uint8Array( 0 ); -var out = cindexOfRow( 'row-major', 1, 2, A1, 2, x1, 1, workspace, 1 ); -// returns 0 -``` - - - -#### cindexOfRow.ndarray( M, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX, workspace, strideW, offsetW ) - - - -Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -/* - A = [ - [ 1+0i, 3+0i ], - [ 2+0i, 4+0i ] - ] -*/ -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -var workspace = new Uint8Array( 2 ); -var out = cindexOfRow.ndarray( 2, 2, A, 1, 2, 0, x, 1, 0, workspace, 1, 0 ); -// returns 1 -``` - -The function has the following parameters: - -- **M**: number of rows in `A`. -- **N**: number of columns in `A`. -- **A**: input matrix stored as a [`Complex64Array`][@stdlib/array/complex64]. -- **strideA1**: stride of the first dimension of `A`. -- **strideA2**: stride of the second dimension of `A`. -- **offsetA**: starting index for `A`. -- **x**: search vector stored as a [`Complex64Array`][@stdlib/array/complex64]. -- **strideX**: stride length of `x`. -- **offsetX**: starting index for `x`. -- **workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order. -- **strideW**: stride length of `workspace`. -- **offsetW**: starting index for `workspace`. - -When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may provide an empty workspace array. - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); - -/* - A = [ - [ 1+0i, 2+0i ], - [ 3+0i, 4+0i ] - ] -*/ -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - -var x = new Complex64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); -var workspace = new Uint8Array( 0 ); -var out = cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, workspace, 1, 0 ); -// returns 1 -``` - -
- - - - - -
- -## Notes - -- When searching for a matching row, the function checks for equality using the strict equality operator `===`. As a consequence, `NaN` values are considered distinct, and `-0` and `+0` are considered the same. - -
- - - - - -
- -## Examples - - - - - -```javascript -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var cindexOfRow = require( '@stdlib/blas/ext/base/cindex-of-row' ); - -var shape = [ 2, 2 ]; -var order = 'row-major'; -var strides = shape2strides( shape, order ); - -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); -console.log( ndarray2array( A, shape, strides, 0, order ) ); - -var x = new Complex64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); -console.log( x ); - -var workspace = new Uint8Array( shape[ 0 ] ); - -var out = cindexOfRow( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ], x, 1, workspace, 1 ); -console.log( out ); -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/blas/ext/base/cindex_of_row.h" -``` - - - -#### stdlib_strided_cindex_of_row( order, M, N, \*A, LDA, \*X, strideX, \*workspace, strideW ) - - - -Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. - -```c -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" -#include - -const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f }; -const float x[] = { 2.0f, 0.0f, 4.0f, 0.0f }; -uint8_t workspace[ 3 ]; - -int idx = stdlib_strided_cindex_of_row( CblasColMajor, 3, 2, (const stdlib_complex64_t *)A, 3, (const stdlib_complex64_t *)x, 1, workspace, 1 ); -// returns 1 -``` - -The function accepts the following arguments: - -- **order**: `[in] CBLAS_LAYOUT` storage layout. -- **M**: `[in] CBLAS_INT` number of rows in `A`. -- **N**: `[in] CBLAS_INT` number of columns in `A`. -- **A**: `[in] stdlib_complex64_t*` input matrix. -- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). -- **X**: `[in] stdlib_complex64_t*` search vector. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. -- **workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order. -- **strideW**: `[in] CBLAS_INT` stride length for `workspace`. - -When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may either provide an empty workspace array or a `NULL` pointer. - -```c -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" - -const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; -const float x[] = { 3.0f, 0.0f, 4.0f, 0.0f }; - -int idx = stdlib_strided_cindex_of_row( CblasRowMajor, 3, 2, (const stdlib_complex64_t *)A, 2, (const stdlib_complex64_t *)x, 1, NULL, 1 ); -// returns 1 -``` - -```c -CBLAS_INT stdlib_strided_cindex_of_row( const CBLAS_LAYOUT order, const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT LDA, const stdlib_complex64_t *X, const CBLAS_INT strideX, uint8_t *workspace, const CBLAS_INT strideW ); -``` - - - -#### stdlib_strided_cindex_of_row_ndarray( M, N, \*A, strideA1, strideA2, offsetA, \*X, strideX, offsetX, \*workspace, strideW, offsetW ) - - - -Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. - -```c -#include "stdlib/complex/float32/ctor.h" -#include - -const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f }; -const float x[] = { 2.0f, 0.0f, 4.0f, 0.0f }; -uint8_t workspace[ 3 ]; - -int idx = stdlib_strided_cindex_of_row_ndarray( 3, 2, (const stdlib_complex64_t *)A, 1, 3, 0, (const stdlib_complex64_t *)x, 1, 0, workspace, 1, 0 ); -// returns 1 -``` - -The function accepts the following arguments: - -- **M**: `[in] CBLAS_INT` number of rows in `A`. -- **N**: `[in] CBLAS_INT` number of columns in `A`. -- **A**: `[in] stdlib_complex64_t*` input matrix. -- **strideA1**: `[in] CBLAS_INT` stride of the first dimension of `A`. -- **strideA2**: `[in] CBLAS_INT` stride of the second dimension of `A`. -- **offsetA**: `[in] CBLAS_INT` index offset for `A`. -- **X**: `[in] stdlib_complex64_t*` search vector. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. -- **offsetX**: `[in] CBLAS_INT` starting index for `X`. -- **workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order. -- **strideW**: `[in] CBLAS_INT` stride length for `workspace`. -- **offsetW**: `[in] CBLAS_INT` starting index for `workspace`. - -When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may either provide an empty workspace array or a `NULL` pointer. - -```c -#include "stdlib/complex/float32/ctor.h" - -const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; -const float x[] = { 3.0f, 0.0f, 4.0f, 0.0f }; - -int idx = stdlib_strided_cindex_of_row_ndarray( 3, 2, (const stdlib_complex64_t *)A, 2, 1, 0, (const stdlib_complex64_t *)x, 1, 0, NULL, 1, 0 ); -// returns 1 -``` - -```c -CBLAS_INT stdlib_strided_cindex_of_row_ndarray( const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, uint8_t *workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/blas/ext/base/cindex_of_row.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" -#include - -int main( void ) { - // Create a matrix (row-major, 2x2, interleaved real and imaginary components): - const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f }; - - // Create a search vector (interleaved real and imaginary components): - const float x[] = { 3.0f, 0.0f, 4.0f, 0.0f }; - - // Specify the number of matrix rows and columns: - const int M = 2; - const int N = 2; - - // Perform a search: - int idx = stdlib_strided_cindex_of_row( CblasRowMajor, M, N, (const stdlib_complex64_t *)A, N, (const stdlib_complex64_t *)x, 1, NULL, 1 ); - - // Print the result: - printf( "index value: %d\n", idx ); -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.js deleted file mode 100644 index e6c2c67dc015..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.js +++ /dev/null @@ -1,127 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var zeros = require( '@stdlib/array/zeros' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var cindexOfRow = require( './../lib/cindex_of_row.js' ); - - -// VARIABLES // - -var LAYOUTS = [ - 'row-major', - 'column-major' -]; -var options = { - 'dtype': 'float32' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {string} order - storage layout -* @param {PositiveInteger} N - number of elements along each dimension -* @returns {Function} benchmark function -*/ -function createBenchmark( order, N ) { - var workspace; - var abuf; - var xbuf; - var A; - var x; - - workspace = zeros( N, 'uint8' ); - abuf = uniform( N*N*2, -100.0, 100.0, options ); - A = new Complex64Array( abuf.buffer ); - xbuf = uniform( N*2, 200.0, 300.0, options ); - x = new Complex64Array( xbuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var z; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = cindexOfRow( order, N, N, A, N, x, 1, workspace, 1 ); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var ord; - var N; - var f; - var i; - var k; - - min = 1; // 10^min - max = 6; // 10^max - - for ( k = 0; k < LAYOUTS.length; k++ ) { - ord = LAYOUTS[ k ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( ord, N ); - bench( format( '%s::square_matrix:order=%s,size=%d', pkg, ord, N*N ), f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.native.js deleted file mode 100644 index a3bb2a4ce248..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.native.js +++ /dev/null @@ -1,132 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var zeros = require( '@stdlib/array/zeros' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cindexOfRow = tryRequire( resolve( __dirname, './../lib/cindex_of_row.native.js' ) ); -var opts = { - 'skip': ( cindexOfRow instanceof Error ) -}; -var LAYOUTS = [ - 'row-major', - 'column-major' -]; -var options = { - 'dtype': 'float32' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {string} order - storage layout -* @param {PositiveInteger} N - number of elements along each dimension -* @returns {Function} benchmark function -*/ -function createBenchmark( order, N ) { - var workspace; - var abuf; - var xbuf; - var A; - var x; - - workspace = zeros( N, 'uint8' ); - abuf = uniform( N*N*2, -100.0, 100.0, options ); - A = new Complex64Array( abuf.buffer ); - xbuf = uniform( N*2, 200.0, 300.0, options ); - x = new Complex64Array( xbuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var z; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = cindexOfRow( order, N, N, A, N, x, 1, workspace, 1 ); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var ord; - var N; - var f; - var i; - var k; - - min = 1; // 10^min - max = 6; // 10^max - - for ( k = 0; k < LAYOUTS.length; k++ ) { - ord = LAYOUTS[ k ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( ord, N ); - bench( format( '%s::native,square_matrix:order=%s,size=%d', pkg, ord, N*N ), opts, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.js deleted file mode 100644 index 5dc9fd0bedf2..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.js +++ /dev/null @@ -1,138 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var zeros = require( '@stdlib/array/zeros' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var cindexOfRow = require( './../lib/ndarray.js' ); - - -// VARIABLES // - -var LAYOUTS = [ - 'row-major', - 'column-major' -]; -var options = { - 'dtype': 'float32' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {string} order - storage layout -* @param {PositiveInteger} N - number of elements along each dimension -* @returns {Function} benchmark function -*/ -function createBenchmark( order, N ) { - var workspace; - var abuf; - var xbuf; - var A; - var x; - - workspace = zeros( N, 'uint8' ); - abuf = uniform( N*N*2, -100.0, 100.0, options ); - A = new Complex64Array( abuf.buffer ); - xbuf = uniform( N*2, 200.0, 300.0, options ); - x = new Complex64Array( xbuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var sa1; - var sa2; - var z; - var i; - - if ( isColumnMajor( order ) ) { - sa1 = 1; - sa2 = N; - } else { // order === 'row-major' - sa1 = N; - sa2 = 1; - } - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = cindexOfRow( N, N, A, sa1, sa2, 0, x, 1, 0, workspace, 1, 0 ); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var ord; - var N; - var f; - var i; - var k; - - min = 1; // 10^min - max = 6; // 10^max - - for ( k = 0; k < LAYOUTS.length; k++ ) { - ord = LAYOUTS[ k ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( ord, N ); - bench( format( '%s::square_matrix:ndarray:order=%s,size=%d', pkg, ord, N*N ), f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.native.js deleted file mode 100644 index 5269728398de..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/benchmark.ndarray.native.js +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var bench = require( '@stdlib/bench' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var zeros = require( '@stdlib/array/zeros' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var cindexOfRow = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); -var opts = { - 'skip': ( cindexOfRow instanceof Error ) -}; -var LAYOUTS = [ - 'row-major', - 'column-major' -]; -var options = { - 'dtype': 'float32' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {string} order - storage layout -* @param {PositiveInteger} N - number of elements along each dimension -* @returns {Function} benchmark function -*/ -function createBenchmark( order, N ) { - var workspace; - var abuf; - var xbuf; - var A; - var x; - - workspace = zeros( N, 'uint8' ); - abuf = uniform( N*N*2, -100.0, 100.0, options ); - A = new Complex64Array( abuf.buffer ); - xbuf = uniform( N*2, 200.0, 300.0, options ); - x = new Complex64Array( xbuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var sa1; - var sa2; - var z; - var i; - - if ( isColumnMajor( order ) ) { - sa1 = 1; - sa2 = N; - } else { // order === 'row-major' - sa1 = N; - sa2 = 1; - } - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = cindexOfRow( N, N, A, sa1, sa2, 0, x, 1, 0, workspace, 1, 0 ); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnanf( z ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var ord; - var N; - var f; - var i; - var k; - - min = 1; // 10^min - max = 6; // 10^max - - for ( k = 0; k < LAYOUTS.length; k++ ) { - ord = LAYOUTS[ k ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( ord, N ); - bench( format( '%s::native,square_matrix:ndarray:order=%s,size=%d', pkg, ord, N*N ), opts, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/benchmark.length.c deleted file mode 100644 index 0dccaec4904f..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/benchmark.length.c +++ /dev/null @@ -1,222 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/ext/base/cindex_of_row.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" -#include -#include -#include -#include -#include -#include - -#define NAME "cindex_of_row" -#define ITERATIONS 10000000 -#define REPEATS 3 -#define MIN 1 -#define MAX 6 - -/** -* Prints the TAP version. -*/ -static void print_version( void ) { - printf( "TAP version 13\n" ); -} - -/** -* Prints the TAP summary. -* -* @param total total number of tests -* @param passing total number of passing tests -*/ -static void print_summary( int total, int passing ) { - printf( "#\n" ); - printf( "1..%d\n", total ); // TAP plan - printf( "# total %d\n", total ); - printf( "# pass %d\n", passing ); - printf( "#\n" ); - printf( "# ok\n" ); -} - -/** -* Prints benchmarks results. -* -* @param iterations number of iterations -* @param elapsed elapsed time in seconds -*/ -static void print_results( int iterations, double elapsed ) { - double rate = (double)iterations / elapsed; - printf( " ---\n" ); - printf( " iterations: %d\n", iterations ); - printf( " elapsed: %0.9f\n", elapsed ); - printf( " rate: %0.9f\n", rate ); - printf( " ...\n" ); -} - -/** -* Returns a clock time. -* -* @return clock time -*/ -static double tic( void ) { - struct timeval now; - gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; -} - -/** -* Generates a random number on the interval [0,1). -* -* @return random number -*/ -static float rand_float( void ) { - int r = rand(); - return (float)r / ( (float)RAND_MAX + 1.0f ); -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param N number of elements along each dimension -* @return elapsed time in seconds -*/ -static double benchmark1( int iterations, int N ) { - uint8_t *workspace; - double elapsed; - double t; - float *A; - float *x; - int idx; - int i; - int j; - - A = (float *)malloc( (size_t)( N*N*2 ) * sizeof( float ) ); - x = (float *)malloc( (size_t)( N*2 ) * sizeof( float ) ); - workspace = (uint8_t *)malloc( (size_t)N * sizeof( uint8_t ) ); - for ( i = 0; i < N*N*2; i++ ) { - A[ i ] = ( rand_float() * 20000.0f ) - 10000.0f; - } - for ( j = 0; j < N*2; j++ ) { - x[ j ] = 20000.0f; - } - idx = -1; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - idx = stdlib_strided_cindex_of_row( CblasRowMajor, N, N, (stdlib_complex64_t *)A, N, (stdlib_complex64_t *)x, 1, workspace, 1 ); - if ( idx < -2 ) { - printf( "unexpected result\n" ); - break; - } - } - elapsed = tic() - t; - if ( idx < -2 ) { - printf( "unexpected result\n" ); - } - free( A ); - free( x ); - free( workspace ); - return elapsed; -} - -/** -* Runs a benchmark. -* -* @param iterations number of iterations -* @param N number of elements along each dimension -* @return elapsed time in seconds -*/ -static double benchmark2( int iterations, int N ) { - uint8_t *workspace; - double elapsed; - double t; - float *A; - float *x; - int idx; - int i; - int j; - - A = (float *)malloc( (size_t)( N*N*2 ) * sizeof( float ) ); - x = (float *)malloc( (size_t)( N*2 ) * sizeof( float ) ); - workspace = (uint8_t *)malloc( (size_t)N * sizeof( uint8_t ) ); - for ( i = 0; i < N*N*2; i++ ) { - A[ i ] = ( rand_float() * 20000.0f ) - 10000.0f; - } - for ( j = 0; j < N*2; j++ ) { - x[ j ] = 20000.0f; - } - idx = -1; - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - idx = stdlib_strided_cindex_of_row_ndarray( N, N, (stdlib_complex64_t *)A, N, 1, 0, (stdlib_complex64_t *)x, 1, 0, workspace, 1, 0 ); - if ( idx < -2 ) { - printf( "unexpected result\n" ); - break; - } - } - elapsed = tic() - t; - if ( idx < -2 ) { - printf( "unexpected result\n" ); - } - free( A ); - free( x ); - free( workspace ); - return elapsed; -} - -/** -* Main execution sequence. -*/ -int main( void ) { - double elapsed; - int count; - int iter; - int len; - int N; - int i; - int j; - - // Use the current time to seed the random number generator: - srand( time( NULL ) ); - - print_version(); - count = 0; - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - N = (int)sqrt( (double)len ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::native::%s:square_matrix:order=row-major,size=%d\n", NAME, N*N ); - elapsed = benchmark1( iter, N ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::native::%s:ndarray:square_matrix:order=row-major,size=%d\n", NAME, N*N ); - elapsed = benchmark2( iter, N ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - print_summary( count, count ); -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/repl.txt deleted file mode 100644 index 15c9e6f2e275..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/repl.txt +++ /dev/null @@ -1,123 +0,0 @@ - -{{alias}}( order, M, N, A, LDA, x, strideX, workspace, strideW ) - Returns the index of the first row in a single-precision complex floating- - point input matrix which has the same elements as a provided search vector. - - Indexing is relative to the first index. To introduce an offset, use typed - array views. - - If the function is provided an empty matrix or if the function is unable to - find a matching row, the function returns `-1` (i.e., an invalid index). - - Parameters - ---------- - order: string - Row-major (C-style) or column-major (Fortran-style) order. Must be - either 'row-major' or 'column-major'. - - M: integer - Number of rows in `A`. - - N: integer - Number of columns in `A`. - - A: Complex64Array - Input matrix `A`. - - LDA: integer - Stride of the first dimension of `A` (a.k.a., leading dimension of the - matrix `A`). - - x: Complex64Array - Search vector. - - strideX: integer - Stride length for `x`. - - workspace: Uint8Array - Workspace array for tracking row match candidates. This parameter - is ignored if the input matrix is stored in row-major order. - - strideW: integer - Stride length for `workspace`. - - Returns - ------- - out: integer - Row index. - - Examples - -------- - > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 2.0, 0.0 ] ); - > var x = new {{alias:@stdlib/array/complex64}}( [ 2.0, 0.0 ] ); - > var w = new {{alias:@stdlib/array/uint8}}( 2 ); - > {{alias}}( 'column-major', 2, 1, A, 2, x, 1, w, 1 ) - 1 - - -{{alias}}.ndarray( M, N, A, sa1, sa2, oa, x, sx, ox, w, sw, ow ) - Returns the index of the first row in a single-precision complex floating- - point input matrix which has the same elements as a provided search vector - using alternative indexing semantics. - - While typed array views mandate a view offset based on the underlying - buffer, offset parameters support indexing semantics based on starting - indices. - - If the method is provided an empty matrix or if the method is unable to find - a matching row, the method returns `-1` (i.e., an invalid index). - - Parameters - ---------- - M: integer - Number of rows in `A`. - - N: integer - Number of columns in `A`. - - A: Complex64Array - Input matrix `A`. - - sa1: integer - Stride of the first dimension of `A`. - - sa2: integer - Stride of the second dimension of `A`. - - oa: integer - Starting index for `A`. - - x: Complex64Array - Search vector. - - sx: integer - Stride length for `x`. - - ox: integer - Starting index for `x`. - - w: Uint8Array - Workspace array for tracking row match candidates. This parameter - is ignored if the input matrix is stored in row-major order. - - sw: integer - Stride length for `w`. - - ow: integer - Starting index for `w`. - - Returns - ------- - out: integer - Row index. - - Examples - -------- - > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 2.0, 0.0 ] ); - > var x = new {{alias:@stdlib/array/complex64}}( [ 2.0, 0.0 ] ); - > var w = new {{alias:@stdlib/array/uint8}}( 2 ); - > {{alias}}.ndarray( 2, 1, A, 1, 2, 0, x, 1, 0, w, 1, 0 ) - 1 - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/index.d.ts deleted file mode 100644 index 77446642714b..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/index.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Complex64Array } from '@stdlib/types/array'; -import { Layout } from '@stdlib/types/blas'; - -/** -* Interface describing `cindexOfRow`. -*/ -interface Routine { - /** - * Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. - * - * ## Notes - * - * - If the function is provided an empty matrix or if the function is unable to find a search vector, the function returns `-1` (i.e., an invalid index). - * - The `workspace` array is only applicable when an input matrix is stored in column-major order. When the matrix is stored in row-major order, the workspace array is ignored. - * - * @param order - storage layout - * @param M - number of rows in `A` - * @param N - number of columns in `A` - * @param A - input matrix - * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) - * @param x - search vector - * @param strideX - stride length for `x` - * @param workspace - workspace array for tracking row match candidates - * @param strideW - stride length for `workspace` - * @returns row index - * - * @example - * var Complex64Array = require( `@stdlib/array/complex64` ); - * var Uint8Array = require( `@stdlib/array/uint8` ); - * - * var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); - * var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); - * var workspace = new Uint8Array( 3 ); - * - * var out = cindexOfRow( 'column-major', 3, 2, A, 3, x, 1, workspace, 1 ); - * // returns 1 - */ - ( order: Layout, M: number, N: number, A: Complex64Array, LDA: number, x: Complex64Array, strideX: number, workspace: Uint8Array, strideW: number ): number; - - /** - * Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. - * - * ## Notes - * - * - If the function is provided an empty matrix or if the function is unable to find a search vector, the function returns `-1` (i.e., an invalid index). - * - The `workspace` array is only applicable when an input matrix is stored in column-major order. When the matrix is stored in row-major order, the workspace array is ignored. - * - * @param M - number of rows in `A` - * @param N - number of columns in `A` - * @param A - input matrix - * @param strideA1 - stride of the first dimension of `A` - * @param strideA2 - stride of the second dimension of `A` - * @param offsetA - starting index for `A` - * @param x - search vector - * @param strideX - stride length for `x` - * @param offsetX - starting index for `x` - * @param workspace - workspace array for tracking row match candidates - * @param strideW - stride length for `workspace` - * @param offsetW - starting index for `workspace` - * @returns row index - * - * @example - * var Complex64Array = require( `@stdlib/array/complex64` ); - * var Uint8Array = require( `@stdlib/array/uint8` ); - * - * var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); - * var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); - * var workspace = new Uint8Array( 3 ); - * - * var out = cindexOfRow.ndarray( 3, 2, A, 1, 3, 0, x, 1, 0, workspace, 1, 0 ); - * // returns 1 - */ - ndarray( M: number, N: number, A: Complex64Array, strideA1: number, strideA2: number, offsetA: number, x: Complex64Array, strideX: number, offsetX: number, workspace: Uint8Array, strideW: number, offsetW: number ): number; -} - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -* -* ## Notes -* -* - If the function is provided an empty matrix or if the function is unable to find a search vector, the function returns `-1` (i.e., an invalid index). -* - The `workspace` array is only applicable when an input matrix is stored in column-major order. When the matrix is stored in row-major order, the workspace array is ignored. -* -* @param order - storage layout -* @param M - number of rows in `A` -* @param N - number of columns in `A` -* @param A - input matrix -* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) -* @param x - search vector -* @param strideX - stride length for `x` -* @param workspace - workspace array for tracking row match candidates -* @param strideW - stride length for `workspace` -* @returns row index -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var Uint8Array = require( `@stdlib/array/uint8` ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 'column-major', 3, 2, A, 3, x, 1, workspace, 1 ); -* // returns 1 -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var Uint8Array = require( `@stdlib/array/uint8` ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow.ndarray( 3, 2, A, 1, 3, 0, x, 1, 0, workspace, 1, 0 ); -* // returns 1 -*/ -declare var cindexOfRow: Routine; - - -// EXPORTS // - -export = cindexOfRow; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/test.ts deleted file mode 100644 index 275714e5cb04..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/docs/types/test.ts +++ /dev/null @@ -1,404 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import Complex64Array = require( '@stdlib/array/complex64' ); -import cindexOfRow = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, 1 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 5, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( true, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( false, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( null, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( void 0, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( [], 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( {}, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( ( x: number ): number => x, 2, 2, A, 2, x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', '5', 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', true, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', false, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', null, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', void 0, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', [], 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', {}, 2, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', ( x: number ): number => x, 2, A, 2, x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, '5', A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, true, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, false, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, null, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, void 0, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, [], A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, {}, A, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, ( x: number ): number => x, A, 2, x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fourth argument which is not a Complex64Array... -{ - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, 5, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, true, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, false, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, null, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, void 0, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, {}, 2, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, ( x: number ): number => x, 2, x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fifth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, A, '5', x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, true, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, false, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, null, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, void 0, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, [], x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, {}, x, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, ( x: number ): number => x, x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a sixth argument which is not a Complex64Array... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, A, 2, 5, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, true, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, false, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, null, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, void 0, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, {}, 1, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, ( x: number ): number => x, 1, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a seventh argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, A, 2, x, '5', w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, true, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, false, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, null, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, void 0, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, [], w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, {}, w, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, ( x: number ): number => x, w, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an eighth argument which is not a Uint8Array... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, 5, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, true, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, false, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, null, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, void 0, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, {}, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a ninth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, '5' ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, true ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, false ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, null ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, void 0 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, [] ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, {} ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow(); // $ExpectError - cindexOfRow( 'row-major' ); // $ExpectError - cindexOfRow( 'row-major', 2 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1 ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w ); // $ExpectError - cindexOfRow( 'row-major', 2, 2, A, 2, x, 1, w, 1, 0 ); // $ExpectError -} - -// Attached to main export is an `ndarray` method which returns a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectType number -} - -// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( '5', 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( true, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( false, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( null, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( void 0, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( [], 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( {}, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( ( x: number ): number => x, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, '5', A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, true, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, false, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, null, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, void 0, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, [], A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, {}, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, ( x: number ): number => x, A, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Complex64Array... -{ - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, 5, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, true, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, false, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, null, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, void 0, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, {}, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, ( x: number ): number => x, 2, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, '5', 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, true, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, false, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, null, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, void 0, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, [], 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, {}, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, ( x: number ): number => x, 1, 0, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, '5', 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, true, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, false, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, null, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, void 0, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, [], 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, {}, 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, ( x: number ): number => x, 0, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, '5', x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, true, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, false, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, null, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, void 0, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, [], x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, {}, x, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, ( x: number ): number => x, x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a Complex64Array... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, 5, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, true, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, false, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, null, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, void 0, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, {}, 1, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, ( x: number ): number => x, 1, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, '5', 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, true, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, false, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, null, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, void 0, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, [], 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, {}, 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, ( x: number ): number => x, 0, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, '5', w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, true, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, false, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, null, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, void 0, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, [], w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, {}, w, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, ( x: number ): number => x, w, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a Uint8Array... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, 5, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, true, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, false, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, null, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, void 0, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, {}, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, '5', 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, true, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, false, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, null, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, void 0, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, [], 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, {}, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a number... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, '5' ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, true ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, false ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, null ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, void 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, [] ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, {} ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... -{ - const A = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - const x = new Complex64Array( [ 3.0, 4.0 ] ); - const w = new Uint8Array( 2 ); - - cindexOfRow.ndarray(); // $ExpectError - cindexOfRow.ndarray( 2 ); // $ExpectError - cindexOfRow.ndarray( 2, 2 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1 ); // $ExpectError - cindexOfRow.ndarray( 2, 2, A, 2, 1, 0, x, 1, 0, w, 1, 0, 0 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/c/example.c deleted file mode 100644 index 53bf355e29e0..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/c/example.c +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/ext/base/cindex_of_row.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" -#include - -int main( void ) { - // Create a matrix (row-major, 2x2, interleaved real and imaginary components): - const float A[] = { 1.0f, 0.0f, 2.0f, 0.0f, 3.0f, 0.0f, 4.0f, 0.0f }; - - // Create a search vector (interleaved real and imaginary components): - const float x[] = { 3.0f, 0.0f, 4.0f, 0.0f }; - - // Specify the number of matrix rows and columns: - const int M = 2; - const int N = 2; - - // Perform a search: - int idx = stdlib_strided_cindex_of_row( CblasRowMajor, M, N, (const stdlib_complex64_t *)A, N, (const stdlib_complex64_t *)x, 1, NULL, 1 ); - - // Print the result: - printf( "index value: %d\n", idx ); -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/index.js deleted file mode 100644 index 92227d535908..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var cindexOfRow = require( './../lib' ); - -var shape = [ 2, 2 ]; -var order = 'row-major'; -var strides = shape2strides( shape, order ); - -var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); -console.log( ndarray2array( A, shape, strides, 0, order ) ); - -var x = new Complex64Array( [ 3.0, 0.0, 4.0, 0.0 ] ); -console.log( x ); - -var workspace = new Uint8Array( shape[ 0 ] ); - -var out = cindexOfRow( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ], x, 1, workspace, 1 ); // eslint-disable-line max-len -console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/include/stdlib/blas/ext/base/cindex_of_row.h b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/include/stdlib/blas/ext/base/cindex_of_row.h deleted file mode 100644 index c57676306aa7..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/include/stdlib/blas/ext/base/cindex_of_row.h +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_BLAS_EXT_BASE_CINDEX_OF_ROW_H -#define STDLIB_BLAS_EXT_BASE_CINDEX_OF_ROW_H - -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/blas/base/shared.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -*/ -CBLAS_INT API_SUFFIX(stdlib_strided_cindex_of_row)( const CBLAS_LAYOUT order, const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT LDA, const stdlib_complex64_t *X, const CBLAS_INT strideX, uint8_t *workspace, const CBLAS_INT strideW ); - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. -*/ -CBLAS_INT API_SUFFIX(stdlib_strided_cindex_of_row_ndarray)( const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, uint8_t *workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_BLAS_EXT_BASE_CINDEX_OF_ROW_H diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.js deleted file mode 100644 index f4e54fccb47d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); -var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); -var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); -var stride2offset = require( '@stdlib/strided/base/stride2offset' ); -var max = require( '@stdlib/math/base/special/fast/max' ); -var format = require( '@stdlib/string/format' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -* -* ## Notes -* -* - If the function is provided an empty matrix or if the function is unable to find a search vector, the function returns `-1` (i.e., an invalid index). -* - The `workspace` array is only applicable when an input matrix is stored in column-major order. When the matrix is stored in row-major order, the workspace array is ignored. -* -* @param {string} order - storage layout -* @param {PositiveInteger} M - number of rows in `A` -* @param {PositiveInteger} N - number of columns in `A` -* @param {Complex64Array} A - input matrix -* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) -* @param {Complex64Array} x - search vector -* @param {integer} strideX - stride length for `x` -* @param {Uint8Array} workspace - workspace array for tracking row match candidates -* @param {integer} strideW - stride length for `workspace` -* @throws {TypeError} first argument must be a valid order -* @throws {RangeError} fifth argument must be greater than or equal to max(1,N) -* @returns {integer} row index -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 'column-major', 3, 2, A, 3, x, 1, workspace, 1 ); -* // returns 1 -*/ -function cindexOfRow( order, M, N, A, LDA, x, strideX, workspace, strideW ) { - var sa1; - var sa2; - var s; - if ( !isLayout( order ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); - } - if ( isRowMajor( order ) ) { - s = N; - } else { - s = M; - } - if ( LDA < max( 1, s ) ) { - throw new RangeError( format( 'invalid argument. Fifth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) ); - } - if ( isColumnMajor( order ) ) { - sa1 = 1; - sa2 = LDA; - } else { // order === 'row-major' - sa1 = LDA; - sa2 = 1; - } - return ndarray( M, N, A, sa1, sa2, 0, x, strideX, stride2offset( N, strideX ), workspace, strideW, stride2offset( M, strideW ) ); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = cindexOfRow; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.native.js deleted file mode 100644 index 5d1e743c5812..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/cindex_of_row.native.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); -var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); -var max = require( '@stdlib/math/base/special/fast/max' ); -var resolveOrder = require( '@stdlib/blas/base/layout-resolve-enum' ); -var format = require( '@stdlib/string/format' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -* -* @param {string} order - storage layout -* @param {PositiveInteger} M - number of rows in `A` -* @param {PositiveInteger} N - number of columns in `A` -* @param {Complex64Array} A - input matrix -* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) -* @param {Complex64Array} x - search vector -* @param {integer} strideX - stride length for `x` -* @param {Uint8Array} workspace - workspace array for tracking row match candidates -* @param {integer} strideW - stride length for `workspace` -* @throws {TypeError} first argument must be a valid order -* @throws {RangeError} fifth argument must be greater than or equal to max(1,N) -* @returns {integer} row index -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 'column-major', 3, 2, A, 3, x, 1, workspace, 1 ); -* // returns 1 -*/ -function cindexOfRow( order, M, N, A, LDA, x, strideX, workspace, strideW ) { - var s; - if ( !isLayout( order ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); - } - if ( isRowMajor( order ) ) { - s = N; - } else { - s = M; - } - if ( LDA < max( 1, s ) ) { - throw new RangeError( format( 'invalid argument. Fifth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) ); - } - return addon( resolveOrder( order ), M, N, reinterpret( A, 0 ), LDA, reinterpret( x, 0 ), strideX, workspace, strideW ); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = cindexOfRow; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/index.js deleted file mode 100644 index 5d40aa1b8234..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/index.js +++ /dev/null @@ -1,74 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -* -* @module @stdlib/blas/ext/base/cindex-of-row -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* var cindexOfRow = require( '@stdlib/blas/ext/base/cindex-of-row' ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 'column-major', 3, 2, A, 3, x, 1, workspace, 1 ); -* // returns 1 -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* var cindexOfRow = require( '@stdlib/blas/ext/base/cindex-of-row' ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow.ndarray( 3, 2, A, 1, 3, 0, x, 1, 0, workspace, 1, 0 ); -* // returns 1 -*/ - -// MODULES // - -var join = require( 'path' ).join; -var tryRequire = require( '@stdlib/utils/try-require' ); -var isError = require( '@stdlib/assert/is-error' ); -var main = require( './main.js' ); - - -// MAIN // - -var cindexOfRow; -var tmp = tryRequire( join( __dirname, './native.js' ) ); -if ( isError( tmp ) ) { - cindexOfRow = main; -} else { - cindexOfRow = tmp; -} - - -// EXPORTS // - -module.exports = cindexOfRow; - -// exports: { "ndarray": "cindexOfRow.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.js deleted file mode 100644 index 5a9af0aedc26..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.js +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-params, max-len */ - -'use strict'; - -// MODULES // - -var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); - - -// MAIN // - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. -* -* ## Notes -* -* - If the function is provided an empty matrix or if the function is unable to find a search vector, the function returns `-1` (i.e., an invalid index). -* - The `workspace` array is only applicable when an input matrix is stored in column-major order. When the matrix is stored in row-major order, the workspace array is ignored. -* -* @param {PositiveInteger} M - number of rows in `A` -* @param {PositiveInteger} N - number of columns in `A` -* @param {Complex64Array} A - input matrix -* @param {integer} strideA1 - stride of the first dimension of `A` -* @param {integer} strideA2 - stride of the second dimension of `A` -* @param {NonNegativeInteger} offsetA - index offset for `A` -* @param {Complex64Array} x - search vector -* @param {integer} strideX - stride length for `x` -* @param {NonNegativeInteger} offsetX - index offset for `x` -* @param {Uint8Array} workspace - workspace array for tracking row match candidates -* @param {integer} strideW - stride length for `workspace` -* @param {NonNegativeInteger} offsetW - index offset for `workspace` -* @returns {integer} row index -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* -* // A (column-major) => [ [ 1+0i, 3+0i ], [ 2+0i, 4+0i ], [ 0+0i, 0+0i ] ] -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 3, 2, A, 1, 3, 0, x, 1, 0, workspace, 1, 0 ); -* // returns 1 -*/ -function cindexOfRow( M, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX, workspace, strideW, offsetW ) { - var abuf; - var xbuf; - var da0; - var da1; - var S0; - var S1; - var ia; - var iw; - var ix; - var i0; - var i1; - - // Check whether the matrix is an empty matrix... - if ( M <= 0 || N <= 0 ) { - return -1; - } - // Reinterpret the complex input arrays as real-valued arrays of interleaved real and imaginary components: - abuf = reinterpret( A, 0 ); - xbuf = reinterpret( x, 0 ); - - // Adjust the strides and offsets to account for the interleaved storage: - strideA1 *= 2; - strideA2 *= 2; - offsetA *= 2; - strideX *= 2; - offsetX *= 2; - - // Search for the first row matching the search vector... - if ( isRowMajor( [ strideA1, strideA2 ] ) ) { - S0 = N; - S1 = M; - - // Scan a row-major linear buffer from the first indexed element to the last indexed element, always moving in the same direction when both strides are the same sign, thus ensuring cache optimal traversal... - for ( i1 = 0; i1 < S1; i1++ ) { - ia = offsetA + ( i1*strideA1 ); - ix = offsetX; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( abuf[ ia ] !== xbuf[ ix ] || abuf[ ia+1 ] !== xbuf[ ix+1 ] ) { - // We found an element which is not in the search vector... - break; - } - ia += strideA2; - ix += strideX; - } - // If we successfully iterated over all columns, then that means we've found a match... - if ( i0 === S0 ) { - return i1; - } - } - // If we've made it here, then no rows match the search vector: - return -1; - } - // Column-major... - S0 = M; - S1 = N; - - // Resolve loop offset (pointer) increments: - da0 = strideA1; - da1 = strideA2 - ( S0*strideA1 ); - - // Initialize the workspace array for tracking which rows contain matching elements: - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - workspace[ iw ] = 1; - iw += strideW; - } - - // Finding the first matching row when a matrix is stored in column-major order requires effectively performing a full linear scan. In order to ensure cache-efficient traversal, scan down each column (otherwise, if we went row-by-row, we'd hop around linear memory, resulting in poor cache behavior)... - ia = offsetA; - ix = offsetX; - for ( i1 = 0; i1 < S1; i1++ ) { - // Scan down the rows in a column looking for a matching element... - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( abuf[ ia ] !== xbuf[ ix ] || abuf[ ia+1 ] !== xbuf[ ix+1 ] ) { - // We found a non-matching element, which means we can exclude this row from the list of row candidates... - workspace[ iw ] = 0; - } - ia += da0; - iw += strideW; - } - ia += da1; - ix += strideX; - } - // Search for the first matching row... - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( workspace[ iw ] === 1 ) { - break; - } - iw += strideW; - } - return ( i0 === S0 ) ? -1 : i0; -} - - -// EXPORTS // - -module.exports = cindexOfRow; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.native.js deleted file mode 100644 index bffadd1ceaf7..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/ndarray.native.js +++ /dev/null @@ -1,66 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-params, max-len */ - -'use strict'; - -// MODULES // - -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. -* -* @param {PositiveInteger} M - number of rows in `A` -* @param {PositiveInteger} N - number of columns in `A` -* @param {Complex64Array} A - input matrix -* @param {integer} strideA1 - stride of the first dimension of `A` -* @param {integer} strideA2 - stride of the second dimension of `A` -* @param {NonNegativeInteger} offsetA - index offset for `A` -* @param {Complex64Array} x - search vector -* @param {integer} strideX - stride length for `x` -* @param {NonNegativeInteger} offsetX - index offset for `x` -* @param {Uint8Array} workspace - workspace array for tracking row match candidates -* @param {integer} strideW - stride length for `workspace` -* @param {NonNegativeInteger} offsetW - index offset for `workspace` -* @returns {integer} row index -* -* @example -* var Complex64Array = require( '@stdlib/array/complex64' ); -* var Uint8Array = require( '@stdlib/array/uint8' ); -* -* var A = new Complex64Array( [ 1.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0 ] ); -* var x = new Complex64Array( [ 2.0, 0.0, 4.0, 0.0 ] ); -* var workspace = new Uint8Array( 3 ); -* -* var out = cindexOfRow( 3, 2, A, 1, 3, 0, x, 1, 0, workspace, 1, 0 ); -* // returns 1 -*/ -function cindexOfRow( M, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX, workspace, strideW, offsetW ) { - return addon.ndarray( M, N, reinterpret( A, 0 ), strideA1, strideA2, offsetA, reinterpret( x, 0 ), strideX, offsetX, workspace, strideW, offsetW ); -} - - -// EXPORTS // - -module.exports = cindexOfRow; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/package.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/package.json deleted file mode 100644 index c94cdd1901b9..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/blas/ext/base/cindex-of-row", - "version": "0.0.0", - "description": "Return the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "browser": "./lib/main.js", - "gypfile": true, - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "include": "./include", - "lib": "./lib", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "blas", - "matrix", - "strided", - "array", - "ndarray", - "vector", - "row", - "index", - "search", - "find", - "index-of", - "indexof", - "complex", - "complex64", - "complex64array" - ] -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/addon.c deleted file mode 100644 index 59b70e044f13..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/addon.c +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/ext/base/cindex_of_row.h" -#include "stdlib/blas/base/shared.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/napi/export.h" -#include "stdlib/napi/argv.h" -#include "stdlib/napi/argv_int32.h" -#include "stdlib/napi/argv_int64.h" -#include "stdlib/napi/argv_strided_complex64array.h" -#include "stdlib/napi/argv_strided_complex64array2d.h" -#include "stdlib/napi/argv_strided_uint8array.h" -#include "stdlib/napi/create_int32.h" -#include -#include - -/** -* Receives JavaScript callback invocation data. -* -* @param env environment under which the function is invoked -* @param info callback data -* @return Node-API value -*/ -static napi_value addon( napi_env env, napi_callback_info info ) { - CBLAS_INT sa1; - CBLAS_INT sa2; - CBLAS_INT MW; - - STDLIB_NAPI_ARGV( env, info, argv, argc, 9 ); - STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 ); - STDLIB_NAPI_ARGV_INT64( env, M, argv, 1 ); - STDLIB_NAPI_ARGV_INT64( env, N, argv, 2 ); - STDLIB_NAPI_ARGV_INT64( env, LDA, argv, 4 ); - STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 6 ); - STDLIB_NAPI_ARGV_INT64( env, strideW, argv, 8 ); - - if ( order == CblasColMajor ) { - sa1 = 1; - sa2 = LDA; - MW = M; - } else { // order == CblasRowMajor - sa1 = LDA; - sa2 = 1; - MW = 0; - } - STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY2D( env, A, M, N, sa1, sa2, argv, 3 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 5 ); - STDLIB_NAPI_ARGV_STRIDED_UINT8ARRAY( env, W, MW, strideW, argv, 7 ); - STDLIB_NAPI_CREATE_INT32( env, API_SUFFIX(stdlib_strided_cindex_of_row)( order, M, N, (stdlib_complex64_t *)A, LDA, (stdlib_complex64_t *)X, strideX, W, strideW ), idx ); - return idx; -} - -/** -* Receives JavaScript callback invocation data. -* -* @param env environment under which the function is invoked -* @param info callback data -* @return Node-API value -*/ -static napi_value addon_method( napi_env env, napi_callback_info info ) { - CBLAS_INT MW; - - STDLIB_NAPI_ARGV( env, info, argv, argc, 12 ); - STDLIB_NAPI_ARGV_INT64( env, M, argv, 0 ); - STDLIB_NAPI_ARGV_INT64( env, N, argv, 1 ); - STDLIB_NAPI_ARGV_INT64( env, strideA1, argv, 3 ); - STDLIB_NAPI_ARGV_INT64( env, strideA2, argv, 4 ); - STDLIB_NAPI_ARGV_INT64( env, offsetA, argv, 5 ); - STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 7 ); - STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 8 ); - STDLIB_NAPI_ARGV_INT64( env, strideW, argv, 10 ); - STDLIB_NAPI_ARGV_INT64( env, offsetW, argv, 11 ); - - // Only validate workspace elements for column-major matrices: - if ( strideA1 < strideA2 ) { - MW = M; - } else { - MW = 0; - } - STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY2D( env, A, M, N, strideA1, strideA2, argv, 2 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 6 ); - STDLIB_NAPI_ARGV_STRIDED_UINT8ARRAY( env, W, MW, strideW, argv, 9 ); - STDLIB_NAPI_CREATE_INT32( env, API_SUFFIX(stdlib_strided_cindex_of_row_ndarray)( M, N, (stdlib_complex64_t *)A, strideA1, strideA2, offsetA, (stdlib_complex64_t *)X, strideX, offsetX, W, strideW, offsetW ), idx ); - return idx; -} - -STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/main.c deleted file mode 100644 index 684bfcea30d3..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/main.c +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/ext/base/cindex_of_row.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/real.h" -#include "stdlib/complex/float32/imag.h" -#include "stdlib/strided/base/stride2offset.h" -#include "stdlib/blas/base/shared.h" -#include - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector. -* -* @param order storage layout -* @param M number of rows in `A` -* @param N number of columns in `A` -* @param A input matrix -* @param LDA stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) -* @param X search vector -* @param strideX stride length for `X` -* @param workspace workspace array for tracking row match candidates -* @param strideW stride length for `workspace` -* @return row index -*/ -CBLAS_INT API_SUFFIX(stdlib_strided_cindex_of_row)( const CBLAS_LAYOUT order, const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT LDA, const stdlib_complex64_t *X, const CBLAS_INT strideX, uint8_t *workspace, const CBLAS_INT strideW ) { - CBLAS_INT sa1; - CBLAS_INT sa2; - CBLAS_INT ox; - CBLAS_INT ow; - - if ( order == CblasRowMajor ) { - sa1 = LDA; - sa2 = 1; - } else { // order == CblasColMajor - sa1 = 1; - sa2 = LDA; - } - ox = stdlib_strided_stride2offset( N, strideX ); - ow = stdlib_strided_stride2offset( M, strideW ); - return API_SUFFIX(stdlib_strided_cindex_of_row_ndarray)( M, N, A, sa1, sa2, 0, X, strideX, ox, workspace, strideW, ow ); -} - -/** -* Returns the index of the first row in a single-precision complex floating-point input matrix which has the same elements as a provided search vector using alternative indexing semantics. -* -* @param M number of rows in `A` -* @param N number of columns in `A` -* @param A input matrix -* @param strideA1 stride of the first dimension of `A` -* @param strideA2 stride of the second dimension of `A` -* @param offsetA index offset for `A` -* @param X search vector -* @param strideX stride length for `X` -* @param offsetX starting index for `X` -* @param workspace workspace array for tracking row match candidates -* @param strideW stride length for `workspace` -* @param offsetW starting index for `workspace` -* @return row index -*/ -CBLAS_INT API_SUFFIX(stdlib_strided_cindex_of_row_ndarray)( const CBLAS_INT M, const CBLAS_INT N, const stdlib_complex64_t *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, uint8_t *workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW ) { - stdlib_complex64_t va; - stdlib_complex64_t vx; - CBLAS_INT da0; - CBLAS_INT da1; - CBLAS_INT S0; - CBLAS_INT S1; - CBLAS_INT ia; - CBLAS_INT iw; - CBLAS_INT ix; - CBLAS_INT i0; - CBLAS_INT i1; - - // Check whether the matrix is an empty matrix... - if ( M <= 0 || N <= 0 ) { - return -1; - } - // Search for the first row matching the search vector... - if ( strideA1 >= strideA2 ) { - // Row-major... - S0 = N; - S1 = M; - - // Scan a row-major linear buffer from the first indexed element to the last indexed element, always moving in the same direction when both strides are the same sign, thus ensuring cache optimal traversal... - for ( i1 = 0; i1 < S1; i1++ ) { - ia = offsetA + ( i1*strideA1 ); - ix = offsetX; - for ( i0 = 0; i0 < S0; i0++ ) { - va = A[ ia ]; - vx = X[ ix ]; - if ( stdlib_complex64_real( va ) != stdlib_complex64_real( vx ) || stdlib_complex64_imag( va ) != stdlib_complex64_imag( vx ) ) { - // We found an element which is not in the search vector... - break; - } - ia += strideA2; - ix += strideX; - } - // If we successfully iterated over all columns, then that means we've found a match... - if ( i0 == S0 ) { - return i1; - } - } - // If we've made it here, then no rows match the search vector: - return -1; - } - // Column-major... - S0 = M; - S1 = N; - - // Resolve loop offset (pointer) increments: - da0 = strideA1; - da1 = strideA2 - ( S0*strideA1 ); - - // Initialize the workspace array for tracking which rows contain matching elements: - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - workspace[ iw ] = 1; - iw += strideW; - } - - // Finding the first matching row when a matrix is stored in column-major order requires effectively performing a full linear scan. In order to ensure cache-efficient traversal, scan down each column (otherwise, if we went row-by-row, we'd hop around linear memory, resulting in poor cache behavior)... - ia = offsetA; - ix = offsetX; - for ( i1 = 0; i1 < S1; i1++ ) { - // Scan down the rows in a column looking for a matching element... - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - va = A[ ia ]; - vx = X[ ix ]; - if ( stdlib_complex64_real( va ) != stdlib_complex64_real( vx ) || stdlib_complex64_imag( va ) != stdlib_complex64_imag( vx ) ) { - // We found a non-matching element, which means we can exclude this row from the list of row candidates... - workspace[ iw ] = 0; - } - ia += da0; - iw += strideW; - } - ia += da1; - ix += strideX; - } - // Search for the first matching row... - iw = offsetW; - for ( i0 = 0; i0 < S0; i0++ ) { - if ( workspace[ iw ] == 1 ) { - break; - } - iw += strideW; - } - return ( i0 == S0 ) ? -1 : i0; -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major.json deleted file mode 100644 index 2516430cd379..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 1, - 0, - 2, - 0, - 2, - 0, - 0, - 0, - 3, - 0, - 4, - 0, - 4, - 0, - 0, - 0 - ], - "M": 4, - "N": 2, - "strideA1": 1, - "strideA2": 4, - "offsetA": 0, - "LDA": 4, - "x": [ - 2, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major_no_match.json deleted file mode 100644 index 80f1d75f4eba..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/column_major_no_match.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "order": "column-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 1, - "strideA2": 3, - "offsetA": 0, - "LDA": 3, - "x": [ - 2, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major.json deleted file mode 100644 index 17359fb1cf27..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "order": "column-major", - "A": [ - 1, - 0, - 9999, - 0, - 2, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 2, - "strideA2": 6, - "offsetA": 0, - "LDA": 3, - "x": [ - 2, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major_no_match.json deleted file mode 100644 index d9eb3c4ae322..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/column_major_no_match.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "order": "column-major", - "A": [ - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 2, - "strideA2": 6, - "offsetA": 0, - "LDA": 3, - "x": [ - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major.json deleted file mode 100644 index 2f55c8fc8c7e..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "order": "row-major", - "A": [ - 1, - 0, - 9999, - 0, - 2, - 0, - 9999, - 0, - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 4, - "strideA2": 2, - "offsetA": 0, - "LDA": 2, - "x": [ - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major_no_match.json deleted file mode 100644 index 57e1ee28ba53..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/large-strides/row_major_no_match.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0, - 0, - 0, - 9999, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 4, - "strideA2": 2, - "offsetA": 0, - "LDA": 2, - "x": [ - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major.json deleted file mode 100644 index a5deebbfee34..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 3, - 0, - 4, - 0, - 0, - 0, - 1, - 0, - 2, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 1, - "strideA2": -3, - "offsetA": 3, - "LDA": 3, - "x": [ - 4, - 0, - 9999, - 0, - 2, - 0, - 9999, - 0 - ], - "strideX": -2, - "offsetX": 2, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major_no_match.json deleted file mode 100644 index bf67233605ee..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/column_major_no_match.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 1, - "strideA2": -3, - "offsetA": 3, - "LDA": 3, - "x": [ - 4, - 0, - 9999, - 0, - 3, - 0, - 9999, - 0 - ], - "strideX": -2, - "offsetX": 2, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major.json deleted file mode 100644 index c532893b51bc..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 0, - 0, - 3, - 0, - 4, - 0, - 1, - 0, - 2, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -2, - "strideA2": 1, - "offsetA": 4, - "LDA": 2, - "x": [ - 9999, - 0, - 4, - 0, - 9999, - 0, - 3, - 0, - 9999, - 0 - ], - "strideX": -2, - "offsetX": 3, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major_no_match.json deleted file mode 100644 index 2f27c2cedb05..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/mixed-strides/row_major_no_match.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -2, - "strideA2": 1, - "offsetA": 4, - "LDA": 2, - "x": [ - 9999, - 0, - 4, - 0, - 9999, - 0, - 3, - 0, - 9999, - 0 - ], - "strideX": -2, - "offsetX": 3, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major.json deleted file mode 100644 index 148795457b90..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 0, - 0, - 4, - 0, - 3, - 0, - 0, - 0, - 2, - 0, - 1, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -1, - "strideA2": -3, - "offsetA": 5, - "LDA": 3, - "x": [ - 2, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major_no_match.json deleted file mode 100644 index 60d93fbd27a7..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/column_major_no_match.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -1, - "strideA2": -3, - "offsetA": 5, - "LDA": 3, - "x": [ - 2, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major.json deleted file mode 100644 index b48271bad0f2..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 0, - 0, - 4, - 0, - 3, - 0, - 2, - 0, - 1, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -2, - "strideA2": -1, - "offsetA": 5, - "LDA": 2, - "x": [ - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major_no_match.json deleted file mode 100644 index 182565cfa50d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/negative-strides/row_major_no_match.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": -2, - "strideA2": -1, - "offsetA": 5, - "LDA": 2, - "x": [ - 3, - 0, - 9999, - 0, - 4, - 0, - 9999, - 0 - ], - "strideX": 2, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major.json deleted file mode 100644 index 0ce114369508..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 9999, - 0, - 1, - 0, - 2, - 0, - 0, - 0, - 3, - 0, - 4, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 1, - "strideA2": 3, - "offsetA": 1, - "LDA": 3, - "x": [ - 9999, - 0, - 2, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 1, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major_no_match.json deleted file mode 100644 index 9c136f0e8ded..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/column_major_no_match.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "column-major", - "A": [ - 9999, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 1, - "strideA2": 3, - "offsetA": 1, - "LDA": 3, - "x": [ - 9999, - 0, - 3, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 1, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major.json deleted file mode 100644 index 8ee26b57a59c..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "row-major", - "A": [ - 9999, - 0, - 1, - 0, - 2, - 0, - 3, - 0, - 4, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 2, - "strideA2": 1, - "offsetA": 1, - "LDA": 2, - "x": [ - 9999, - 0, - 3, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 1, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major_no_match.json deleted file mode 100644 index 9c162ff7f205..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/offsets/row_major_no_match.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "row-major", - "A": [ - 9999, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 2, - "strideA2": 1, - "offsetA": 1, - "LDA": 2, - "x": [ - 9999, - 0, - 3, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 1, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major.json deleted file mode 100644 index 5b69093877d4..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "order": "row-major", - "A": [ - 1, - 0, - 2, - 0, - 3, - 0, - 4, - 0, - 3, - 0, - 4, - 0, - 0, - 0, - 0, - 0 - ], - "M": 4, - "N": 2, - "strideA1": 2, - "strideA2": 1, - "offsetA": 0, - "LDA": 2, - "x": [ - 3, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 0, - "expected": 1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major_no_match.json b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major_no_match.json deleted file mode 100644 index 9396391db82b..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/fixtures/row_major_no_match.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "order": "row-major", - "A": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "M": 3, - "N": 2, - "strideA1": 2, - "strideA2": 1, - "offsetA": 0, - "LDA": 2, - "x": [ - 3, - 0, - 4, - 0 - ], - "strideX": 1, - "offsetX": 0, - "expected": -1 -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.js deleted file mode 100644 index 51d9ef22880e..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.js +++ /dev/null @@ -1,199 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-len */ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var cindexOfRow = require( './../lib/cindex_of_row.js' ); - - -// FIXTURES // - -var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); -var ROW_MAJOR_NO_MATCH = require( './fixtures/row_major_no_match.json' ); -var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); -var COLUMN_MAJOR_NO_MATCH = require( './fixtures/column_major_no_match.json' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cindexOfRow, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 9', function test( t ) { - t.strictEqual( cindexOfRow.length, 9, 'returns expected value' ); - t.end(); -}); - -tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { - var values; - var data; - var i; - - data = ROW_MAJOR_DATA; - - values = [ - 'foo', - 'bar', - 'beep', - 'boop', - -5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( value, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (row-major)', function test( t ) { - var values; - var data; - var i; - - data = ROW_MAJOR_DATA; - - values = [ - 0, - 1 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), value, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (column-major)', function test( t ) { - var values; - var data; - var i; - - data = COLUMN_MAJOR_DATA; - - values = [ - 0, - 1 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), value, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, 0, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, 0, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.native.js deleted file mode 100644 index 66a3507d1a4d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.cindex_of_row.native.js +++ /dev/null @@ -1,208 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-len */ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var cindexOfRow = tryRequire( resolve( __dirname, './../lib/cindex_of_row.native.js' ) ); -var opts = { - 'skip': ( cindexOfRow instanceof Error ) -}; - - -// FIXTURES // - -var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); -var ROW_MAJOR_NO_MATCH = require( './fixtures/row_major_no_match.json' ); -var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); -var COLUMN_MAJOR_NO_MATCH = require( './fixtures/column_major_no_match.json' ); - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cindexOfRow, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 9', opts, function test( t ) { - t.strictEqual( cindexOfRow.length, 9, 'returns expected value' ); - t.end(); -}); - -tape( 'the function throws an error if provided a first argument which is not a valid order', opts, function test( t ) { - var values; - var data; - var i; - - data = ROW_MAJOR_DATA; - - values = [ - 'foo', - 'bar', - 'beep', - 'boop', - -5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( value, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (row-major)', opts, function test( t ) { - var values; - var data; - var i; - - data = ROW_MAJOR_DATA; - - values = [ - 0, - 1 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), value, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (column-major)', opts, function test( t ) { - var values; - var data; - var i; - - data = COLUMN_MAJOR_DATA; - - values = [ - 0, - 1 - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), value, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - }; - } -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, 0, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, 0, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.order, data.M, data.N, new Complex64Array( data.A ), data.LDA, new Complex64Array( data.x ), data.strideX, new Uint8Array( data.M ), 1 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.js deleted file mode 100644 index 31c7a6770fcf..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var cindexOfRow = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': IS_BROWSER -}; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cindexOfRow, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { - t.strictEqual( typeof cindexOfRow.ndarray, 'function', 'method is a function' ); - t.end(); -}); - -tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { - var cindexOfRow = proxyquire( './../lib', { - '@stdlib/utils/try-require': tryRequire - }); - - t.strictEqual( cindexOfRow, mock, 'returns expected value' ); - t.end(); - - function tryRequire() { - return mock; - } - - function mock() { - // Mock... - } -}); - -tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { - var cindexOfRow; - var main; - - main = require( './../lib/cindex_of_row.js' ); - - cindexOfRow = proxyquire( './../lib', { - '@stdlib/utils/try-require': tryRequire - }); - - t.strictEqual( cindexOfRow, main, 'returns expected value' ); - t.end(); - - function tryRequire() { - return new Error( 'Cannot find module' ); - } -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.js deleted file mode 100644 index e939caf84490..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.js +++ /dev/null @@ -1,330 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-len, id-length */ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var cindexOfRow = require( './../lib/ndarray.js' ); - - -// FIXTURES // - -var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); -var ROW_MAJOR_NO_MATCH = require( './fixtures/row_major_no_match.json' ); -var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); -var COLUMN_MAJOR_NO_MATCH = require( './fixtures/column_major_no_match.json' ); -var OFFSET_ROW_MAJOR_DATA = require( './fixtures/offsets/row_major.json' ); -var OFFSET_ROW_MAJOR_NO_MATCH = require( './fixtures/offsets/row_major_no_match.json' ); -var OFFSET_COLUMN_MAJOR_DATA = require( './fixtures/offsets/column_major.json' ); -var OFFSET_COLUMN_MAJOR_NO_MATCH = require( './fixtures/offsets/column_major_no_match.json' ); -var NEGATIVE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/negative-strides/row_major.json' ); -var NEGATIVE_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/negative-strides/row_major_no_match.json' ); -var NEGATIVE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/negative-strides/column_major.json' ); -var NEGATIVE_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/negative-strides/column_major_no_match.json' ); -var MIXED_STRIDES_ROW_MAJOR_DATA = require( './fixtures/mixed-strides/row_major.json' ); -var MIXED_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/mixed-strides/row_major_no_match.json' ); -var MIXED_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/mixed-strides/column_major.json' ); -var MIXED_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/mixed-strides/column_major_no_match.json' ); -var LARGE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/large-strides/row_major.json' ); -var LARGE_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/large-strides/row_major_no_match.json' ); -var LARGE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/large-strides/column_major.json' ); -var LARGE_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/large-strides/column_major_no_match.json' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cindexOfRow, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 12', function test( t ) { - t.strictEqual( cindexOfRow.length, 12, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( 0, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.M, 0, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( 0, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, 0, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major)', function test( t ) { - var data; - var out; - - data = ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major)', function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, offsets)', function test( t ) { - var data; - var out; - - data = OFFSET_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, offsets)', function test( t ) { - var data; - var out; - - data = OFFSET_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, offsets)', function test( t ) { - var data; - var out; - - data = OFFSET_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, offsets)', function test( t ) { - var data; - var out; - - data = OFFSET_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, mixed strides)', function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, mixed strides)', function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, mixed strides)', function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, mixed strides)', function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, negative strides)', function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, negative strides)', function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, negative strides)', function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, negative strides)', function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, large strides)', function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, large strides)', function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, large strides)', function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, large strides)', function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.native.js deleted file mode 100644 index 9bfb92388f7b..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/test/test.ndarray.native.js +++ /dev/null @@ -1,334 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable max-len, id-length */ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var cindexOfRow = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); -var opts = { - 'skip': ( cindexOfRow instanceof Error ) -}; - - -// FIXTURES // - -var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); -var ROW_MAJOR_NO_MATCH = require( './fixtures/row_major_no_match.json' ); -var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); -var COLUMN_MAJOR_NO_MATCH = require( './fixtures/column_major_no_match.json' ); -var OFFSET_ROW_MAJOR_DATA = require( './fixtures/offsets/row_major.json' ); -var OFFSET_ROW_MAJOR_NO_MATCH = require( './fixtures/offsets/row_major_no_match.json' ); -var OFFSET_COLUMN_MAJOR_DATA = require( './fixtures/offsets/column_major.json' ); -var OFFSET_COLUMN_MAJOR_NO_MATCH = require( './fixtures/offsets/column_major_no_match.json' ); -var NEGATIVE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/negative-strides/row_major.json' ); -var NEGATIVE_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/negative-strides/row_major_no_match.json' ); -var NEGATIVE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/negative-strides/column_major.json' ); -var NEGATIVE_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/negative-strides/column_major_no_match.json' ); -var MIXED_STRIDES_ROW_MAJOR_DATA = require( './fixtures/mixed-strides/row_major.json' ); -var MIXED_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/mixed-strides/row_major_no_match.json' ); -var MIXED_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/mixed-strides/column_major.json' ); -var MIXED_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/mixed-strides/column_major_no_match.json' ); -var LARGE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/large-strides/row_major.json' ); -var LARGE_STRIDES_ROW_MAJOR_NO_MATCH = require( './fixtures/large-strides/row_major_no_match.json' ); -var LARGE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/large-strides/column_major.json' ); -var LARGE_STRIDES_COLUMN_MAJOR_NO_MATCH = require( './fixtures/large-strides/column_major_no_match.json' ); - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof cindexOfRow, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( 0, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.M, 0, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when M is less than or equal to zero (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( 0, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index when N is less than or equal to zero (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, 0, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major)', opts, function test( t ) { - var data; - var out; - - data = ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major)', opts, function test( t ) { - var data; - var out; - - data = COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, offsets)', opts, function test( t ) { - var data; - var out; - - data = OFFSET_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, offsets)', opts, function test( t ) { - var data; - var out; - - data = OFFSET_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, offsets)', opts, function test( t ) { - var data; - var out; - - data = OFFSET_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, offsets)', opts, function test( t ) { - var data; - var out; - - data = OFFSET_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, mixed strides)', opts, function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, mixed strides)', opts, function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, mixed strides)', opts, function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, mixed strides)', opts, function test( t ) { - var data; - var out; - - data = MIXED_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, negative strides)', opts, function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, negative strides)', opts, function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, negative strides)', opts, function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, negative strides)', opts, function test( t ) { - var data; - var out; - - data = NEGATIVE_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (row-major, large strides)', opts, function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_ROW_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the index of the first row matching a search vector (column-major, large strides)', opts, function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_COLUMN_MAJOR_DATA; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (row-major, large strides)', opts, function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_ROW_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an invalid index if unable to find a search vector (column-major, large strides)', opts, function test( t ) { - var data; - var out; - - data = LARGE_STRIDES_COLUMN_MAJOR_NO_MATCH; - out = cindexOfRow( data.M, data.N, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Complex64Array( data.x ), data.strideX, data.offsetX, new Uint8Array( data.M ), 1, 0 ); - - t.strictEqual( out, data.expected, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/README.md b/lib/node_modules/@stdlib/blas/ext/base/gone-to/README.md deleted file mode 100644 index 77a023a5d9aa..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/README.md +++ /dev/null @@ -1,160 +0,0 @@ - - -# goneTo - -> Fill a strided array with linearly spaced numeric elements which increment by `1` starting from one. - -
- -## Usage - -```javascript -var goneTo = require( '@stdlib/blas/ext/base/gone-to' ); -``` - -#### goneTo( N, x, strideX ) - -Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. - -```javascript -var x = [ 0.0, 0.0, 0.0, 0.0 ]; - -goneTo( x.length, x, 1 ); -// x => [ 1.0, 2.0, 3.0, 4.0 ] -``` - -The function has the following parameters: - -- **N**: number of indexed elements. -- **x**: input array. -- **strideX**: stride length. - -The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to fill every other element: - -```javascript -var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; - -goneTo( 3, x, 2 ); -// x => [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] -``` - -Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. - -```javascript -var Float64Array = require( '@stdlib/array/float64' ); - -// Initial array... -var x0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - -// Create an offset view... -var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - -// Fill every other element... -goneTo( 3, x1, 2 ); -// x0 => [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ] -``` - -#### goneTo.ndarray( N, x, strideX, offsetX ) - -Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one using alternative indexing semantics. - -```javascript -var x = [ 0.0, 0.0, 0.0, 0.0 ]; - -goneTo.ndarray( x.length, x, 1, 0 ); -// x => [ 1.0, 2.0, 3.0, 4.0 ] -``` - -The function has the following additional parameters: - -- **offsetX**: starting index. - -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements: - -```javascript -var x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; - -goneTo.ndarray( 3, x, 1, x.length-3 ); -// x => [ 0.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] -``` - -
- - - -
- -## Notes - -- If `N <= 0`, both functions return `x` unchanged. -- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/complex64`][@stdlib/array/complex64]). -- Depending on the environment, the typed versions ([`doneTo`][@stdlib/blas/ext/base/done-to], [`soneTo`][@stdlib/blas/ext/base/sone-to], etc.) are likely to be significantly more performant. - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var goneTo = require( '@stdlib/blas/ext/base/gone-to' ); - -var x = discreteUniform( 10, -100, 100, { - 'dtype': 'generic' -}); -console.log( x ); - -goneTo( x.length, x, 1 ); -console.log( x ); -``` - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.js deleted file mode 100644 index de696a1ffbef..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var goneTo = require( './../lib/main.js' ); - - -// VARIABLES // - -var options = { - 'dtype': 'generic' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = uniform( len, -100, 100, options ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - y = goneTo( x.length, x, 1 ); - if ( isnan( y[ i%x.length ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y[ i%x.length ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.ndarray.js deleted file mode 100644 index 372128c64ed4..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/benchmark/benchmark.ndarray.js +++ /dev/null @@ -1,103 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/array/uniform' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var goneTo = require( './../lib/ndarray.js' ); - - -// VARIABLES // - -var options = { - 'dtype': 'generic' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x = uniform( len, -100, 100, options ); - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - y = goneTo( x.length, x, 1, 0 ); - if ( isnan( y[ i%x.length ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y[ i%x.length ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:ndarray:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/repl.txt deleted file mode 100644 index 6d71baded2f6..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/repl.txt +++ /dev/null @@ -1,91 +0,0 @@ - -{{alias}}( N, x, strideX ) - Fills a strided array with linearly spaced numeric elements which increment - by `1` starting from one. - - The `N` and stride parameters determine which elements in the strided array - are accessed at runtime. - - Indexing is relative to the first index. To introduce an offset, use typed - array views. - - If `N <= 0`, the function returns `x` unchanged. - - Parameters - ---------- - N: integer - Number of indexed elements. - - x: ArrayLikeObject - Input array. - - strideX: integer - Stride length. - - Returns - ------- - x: ArrayLikeObject - Input array. - - Examples - -------- - // Standard Usage: - > var x = [ 0.0, 0.0, 0.0, 0.0 ]; - > {{alias}}( x.length, x, 1 ) - [ 1.0, 2.0, 3.0, 4.0 ] - - // Using `N` and stride parameters: - > x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; - > {{alias}}( 3, x, 2 ) - [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] - - // Using view offsets: - > var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > {{alias}}( 3, x1, 2 ) - [ 1.0, 0.0, 2.0, 0.0, 3.0 ] - > x0 - [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ] - - -{{alias}}.ndarray( N, x, strideX, offsetX ) - Fills a strided array with linearly spaced numeric elements which increment - by `1` starting from one using alternative indexing semantics. - - While typed array views mandate a view offset based on the underlying - buffer, the offset parameter supports indexing semantics based on a starting - index. - - Parameters - ---------- - N: integer - Number of indexed elements. - - x: ArrayLikeObject - Input array. - - strideX: integer - Stride length. - - offsetX: integer - Starting index. - - Returns - ------- - x: ArrayLikeObject - Input array. - - Examples - -------- - // Standard Usage: - > var x = [ 0.0, 0.0, 0.0, 0.0 ]; - > {{alias}}.ndarray( x.length, x, 1, 0 ) - [ 1.0, 2.0, 3.0, 4.0 ] - - // Using an index offset: - > x = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; - > {{alias}}.ndarray( 3, x, 2, 1 ) - [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ] - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/index.d.ts deleted file mode 100644 index be169b7d480c..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Collection, AccessorArrayLike } from '@stdlib/types/array'; - -/** -* Input array. -*/ -type InputArray = Collection | AccessorArrayLike; - -/** -* Interface describing `goneTo`. -*/ -interface Routine { - /** - * Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. - * - * @param N - number of indexed elements - * @param x - input array - * @param strideX - stride length - * @returns input array - * - * @example - * var x = [ 0.0, 0.0, 0.0, 0.0 ]; - * - * goneTo( x.length, x, 1 ); - * // x => [ 1.0, 2.0, 3.0, 4.0 ] - */ - = InputArray>( N: number, x: U, strideX: number ): U; - - /** - * Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one using alternative indexing semantics. - * - * @param N - number of indexed elements - * @param x - input array - * @param strideX - stride length - * @param offsetX - starting index - * @returns input array - * - * @example - * var x = [ 0.0, 0.0, 0.0, 0.0 ]; - * - * goneTo.ndarray( x.length, x, 1, 0 ); - * // x => [ 1.0, 2.0, 3.0, 4.0 ] - */ - ndarray = InputArray>( N: number, x: U, strideX: number, offsetX: number ): U; -} - -/** -* Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param N - number of indexed elements -* @param x - input array -* @param strideX - stride length -* @returns input array -* -* @example -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo( x.length, x, 1 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -* -* @example -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo.ndarray( x.length, x, 1, 0 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -*/ -declare var goneTo: Routine; - - -// EXPORTS // - -export = goneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/test.ts deleted file mode 100644 index 5104996dfb84..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/docs/types/test.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import goneTo = require( './index' ); - - -// TESTS // - -// The function returns a collection... -{ - const x = new Float64Array( 10 ); - - goneTo( x.length, x, 1 ); // $ExpectType Float64Array -} - -// The compiler throws an error if the function is provided a first argument which is not a number... -{ - const x = new Float64Array( 10 ); - - goneTo( '10', x, 1 ); // $ExpectError - goneTo( true, x, 1 ); // $ExpectError - goneTo( false, x, 1 ); // $ExpectError - goneTo( null, x, 1 ); // $ExpectError - goneTo( undefined, x, 1 ); // $ExpectError - goneTo( [], x, 1 ); // $ExpectError - goneTo( {}, x, 1 ); // $ExpectError - goneTo( ( x: number ): number => x, x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a collection... -{ - const x = new Float64Array( 10 ); - - goneTo( x.length, 10, 1 ); // $ExpectError - goneTo( x.length, true, 1 ); // $ExpectError - goneTo( x.length, false, 1 ); // $ExpectError - goneTo( x.length, null, 1 ); // $ExpectError - goneTo( x.length, undefined, 1 ); // $ExpectError - goneTo( x.length, {}, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a number... -{ - const x = new Float64Array( 10 ); - - goneTo( x.length, x, '10' ); // $ExpectError - goneTo( x.length, x, true ); // $ExpectError - goneTo( x.length, x, false ); // $ExpectError - goneTo( x.length, x, null ); // $ExpectError - goneTo( x.length, x, undefined ); // $ExpectError - goneTo( x.length, x, [] ); // $ExpectError - goneTo( x.length, x, {} ); // $ExpectError - goneTo( x.length, x, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = new Float64Array( 10 ); - - goneTo(); // $ExpectError - goneTo( x.length ); // $ExpectError - goneTo( x.length, x ); // $ExpectError - goneTo( x.length, x, 1, 10 ); // $ExpectError -} - -// Attached to main export is an `ndarray` method which returns a collection... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray( x.length, x, 1, 0 ); // $ExpectType Float64Array -} - -// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray( '10', x, 1, 0 ); // $ExpectError - goneTo.ndarray( true, x, 1, 0 ); // $ExpectError - goneTo.ndarray( false, x, 1, 0 ); // $ExpectError - goneTo.ndarray( null, x, 1, 0 ); // $ExpectError - goneTo.ndarray( undefined, x, 1, 0 ); // $ExpectError - goneTo.ndarray( [], x, 1, 0 ); // $ExpectError - goneTo.ndarray( {}, x, 1, 0 ); // $ExpectError - goneTo.ndarray( ( x: number ): number => x, x, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a second argument which is not a collection... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray( x.length, 10, 1, 0 ); // $ExpectError - goneTo.ndarray( x.length, true, 1, 0 ); // $ExpectError - goneTo.ndarray( x.length, false, 1, 0 ); // $ExpectError - goneTo.ndarray( x.length, null, 1, 0 ); // $ExpectError - goneTo.ndarray( x.length, undefined, 1, 0 ); // $ExpectError - goneTo.ndarray( x.length, {}, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray( x.length, x, '10', 0 ); // $ExpectError - goneTo.ndarray( x.length, x, true, 0 ); // $ExpectError - goneTo.ndarray( x.length, x, false, 0 ); // $ExpectError - goneTo.ndarray( x.length, x, null, 0 ); // $ExpectError - goneTo.ndarray( x.length, x, undefined, 0 ); // $ExpectError - goneTo.ndarray( x.length, x, [], 0 ); // $ExpectError - goneTo.ndarray( x.length, x, {}, 0 ); // $ExpectError - goneTo.ndarray( x.length, x, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray( x.length, x, 1, '10' ); // $ExpectError - goneTo.ndarray( x.length, x, 1, true ); // $ExpectError - goneTo.ndarray( x.length, x, 1, false ); // $ExpectError - goneTo.ndarray( x.length, x, 1, null ); // $ExpectError - goneTo.ndarray( x.length, x, 1, undefined ); // $ExpectError - goneTo.ndarray( x.length, x, 1, [] ); // $ExpectError - goneTo.ndarray( x.length, x, 1, {} ); // $ExpectError - goneTo.ndarray( x.length, x, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... -{ - const x = new Float64Array( 10 ); - - goneTo.ndarray(); // $ExpectError - goneTo.ndarray( x.length ); // $ExpectError - goneTo.ndarray( x.length, x ); // $ExpectError - goneTo.ndarray( x.length, x, 1 ); // $ExpectError - goneTo.ndarray( x.length, x, 1, 0, 10 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/accessors.js deleted file mode 100644 index 66eb2d936cf0..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/accessors.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. -* -* @private -* @param {PositiveInteger} N - number of indexed elements -* @param {Object} x - input array object -* @param {Collection} x.data - input array data -* @param {Array} x.accessors - array element accessors -* @param {integer} strideX - stride length -* @param {NonNegativeInteger} offsetX - starting index -* @returns {Object} input array object -* -* @example -* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); -* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); -* -* var x = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0 ] ); -* -* goneTo( 4, arraylike2object( x ), 1, 0 ); -* -* var v = x.get( 0 ); -* // returns 1.0 -* -* v = x.get( 1 ); -* // returns 2.0 -*/ -function goneTo( N, x, strideX, offsetX ) { - var xbuf; - var set; - var ix; - var i; - - // Cache reference to array data: - xbuf = x.data; - - // Cache a reference to the element accessor: - set = x.accessors[ 1 ]; - - ix = offsetX; - for ( i = 1; i <= N; i++ ) { - set( xbuf, ix, i ); - ix += strideX; - } - return x; -} - - -// EXPORTS // - -module.exports = goneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/index.js deleted file mode 100644 index 89c5d17e9365..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Fill a strided array with linearly spaced numeric elements which increment by `1` starting from one. -* -* @module @stdlib/blas/ext/base/gone-to -* -* @example -* var goneTo = require( '@stdlib/blas/ext/base/gone-to' ); -* -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo( x.length, x, 1 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -* -* @example -* var goneTo = require( '@stdlib/blas/ext/base/gone-to' ); -* -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo.ndarray( x.length, x, 1, 0 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -setReadOnly( main, 'ndarray', ndarray ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/main.js deleted file mode 100644 index 82b934a97665..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/main.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var stride2offset = require( '@stdlib/strided/base/stride2offset' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -/** -* Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Collection} x - input array -* @param {integer} strideX - stride length -* @returns {Collection} input array -* -* @example -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo( x.length, x, 1 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -*/ -function goneTo( N, x, strideX ) { - return ndarray( N, x, strideX, stride2offset( N, strideX ) ); -} - - -// EXPORTS // - -module.exports = goneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/ndarray.js deleted file mode 100644 index 5527903291ef..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/lib/ndarray.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); -var accessors = require( './accessors.js' ); - - -// MAIN // - -/** -* Fills a strided array with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Collection} x - input array -* @param {integer} strideX - stride length -* @param {NonNegativeInteger} offsetX - starting index -* @returns {Collection} input array -* -* @example -* var x = [ 0.0, 0.0, 0.0, 0.0 ]; -* -* goneTo( x.length, x, 1, 0 ); -* // x => [ 1.0, 2.0, 3.0, 4.0 ] -*/ -function goneTo( N, x, strideX, offsetX ) { - var ix; - var o; - var i; - - if ( N <= 0 ) { - return x; - } - o = arraylike2object( x ); - if ( o.accessorProtocol ) { - accessors( N, o, strideX, offsetX ); - return x; - } - ix = offsetX; - for ( i = 1; i <= N; i++ ) { - x[ ix ] = i; - ix += strideX; - } - return x; -} - - -// EXPORTS // - -module.exports = goneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/package.json b/lib/node_modules/@stdlib/blas/ext/base/gone-to/package.json deleted file mode 100644 index bb39d285c69d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/blas/ext/base/gone-to", - "version": "0.0.0", - "description": "Fill a strided array with linearly spaced numeric elements which increment by `1` starting from one.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "blas", - "extended", - "fill", - "assign", - "set", - "one-to", - "oneto", - "sequence", - "seq", - "strided", - "array", - "ndarray" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.main.js deleted file mode 100644 index 1899883ce356..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.main.js +++ /dev/null @@ -1,253 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array/float64' ); -var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); -var goneTo = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof goneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( goneTo.length, 3, 'has expected arity' ); - t.end(); -}); - -tape( 'the function returns a reference to the input array', function test( t ) { - var out; - var x; - - x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; - out = goneTo( x.length, x, 1 ); - - t.strictEqual( out, x, 'same reference' ); - t.end(); -}); - -tape( 'the function returns a reference to the input array (accessors)', function test( t ) { - var out; - var x; - - x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - out = goneTo( x.length, x, 1 ); - - t.strictEqual( out, x, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { - var expected; - var x; - - x = [ 3.0, -4.0, 1.0 ]; - expected = [ 3.0, -4.0, 1.0 ]; - - goneTo( 0, x, 1 ); - t.deepEqual( x, expected, 'returns expected value' ); - - goneTo( -4, x, 1 ); - t.deepEqual( x, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a strided array', function test( t ) { - var expected; - var x; - - x = [ - 4.0, - 2.0, - -3.0, - 5.0, - -1.0, - 2.0, - -5.0, - 6.0 - ]; - expected = [ - 1.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 7.0, - 8.0 - ]; - - goneTo( x.length, x, 1 ); - t.deepEqual( x, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a strided array (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ 4.0, 2.0, -3.0, 5.0 ]; - x = toAccessorArray( xbuf ); - expected = [ 1.0, 2.0, 3.0, 4.0 ]; - - goneTo( x.length, x, 1 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports specifying a stride', function test( t ) { - var expected; - var x; - - x = [ - 2.0, // 0 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 2 - ]; - expected = [ - 1.0, // 0 - -3.0, - 2.0, // 1 - 7.0, - 3.0 // 2 - ]; - - goneTo( 3, x, 2 ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a stride (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ - 2.0, // 0 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 2 - ]; - x = toAccessorArray( xbuf ); - expected = [ - 1.0, // 0 - -3.0, - 2.0, // 1 - 7.0, - 3.0 // 2 - ]; - - goneTo( 3, x, 2 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a negative stride', function test( t ) { - var expected; - var x; - - x = [ - 2.0, // 2 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 0 - ]; - expected = [ - 3.0, // 2 - -3.0, - 2.0, // 1 - 7.0, - 1.0 // 0 - ]; - - goneTo( 3, x, -2 ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a negative stride (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ - 2.0, // 2 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 0 - ]; - x = toAccessorArray( xbuf ); - expected = [ - 3.0, // 2 - -3.0, - 2.0, // 1 - 7.0, - 1.0 // 0 - ]; - - goneTo( 3, x, -2 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports view offsets', function test( t ) { - var expected; - var x0; - var x1; - - x0 = new Float64Array([ - 1.0, - 2.0, // 0 - 3.0, - 4.0, // 1 - 5.0, - 6.0 // 2 - ]); - expected = new Float64Array([ - 1.0, - 1.0, // 0 - 3.0, - 2.0, // 1 - 5.0, - 3.0 // 2 - ]); - - x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - - goneTo( 3, x1, 2 ); - t.deepEqual( x0, expected, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.ndarray.js deleted file mode 100644 index 1774624bdba2..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.ndarray.js +++ /dev/null @@ -1,277 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); -var goneTo = require( './../lib/ndarray.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof goneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 4', function test( t ) { - t.strictEqual( goneTo.length, 4, 'has expected arity' ); - t.end(); -}); - -tape( 'the function returns a reference to the input array', function test( t ) { - var out; - var x; - - x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; - out = goneTo( x.length, x, 1, 0 ); - - t.strictEqual( out, x, 'same reference' ); - t.end(); -}); - -tape( 'the function returns a reference to the input array (accessors)', function test( t ) { - var out; - var x; - - x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - out = goneTo( x.length, x, 1, 0 ); - - t.strictEqual( out, x, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', function test( t ) { - var expected; - var x; - - x = [ 3.0, -4.0, 1.0 ]; - expected = [ 3.0, -4.0, 1.0 ]; - - goneTo( 0, x, 1, 0 ); - t.deepEqual( x, expected, 'returns expected value' ); - - goneTo( -4, x, 1, 0 ); - t.deepEqual( x, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a strided array', function test( t ) { - var expected; - var x; - - x = [ - 4.0, - 2.0, - -3.0, - 5.0, - -1.0, - 2.0, - -5.0, - 6.0 - ]; - expected = [ - 1.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 7.0, - 8.0 - ]; - - goneTo( x.length, x, 1, 0 ); - t.deepEqual( x, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a strided array (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ 4.0, 2.0, -3.0, 5.0 ]; - x = toAccessorArray( xbuf ); - expected = [ 1.0, 2.0, 3.0, 4.0 ]; - - goneTo( x.length, x, 1, 0 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports specifying a stride', function test( t ) { - var expected; - var x; - - x = [ - 2.0, // 0 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 2 - ]; - expected = [ - 1.0, // 0 - -3.0, - 2.0, // 1 - 7.0, - 3.0 // 2 - ]; - - goneTo( 3, x, 2, 0 ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a stride (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ - 2.0, // 0 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 2 - ]; - x = toAccessorArray( xbuf ); - expected = [ - 1.0, // 0 - -3.0, - 2.0, // 1 - 7.0, - 3.0 // 2 - ]; - - goneTo( 3, x, 2, 0 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a negative stride', function test( t ) { - var expected; - var x; - - x = [ - 2.0, // 2 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 0 - ]; - expected = [ - 3.0, // 2 - -3.0, - 2.0, // 1 - 7.0, - 1.0 // 0 - ]; - - goneTo( 3, x, -2, x.length-1 ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports specifying a negative stride (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ - 2.0, // 2 - -3.0, - -5.0, // 1 - 7.0, - 6.0 // 0 - ]; - x = toAccessorArray( xbuf ); - expected = [ - 3.0, // 2 - -3.0, - 2.0, // 1 - 7.0, - 1.0 // 0 - ]; - - goneTo( 3, x, -2, x.length-1 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports an offset parameter', function test( t ) { - var expected; - var x; - - x = [ - 1.0, - 2.0, // 0 - 3.0, // 1 - 4.0, // 2 - 6.0, - 7.0 - ]; - expected = [ - 1.0, - 1.0, // 0 - 2.0, // 1 - 3.0, // 2 - 6.0, - 7.0 - ]; - - goneTo( 3, x, 1, 1 ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports an offset parameter (accessors)', function test( t ) { - var expected; - var xbuf; - var x; - - xbuf = [ - 1.0, - 2.0, // 0 - 3.0, // 1 - 4.0, // 2 - 6.0, - 7.0 - ]; - x = toAccessorArray( xbuf ); - expected = [ - 1.0, - 1.0, // 0 - 2.0, // 1 - 3.0, // 2 - 6.0, - 7.0 - ]; - - goneTo( 3, x, 1, 1 ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/README.md index 48712b750f21..a0b8746a1c37 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/README.md @@ -47,7 +47,6 @@ The namespace exposes the following APIs: - [`csum( arrays )`][@stdlib/blas/ext/base/ndarray/csum]: compute the sum of all elements in a one-dimensional single-precision complex floating-point ndarray. - [`csumkbn( arrays )`][@stdlib/blas/ext/base/ndarray/csumkbn]: compute the sum of all elements in a one-dimensional single-precision complex floating-point ndarray using an improved Kahan–Babuška algorithm. -- [`czeroTo( arrays )`][@stdlib/blas/ext/base/ndarray/czero-to]: fill a one-dimensional single-precision complex floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from zero. - [`dcircshift( arrays )`][@stdlib/blas/ext/base/ndarray/dcircshift]: circularly shift the elements of a one-dimensional double-precision floating-point ndarray by a specified number of positions. - [`dcusum( arrays )`][@stdlib/blas/ext/base/ndarray/dcusum]: compute the cumulative sum of a one-dimensional double-precision floating-point ndarray. - [`dcusumkbn( arrays )`][@stdlib/blas/ext/base/ndarray/dcusumkbn]: compute the cumulative sum of a one-dimensional double-precision floating-point ndarray using an improved Kahan–Babuška algorithm. @@ -119,7 +118,6 @@ The namespace exposes the following APIs: - [`szeroTo( arrays )`][@stdlib/blas/ext/base/ndarray/szero-to]: fill a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from zero. - [`zsum( arrays )`][@stdlib/blas/ext/base/ndarray/zsum]: compute the sum of all elements in a one-dimensional double-precision complex floating-point ndarray. - [`zsumkbn( arrays )`][@stdlib/blas/ext/base/ndarray/zsumkbn]: compute the sum of all elements in a one-dimensional double-precision complex floating-point ndarray using an improved Kahan–Babuška algorithm. -- [`zzeroTo( arrays )`][@stdlib/blas/ext/base/ndarray/zzero-to]: fill a one-dimensional double-precision complex floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from zero. @@ -166,8 +164,6 @@ console.log( objectKeys( ns ) ); [@stdlib/blas/ext/base/ndarray/csumkbn]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/csumkbn -[@stdlib/blas/ext/base/ndarray/czero-to]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/czero-to - [@stdlib/blas/ext/base/ndarray/dcircshift]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/dcircshift [@stdlib/blas/ext/base/ndarray/dcusum]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/dcusum @@ -310,8 +306,6 @@ console.log( objectKeys( ns ) ); [@stdlib/blas/ext/base/ndarray/zsumkbn]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/zsumkbn -[@stdlib/blas/ext/base/ndarray/zzero-to]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/ndarray/zzero-to - diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/docs/types/index.d.ts index f95095b19b71..d98982e686c3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/docs/types/index.d.ts @@ -22,7 +22,6 @@ import csum = require( '@stdlib/blas/ext/base/ndarray/csum' ); import csumkbn = require( '@stdlib/blas/ext/base/ndarray/csumkbn' ); -import czeroTo = require( '@stdlib/blas/ext/base/ndarray/czero-to' ); import dcircshift = require( '@stdlib/blas/ext/base/ndarray/dcircshift' ); import dcusum = require( '@stdlib/blas/ext/base/ndarray/dcusum' ); import dcusumkbn = require( '@stdlib/blas/ext/base/ndarray/dcusumkbn' ); @@ -94,7 +93,6 @@ import ssumpw = require( '@stdlib/blas/ext/base/ndarray/ssumpw' ); import szeroTo = require( '@stdlib/blas/ext/base/ndarray/szero-to' ); import zsum = require( '@stdlib/blas/ext/base/ndarray/zsum' ); import zsumkbn = require( '@stdlib/blas/ext/base/ndarray/zsumkbn' ); -import zzeroTo = require( '@stdlib/blas/ext/base/ndarray/zzero-to' ); /** * Interface describing the `ndarray` namespace. @@ -136,24 +134,6 @@ interface Namespace { */ csumkbn: typeof csumkbn; - /** - * Fills a one-dimensional single-precision complex floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from zero. - * - * @param arrays - array-like object containing a one-dimensional input ndarray - * @returns input ndarray - * - * @example - * var Complex64Array = require( '@stdlib/array/complex64' ); - * var ndarray = require( '@stdlib/ndarray/base/ctor' ); - * - * var xbuf = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - * var x = new ndarray( 'complex64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); - * - * var out = ns.czeroTo( [ x ] ); - * // returns [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 2.0, 0.0 ], [ 3.0, 0.0 ] ] - */ - czeroTo: typeof czeroTo; - /** * Circularly shifts the elements of a one-dimensional double-precision floating-point ndarray by a specified number of positions. * @@ -1823,24 +1803,6 @@ interface Namespace { * // returns [ 5.0, 5.0 ] */ zsumkbn: typeof zsumkbn; - - /** - * Fills a one-dimensional double-precision complex floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from zero. - * - * @param arrays - array-like object containing a one-dimensional input ndarray - * @returns input ndarray - * - * @example - * var Complex128Array = require( '@stdlib/array/complex128' ); - * var ndarray = require( '@stdlib/ndarray/base/ctor' ); - * - * var xbuf = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - * var x = new ndarray( 'complex128', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); - * - * var out = ns.zzeroTo( [ x ] ); - * // returns [ [ 0.0, 0.0 ], [ 1.0, 0.0 ], [ 2.0, 0.0 ], [ 3.0, 0.0 ] ] - */ - zzeroTo: typeof zzeroTo; } /** diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/README.md deleted file mode 100644 index b473b1f9bfa7..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/README.md +++ /dev/null @@ -1,111 +0,0 @@ - - -# doneTo - -> Fill a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. - -
- -
- - - -
- -## Usage - -```javascript -var doneTo = require( '@stdlib/blas/ext/base/ndarray/done-to' ); -``` - -#### doneTo( arrays ) - -Fills a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. - -```javascript -var Float64Array = require( '@stdlib/array/float64' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); - -var xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -// returns [ 0.0, 0.0, 0.0, 0.0 ] - -var out = doneTo( [ x ] ); -// returns [ 1.0, 2.0, 3.0, 4.0 ] -``` - -The function has the following parameters: - -- **arrays**: array-like object containing a one-dimensional input ndarray. - -
- - - -
- -## Notes - -- The input ndarray is modified **in-place** (i.e., the input ndarray is **mutated**). - -
- - - -
- -## Examples - - - -```javascript -var zeros = require( '@stdlib/array/zeros' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var doneTo = require( '@stdlib/blas/ext/base/ndarray/done-to' ); - -var xbuf = zeros( 10, 'float64' ); -var x = new ndarray( 'float64', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); -console.log( ndarray2array( x ) ); - -doneTo( [ x ] ); -console.log( ndarray2array( x ) ); -``` - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/benchmark/benchmark.js deleted file mode 100644 index 78a5ce3f1627..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/benchmark/benchmark.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var zeros = require( '@stdlib/array/zeros' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var format = require( '@stdlib/string/format' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var pkg = require( './../package.json' ).name; -var doneTo = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var x; - - xbuf = zeros( len, options.dtype ); - x = new ndarray( options.dtype, xbuf, [ len ], [ 1 ], 0, 'row-major' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = doneTo( [ x ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an ndarray' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an ndarray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/repl.txt deleted file mode 100644 index c0b8e33d16d5..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/repl.txt +++ /dev/null @@ -1,32 +0,0 @@ - -{{alias}}( arrays ) - Fills a one-dimensional double-precision floating-point ndarray with - linearly spaced numeric elements which increment by `1` starting from one. - - The input ndarray is modified *in-place* (i.e., the input ndarray is - *mutated*). - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing a one-dimensional input ndarray. - - Returns - ------- - out: ndarray - Input ndarray. - - Examples - -------- - > var xbuf = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); - > var dt = 'float64'; - > var sh = [ xbuf.length ]; - > var sx = [ 1 ]; - > var ox = 0; - > var ord = 'row-major'; - > var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, ox, ord ); - > {{alias}}( [ x ] ) - [ 1.0, 2.0, 3.0, 4.0 ] - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/index.d.ts deleted file mode 100644 index 0d5cafad4f2c..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { float64ndarray } from '@stdlib/types/ndarray'; - -/** -* Fills a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param arrays - array-like object containing a one-dimensional input ndarray -* @returns input ndarray -* -* @example -* var Float64Array = require( '@stdlib/array/float64' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* -* var xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = doneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ -declare function doneTo( arrays: [ float64ndarray ] ): float64ndarray; - - -// EXPORTS // - -export = doneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/test.ts deleted file mode 100644 index f7f313782b9f..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable space-in-parens */ - -import zeros = require( '@stdlib/ndarray/zeros' ); -import doneTo = require( './index' ); - - -// TESTS // - -// The function returns an ndarray... -{ - const x = zeros( [ 10 ], { - 'dtype': 'float64' - }); - - doneTo( [ x ] ); // $ExpectType float64ndarray -} - -// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... -{ - doneTo( '10' ); // $ExpectError - doneTo( 10 ); // $ExpectError - doneTo( true ); // $ExpectError - doneTo( false ); // $ExpectError - doneTo( null ); // $ExpectError - doneTo( undefined ); // $ExpectError - doneTo( [] ); // $ExpectError - doneTo( {} ); // $ExpectError - doneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = zeros( [ 10 ], { - 'dtype': 'float64' - }); - - doneTo(); // $ExpectError - doneTo( [ x ], {} ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/examples/index.js deleted file mode 100644 index 819226e476ac..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var zeros = require( '@stdlib/array/zeros' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var doneTo = require( './../lib' ); - -var xbuf = zeros( 10, 'float64' ); -var x = new ndarray( 'float64', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); -console.log( ndarray2array( x ) ); - -doneTo( [ x ] ); -console.log( ndarray2array( x ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/index.js deleted file mode 100644 index 17959700aebc..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Fill a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @module @stdlib/blas/ext/base/ndarray/done-to -* -* @example -* var Float64Array = require( '@stdlib/array/float64' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* var doneTo = require( '@stdlib/blas/ext/base/ndarray/done-to' ); -* -* var xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = doneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/main.js deleted file mode 100644 index 93e808631a6e..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/lib/main.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); -var getStride = require( '@stdlib/ndarray/base/stride' ); -var getOffset = require( '@stdlib/ndarray/base/offset' ); -var getData = require( '@stdlib/ndarray/base/data-buffer' ); -var strided = require( '@stdlib/blas/ext/base/done-to' ).ndarray; - - -// MAIN // - -/** -* Fills a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param {ArrayLikeObject} arrays - array-like object containing a one-dimensional input ndarray -* @returns {ndarray} input ndarray -* -* @example -* var Float64Array = require( '@stdlib/array/float64' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* -* var xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = doneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ -function doneTo( arrays ) { - var x = arrays[ 0 ]; - strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ) ); // eslint-disable-line max-len - return x; -} - - -// EXPORTS // - -module.exports = doneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/package.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/package.json deleted file mode 100644 index 2e673701d0c9..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/blas/ext/base/ndarray/done-to", - "version": "0.0.0", - "description": "Fill a one-dimensional double-precision floating-point ndarray with linearly spaced numeric elements which increment by 1 starting from one.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "blas", - "extended", - "fill", - "one", - "oneto", - "one-to", - "linearly", - "spaced", - "increment", - "strided", - "array", - "ndarray", - "float64", - "double", - "double-precision" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/test/test.js deleted file mode 100644 index 1308ed191b21..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/done-to/test/test.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array/float64' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var doneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a one-dimensional ndarray. -* -* @private -* @param {Float64Array} buffer - underlying data buffer -* @param {NonNegativeInteger} length - number of indexed elements -* @param {integer} stride - stride length -* @param {NonNegativeInteger} offset - index offset -* @returns {ndarray} one-dimensional ndarray -*/ -function vector( buffer, length, stride, offset ) { - return new ndarray( 'float64', buffer, [ length ], [ stride ], offset, 'row-major' ); -} - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof doneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 1', function test( t ) { - t.strictEqual( doneTo.length, 1, 'has expected arity' ); - t.end(); -}); - -tape( 'the function fills a one-dimensional ndarray with linearly spaced numeric elements which increment by 1 starting from one', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 1, 0 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the input ndarray unchanged when the input ndarray is empty', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [] ); - x = vector( xbuf, 0, 1, 0 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a one-dimensional ndarray containing a single element', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 5.0 ] ); - x = vector( xbuf, 1, 1, 0 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a non-unit stride', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 2, 0 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a negative stride', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 5, -1, 4 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 5.0, 4.0, 3.0, 2.0, 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a non-zero offset', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 1, 2 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a negative stride and non-zero offset', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 5, -2, 9 ); - - actual = doneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float64Array( [ 0.0, 5.0, 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/README.md deleted file mode 100644 index dfe1375fecc5..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/README.md +++ /dev/null @@ -1,111 +0,0 @@ - - -# soneTo - -> Fill a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. - -
- -
- - - -
- -## Usage - -```javascript -var soneTo = require( '@stdlib/blas/ext/base/ndarray/sone-to' ); -``` - -#### soneTo( arrays ) - -Fills a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. - -```javascript -var Float32Array = require( '@stdlib/array/float32' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); - -var xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -// returns [ 0.0, 0.0, 0.0, 0.0 ] - -var out = soneTo( [ x ] ); -// returns [ 1.0, 2.0, 3.0, 4.0 ] -``` - -The function has the following parameters: - -- **arrays**: array-like object containing a one-dimensional input ndarray. - -
- - - -
- -## Notes - -- The input ndarray is modified **in-place** (i.e., the input ndarray is **mutated**). - -
- - - -
- -## Examples - - - -```javascript -var zeros = require( '@stdlib/array/zeros' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var soneTo = require( '@stdlib/blas/ext/base/ndarray/sone-to' ); - -var xbuf = zeros( 10, 'float32' ); -var x = new ndarray( 'float32', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); -console.log( ndarray2array( x ) ); - -soneTo( [ x ] ); -console.log( ndarray2array( x ) ); -``` - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/benchmark/benchmark.js deleted file mode 100644 index a21bb60f493d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/benchmark/benchmark.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var zeros = require( '@stdlib/array/zeros' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var format = require( '@stdlib/string/format' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var pkg = require( './../package.json' ).name; -var soneTo = require( './../lib' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float32' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var x; - - xbuf = zeros( len, options.dtype ); - x = new ndarray( options.dtype, xbuf, [ len ], [ 1 ], 0, 'row-major' ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = soneTo( [ x ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an ndarray' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an ndarray' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/repl.txt deleted file mode 100644 index 8eb9af7bf34a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/repl.txt +++ /dev/null @@ -1,32 +0,0 @@ - -{{alias}}( arrays ) - Fills a one-dimensional single-precision floating-point ndarray with - linearly spaced numeric elements which increment by `1` starting from one. - - The input ndarray is modified *in-place* (i.e., the input ndarray is - *mutated*). - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing a one-dimensional input ndarray. - - Returns - ------- - out: ndarray - Input ndarray. - - Examples - -------- - > var xbuf = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); - > var dt = 'float32'; - > var sh = [ xbuf.length ]; - > var sx = [ 1 ]; - > var ox = 0; - > var ord = 'row-major'; - > var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, ox, ord ); - > {{alias}}( [ x ] ) - [ 1.0, 2.0, 3.0, 4.0 ] - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/index.d.ts deleted file mode 100644 index 81da9a2f3f8c..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -import { float32ndarray } from '@stdlib/types/ndarray'; - -/** -* Fills a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param arrays - array-like object containing a one-dimensional input ndarray -* @returns input ndarray -* -* @example -* var Float32Array = require( '@stdlib/array/float32' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* -* var xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = soneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ -declare function soneTo( arrays: [ float32ndarray ] ): float32ndarray; - - -// EXPORTS // - -export = soneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/test.ts deleted file mode 100644 index aa3d5df8d2c2..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable space-in-parens */ - -import zeros = require( '@stdlib/ndarray/zeros' ); -import soneTo = require( './index' ); - - -// TESTS // - -// The function returns an ndarray... -{ - const x = zeros( [ 10 ], { - 'dtype': 'float32' - }); - - soneTo( [ x ] ); // $ExpectType float32ndarray -} - -// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... -{ - soneTo( '10' ); // $ExpectError - soneTo( 10 ); // $ExpectError - soneTo( true ); // $ExpectError - soneTo( false ); // $ExpectError - soneTo( null ); // $ExpectError - soneTo( undefined ); // $ExpectError - soneTo( [] ); // $ExpectError - soneTo( {} ); // $ExpectError - soneTo( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = zeros( [ 10 ], { - 'dtype': 'float32' - }); - - soneTo(); // $ExpectError - soneTo( [ x ], {} ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/examples/index.js deleted file mode 100644 index 2d9e4753cc6a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/examples/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var zeros = require( '@stdlib/array/zeros' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var soneTo = require( './../lib' ); - -var xbuf = zeros( 10, 'float32' ); -var x = new ndarray( 'float32', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); -console.log( ndarray2array( x ) ); - -soneTo( [ x ] ); -console.log( ndarray2array( x ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/index.js deleted file mode 100644 index a5d2ab109e8d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Fill a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @module @stdlib/blas/ext/base/ndarray/sone-to -* -* @example -* var Float32Array = require( '@stdlib/array/float32' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* var soneTo = require( '@stdlib/blas/ext/base/ndarray/sone-to' ); -* -* var xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = soneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/main.js deleted file mode 100644 index 989b89582879..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/lib/main.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); -var getStride = require( '@stdlib/ndarray/base/stride' ); -var getOffset = require( '@stdlib/ndarray/base/offset' ); -var getData = require( '@stdlib/ndarray/base/data-buffer' ); -var strided = require( '@stdlib/blas/ext/base/sone-to' ).ndarray; - - -// MAIN // - -/** -* Fills a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by `1` starting from one. -* -* @param {ArrayLikeObject} arrays - array-like object containing a one-dimensional input ndarray -* @returns {ndarray} input ndarray -* -* @example -* var Float32Array = require( '@stdlib/array/float32' ); -* var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* -* var xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); -* var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -* // returns [ 0.0, 0.0, 0.0, 0.0 ] -* -* var out = soneTo( [ x ] ); -* // returns [ 1.0, 2.0, 3.0, 4.0 ] -*/ -function soneTo( arrays ) { - var x = arrays[ 0 ]; - strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ) ); // eslint-disable-line max-len - return x; -} - - -// EXPORTS // - -module.exports = soneTo; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/package.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/package.json deleted file mode 100644 index a3cf6a4e4f49..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/blas/ext/base/ndarray/sone-to", - "version": "0.0.0", - "description": "Fill a one-dimensional single-precision floating-point ndarray with linearly spaced numeric elements which increment by 1 starting from one.", - "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdmath", - "mathematics", - "math", - "blas", - "extended", - "fill", - "one", - "oneto", - "one-to", - "linearly", - "spaced", - "increment", - "strided", - "array", - "ndarray", - "float32", - "float", - "single", - "single-precision" - ], - "__stdlib__": {} -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/test/test.js deleted file mode 100644 index 6994cf6d5e6a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/sone-to/test/test.js +++ /dev/null @@ -1,183 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Float32Array = require( '@stdlib/array/float32' ); -var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var soneTo = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Returns a one-dimensional ndarray. -* -* @private -* @param {Float32Array} buffer - underlying data buffer -* @param {NonNegativeInteger} length - number of indexed elements -* @param {integer} stride - stride length -* @param {NonNegativeInteger} offset - index offset -* @returns {ndarray} one-dimensional ndarray -*/ -function vector( buffer, length, stride, offset ) { - return new ndarray( 'float32', buffer, [ length ], [ stride ], offset, 'row-major' ); -} - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof soneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 1', function test( t ) { - t.strictEqual( soneTo.length, 1, 'has expected arity' ); - t.end(); -}); - -tape( 'the function fills a one-dimensional ndarray with linearly spaced numeric elements which increment by 1 starting from one', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 1, 0 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the input ndarray unchanged when the input ndarray is empty', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [] ); - x = vector( xbuf, 0, 1, 0 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function fills a one-dimensional ndarray containing a single element', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 5.0 ] ); - x = vector( xbuf, 1, 1, 0 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a non-unit stride', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 2, 0 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a negative stride', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 5, -1, 4 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 5.0, 4.0, 3.0, 2.0, 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a non-zero offset', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 4, 1, 2 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an input ndarray having a negative stride and non-zero offset', function test( t ) { - var expected; - var actual; - var xbuf; - var x; - - xbuf = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); - x = vector( xbuf, 5, -2, 9 ); - - actual = soneTo( [ x ] ); - t.strictEqual( actual, x, 'returns expected value' ); - - expected = new Float32Array( [ 0.0, 5.0, 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ] ); - t.deepEqual( xbuf, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/README.md b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/README.md index 5ce82e1e1e4a..481096ec52aa 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/README.md @@ -113,6 +113,98 @@ logEachMap( 'λ: %0.4f, H(X;λ): %0.4f', lambda, entropy ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/poisson/entropy.h" +``` + +#### stdlib\_base\_dists\_poisson\_entropy( lambda ) + +Returns the [entropy][entropy] of a [Poisson][poisson-distribution] distribution with mean parameter `lambda` (in [nats][nats]). + +```c +double out = stdlib_base_dists_poisson_entropy( 9.0 ); +// returns ~2.508 +``` + +The function accepts the following arguments: + +- **lambda**: `[in] double` mean parameter. + +```c +double stdlib_base_dists_poisson_entropy( const double lambda ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/poisson/entropy.h" +#include +#include + +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +int main( void ) { + double lambda; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + lambda = random_uniform( 0.0, 20.0 ); + y = stdlib_base_dists_poisson_entropy( lambda ); + printf( "λ: %lf, h(X;λ): %lf\n", lambda, y ); + } +} +``` + +
+ + + +
+ + +
diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/benchmark.native.js new file mode 100644 index 000000000000..1f3b283fd27d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/benchmark.native.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var entropy = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( entropy instanceof Error ) +}; + + +// MAIN // + +bench( format( '%s::native', pkg ), opts, function benchmark( b ) { + var lambda; + var opts; + var y; + var i; + + opts = { + 'dtype': 'float64' + }; + lambda = uniform( 100, EPS, 20.0, opts ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = entropy( lambda[ i % lambda.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/Makefile similarity index 99% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/Makefile rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/Makefile index 0756dc7da20a..979768abbcec 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/Makefile @@ -82,7 +82,7 @@ LIBRARIES ?= LIBPATH ?= # List of C targets: -c_targets := benchmark.length.out +c_targets := benchmark.out # RULES # diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/benchmark.c new file mode 100644 index 000000000000..b63a348602c2 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/benchmark/c/benchmark.c @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/stats/base/dists/poisson/entropy.h" +#include "stdlib/constants/float64/eps.h" +#include +#include +#include +#include +#include + +#define NAME "poisson-entropy" +#define ITERATIONS 1000000 +#define REPEATS 3 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param elapsed elapsed time in seconds +*/ +static void print_results( double elapsed ) { + double rate = (double)ITERATIONS / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [min,max). +* +* @param min minimum value (inclusive) +* @param max maximum value (exclusive) +* @return random number +*/ +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +/** +* Runs a benchmark. +* +* @return elapsed time in seconds +*/ +static double benchmark( void ) { + double elapsed; + double lambda[ 100 ]; + double y; + double t; + int i; + + for ( i = 0; i < 100; i++ ) { + lambda[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 ); + } + + t = tic(); + for ( i = 0; i < ITERATIONS; i++ ) { + y = stdlib_base_dists_poisson_entropy( lambda[ i % 100 ] ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int i; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + for ( i = 0; i < REPEATS; i++ ) { + printf( "# c::%s\n", NAME ); + elapsed = benchmark(); + print_results( elapsed ); + printf( "ok %d benchmark finished\n", i+1 ); + } + print_summary( REPEATS, REPEATS ); +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/binding.gyp similarity index 100% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/binding.gyp rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/binding.gyp diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/examples/c/Makefile similarity index 100% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/examples/c/Makefile rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/examples/c/Makefile diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/examples/c/example.c similarity index 56% rename from lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.js rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/examples/c/example.c index ec3cdc79a9a0..de92d6f4327d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/examples/c/example.c @@ -16,23 +16,23 @@ * limitations under the License. */ -'use strict'; +#include "stdlib/stats/base/dists/poisson/entropy.h" +#include +#include -// MODULES // +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} -var tape = require( 'tape' ); -var goneTo = require( './../lib' ); +int main( void ) { + double lambda; + double y; + int i; - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof goneTo, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { - t.strictEqual( typeof goneTo.ndarray, 'function', 'method is a function' ); - t.end(); -}); + for ( i = 0; i < 25; i++ ) { + lambda = random_uniform( 0.0, 20.0 ); + y = stdlib_base_dists_poisson_entropy( lambda ); + printf( "λ: %lf, h(X;λ): %lf\n", lambda, y ); + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/include.gypi similarity index 100% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/include.gypi rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/include.gypi diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/main.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/include/stdlib/stats/base/dists/poisson/entropy.h similarity index 55% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/main.js rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/include/stdlib/stats/base/dists/poisson/entropy.h index baccf32ba44d..b6d23e426cad 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/main.js +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/include/stdlib/stats/base/dists/poisson/entropy.h @@ -16,20 +16,23 @@ * limitations under the License. */ -'use strict'; +#ifndef STDLIB_STATS_BASE_DISTS_POISSON_ENTROPY_H +#define STDLIB_STATS_BASE_DISTS_POISSON_ENTROPY_H -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var cindexOfRow = require( './cindex_of_row.js' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -setReadOnly( cindexOfRow, 'ndarray', ndarray ); +/* +* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. +*/ +#ifdef __cplusplus +extern "C" { +#endif +/** +* Returns the entropy of a Poisson distribution. +*/ +double stdlib_base_dists_poisson_entropy( const double lambda ); -// EXPORTS // +#ifdef __cplusplus +} +#endif -module.exports = cindexOfRow; +#endif // !STDLIB_STATS_BASE_DISTS_POISSON_ENTROPY_H diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/lib/native.js similarity index 57% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/native.js rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/lib/native.js index 015cd6b429e9..57a1ee898c97 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/lib/native.js @@ -20,16 +20,39 @@ // MODULES // -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var cindexOfRow = require( './cindex_of_row.native.js' ); -var ndarray = require( './ndarray.native.js' ); +var addon = require( './../src/addon.node' ); // MAIN // -setReadOnly( cindexOfRow, 'ndarray', ndarray ); +/** +* Returns the entropy of a Poisson distribution. +* +* @private +* @param {NonNegativeNumber} lambda - mean parameter +* @returns {number} entropy +* +* @example +* var v = entropy( 9.0 ); +* // returns ~2.508 +* +* @example +* var v = entropy( 1.0 ); +* // returns ~1.305 +* +* @example +* var v = entropy( -0.2 ); +* // returns NaN +* +* @example +* var v = entropy( NaN ); +* // returns NaN +*/ +function entropy( lambda ) { + return addon( lambda ); +} // EXPORTS // -module.exports = cindexOfRow; +module.exports = entropy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/manifest.json b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/manifest.json similarity index 52% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/manifest.json rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/manifest.json index 747da73d8ec9..bc14a938f4e2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/manifest.json @@ -1,6 +1,7 @@ { "options": { - "task": "build" + "task": "build", + "wasm": false }, "fields": [ { @@ -27,6 +28,7 @@ "confs": [ { "task": "build", + "wasm": false, "src": [ "./src/main.c" ], @@ -36,23 +38,17 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/real", - "@stdlib/complex/float32/imag", - "@stdlib/strided/base/stride2offset", - "@stdlib/napi/export", - "@stdlib/napi/argv", - "@stdlib/napi/argv-int32", - "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-strided-complex64array", - "@stdlib/napi/argv-strided-complex64array2d", - "@stdlib/napi/argv-strided-uint8array", - "@stdlib/napi/create-int32" + "@stdlib/math/base/napi/unary", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/factorialln", + "@stdlib/math/base/special/factorial", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln" ] }, { "task": "benchmark", + "wasm": false, "src": [ "./src/main.c" ], @@ -62,15 +58,17 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/real", - "@stdlib/complex/float32/imag", - "@stdlib/strided/base/stride2offset" + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/factorialln", + "@stdlib/math/base/special/factorial", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln", + "@stdlib/constants/float64/eps" ] }, { "task": "examples", + "wasm": false, "src": [ "./src/main.c" ], @@ -80,11 +78,11 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float32/ctor", - "@stdlib/complex/float32/real", - "@stdlib/complex/float32/imag", - "@stdlib/strided/base/stride2offset" + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/factorialln", + "@stdlib/math/base/special/factorial", + "@stdlib/math/base/special/exp", + "@stdlib/math/base/special/ln" ] } ] diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/package.json b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/package.json index f6820cab088c..8b729598c6e6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/package.json +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/package.json @@ -14,11 +14,14 @@ } ], "main": "./lib", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", diff --git a/lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/Makefile similarity index 100% rename from lib/node_modules/@stdlib/blas/ext/base/cindex-of-row/src/Makefile rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/Makefile diff --git a/lib/node_modules/@stdlib/blas/ext/base/gone-to/examples/index.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/addon.c similarity index 70% rename from lib/node_modules/@stdlib/blas/ext/base/gone-to/examples/index.js rename to lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/addon.c index fec4a0cb157c..57281568970f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gone-to/examples/index.js +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/addon.c @@ -16,15 +16,7 @@ * limitations under the License. */ -'use strict'; +#include "stdlib/stats/base/dists/poisson/entropy.h" +#include "stdlib/math/base/napi/unary.h" -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var goneTo = require( './../lib' ); - -var x = discreteUniform( 10, -100, 100, { - 'dtype': 'generic' -}); -console.log( x ); - -goneTo( x.length, x, 1 ); -console.log( x ); +STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_poisson_entropy ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/main.c new file mode 100644 index 000000000000..51fb5f8e7586 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/src/main.c @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/stats/base/dists/poisson/entropy.h" +#include "stdlib/math/base/assert/is_nan.h" +#include "stdlib/math/base/special/factorialln.h" +#include "stdlib/math/base/special/factorial.h" +#include "stdlib/math/base/special/exp.h" +#include "stdlib/math/base/special/ln.h" + +/** +* Returns the entropy of a Poisson distribution. +* +* @param lambda mean parameter +* @return entropy +* +* @example +* double y = stdlib_base_dists_poisson_entropy( 9.0 ); +* // returns ~2.508 +*/ +double stdlib_base_dists_poisson_entropy( const double lambda ) { + double sum; + double lk; + double out; + int k; + + if ( stdlib_base_is_nan( lambda ) || lambda < 0.0 ) { + return 0.0 / 0.0; // NaN + } + if ( lambda == 0.0 ) { + return 0.0; + } + out = lambda * ( 1.0 - stdlib_base_ln( lambda ) ); + + // Compute the series: sum_{k=0}^{infty} lambda^k * ln(k!) / k! + // Starting from k=2, since ln(0!) = 0 and ln(1!) = 0: + sum = 0.0; + lk = lambda; // lambda^1 + for ( k = 2; k < 1000; k++ ) { + lk *= lambda; + sum += lk * stdlib_base_factorialln( k ) / stdlib_base_factorial( k ); + if ( lk / stdlib_base_factorial( k ) < 1.0e-16 ) { + break; + } + } + out += stdlib_base_exp( -lambda ) * sum; + return out; +} diff --git a/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/test/test.native.js new file mode 100644 index 000000000000..a6a74b0bc536 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/poisson/entropy/test/test.native.js @@ -0,0 +1,101 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var EPS = require( '@stdlib/constants/float64/eps' ); + + +// VARIABLES // + +var entropy = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( entropy instanceof Error ) +}; + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof entropy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for `lambda`, the function returns `NaN`', opts, function test( t ) { + var v = entropy( NaN ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided a mean parameter `lambda` that is not a nonnegative number, the function returns `NaN`', opts, function test( t ) { + var v; + + v = entropy( -1.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + v = entropy( NINF ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `lambda` equal to `0`, the function returns `0`', opts, function test( t ) { + var v; + + v = entropy( 0.0 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the entropy of a Poisson distribution', opts, function test( t ) { + var expected; + var lambda; + var delta; + var tol; + var i; + var y; + + expected = data.expected; + lambda = data.lambda; + for ( i = 0; i < expected.length; i++ ) { + y = entropy( lambda[i] ); + if ( y === expected[i] ) { + t.strictEqual( y, expected[i], 'lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 15.0 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +});