diff --git a/lib/node_modules/@stdlib/blas/base/cher/README.md b/lib/node_modules/@stdlib/blas/base/cher/README.md new file mode 100644 index 000000000000..9b3a71ea7391 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/README.md @@ -0,0 +1,269 @@ + + +# cher + +> Perform the hermitian rank 1 operation `A = α*x*x**H + A`, where `α` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. + +
+ +## Usage + +```javascript +var cher = require( '@stdlib/blas/base/cher' ); +``` + +#### cher( order, uplo, N, α, x, strideX, A, LDA ) + +Performs the hermitian rank 1 operation `A = α*x*x**H + A`, where `α` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +cher( 'row-major', 'lower', x.length, 2.0, x, 1, A, 2 ); +// A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether the upper or lower triangular part of the matrix `A` is supplied. +- **N**: specifies the order of the matrix `A`. +- **α**: scalar constant. +- **x**: input vector [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: index increment for `x`. +- **A**: input matrix stored in linear memory as [`Complex64Array`][@stdlib/array/complex64]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). + +The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var x = new Complex64Array( [ 3.0, 4.0, 1.0, 2.0 ] ); +var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +cher( 'row-major', 'lower', x.length, 2.0, x, -1, A, 2 ); +// A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.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 Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +// Initial array: +var x0 = new Complex64Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] ); + +// Define a input matrix: +var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +// Create an offset view: +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +cher( 'row-major', 'lower', x1.length, 2.0, x1, 1, A, 2 ); +// A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +``` + +#### cher.ndarray( uplo, N, α, x, strideX, offsetX, A, strideA1, strideA2, offsetA ) + +Performs the hermitian rank 1 operation `A = α*x*x**H + A`, where `α` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix using alternative indexing semantics. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +cher.ndarray( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); +// A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +``` + +The function has the following additional parameters: + +- **strideA1**: stride of the first dimension of `A`. +- **strideA2**: stride of the second dimension of `A`. +- **offsetX**: starting index for `x`. +- **offsetA**: starting index for `A`. + +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 scale every other value in the input strided array starting from the second element, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); + +var x = new Complex64Array( [ 3.0, 4.0, 1.0, 2.0 ] ); +var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +cher.ndarray( 'lower', x.length, 2.0, x, -1, 1, A, 2, 1, 0 ); +// A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +``` + +
+ + + +
+ +## Notes + +- If `N = 0` or `α = 0.0`, both functions return `x` unchanged. +- `cher()` corresponds to the [BLAS][blas] level 2 function [`cher`][cher]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var cher = require( '@stdlib/blas/base/cher' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var x = filledarrayBy( 3, 'complex64', rand ); +console.log( x.get( 0 ).toString() ); + +var A = filledarrayBy( 9, 'complex64', rand ); +console.log( A.get( 0 ).toString() ); + +cher( 'row-major', 'upper', 3, 1.0, x, 1, A, 3 ); + +// Print the results: +logEach( '(%s)', A ); + +cher.ndarray( 'upper', 3, 1.0, x, 1, 0, A, 3, 1, 0 ); + +// Print the results: +logEach( '(%s)', A ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.js new file mode 100644 index 000000000000..3a300116d676 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var pkg = require( './../package.json' ).name; +var cher = require( './../lib/cher.js' ); + + +// 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 Abuf; + var x; + var A; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + Abuf = uniform( (len*len)*2, -100.0, 100.0, options ); + A = new Complex64Array( Abuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + cher( 'row-major', 'lower', len, 2.0, x, 1, A, len ); + if ( isnanf( Abuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( Abuf[ i%(len*2) ] ) ) { + 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 = 4; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..1cfa58b08ddd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/benchmark/benchmark.ndarray.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var pkg = require( './../package.json' ).name; +var cher = require( './../lib/ndarray.js' ); + + +// 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 Abuf; + var x; + var A; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + Abuf = uniform( (len*len)*2, -100.0, 100.0, options ); + A = new Complex64Array( Abuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + cher( 'lower', len, 2.0, x, 1, 0, A, len, 1, 0 ); + if ( isnanf( Abuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( Abuf[ i%(len*2) ] ) ) { + 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 = 4; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cher/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cher/docs/repl.txt new file mode 100644 index 000000000000..701624773bdc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/docs/repl.txt @@ -0,0 +1,124 @@ + +{{alias}}( order, uplo, N, α, x, strideX, A, LDA ) + Performs the hermitian rank 1 operation `A = α*x*x**H + A`, where + `α` is a real scalar, `x` is an `N` element vector and `A` is an + `N` by `N` hermitian matrix. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is equal to `0`, the function returns `A` unchanged. + + If `α` is equal to `0`, the function returns `A` unchanged. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. + + uplo: string + Specifies whether the upper or lower triangular matrix of `A` is + supplied. Must be either 'upper' or 'lower'. + + N: integer + Number of elements along each dimension of `A`. + + α: number + Scalar constant. + + x: Complex64Array + Input array. + + strideX: integer + Index increment for `x`. + + A: Complex64Array + Input matrix. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + Returns + ------- + A: Complex64Array + Input matrix. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > {{alias}}( 'row-major', 'lower', 2, 2.0, x, 1, A, 2 ) + [ 11.0, 0.0, 0.0, 0.0, 27.0, 2.0, 57.0, 0.0 ] + + // Advanced indexing: + > var x = new {{alias:@stdlib/array/complex64}}( [ 3.0, 4.0, 1.0, 2.0 ] ); + > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > {{alias}}( 'row-major', 'lower', 2, 2.0, x, -1, A, 2 ) + [ 11.0, 0.0, 0.0, 0.0, 27.0, 2.0, 57.0, 0.0 ] + + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > {{alias}}( 'row-major', 'lower', 2, 2.0, x, -1, A, 2 ) + [ 11.0, 0.0, 0.0, 0.0, 27.0, 2.0, 57.0, 0.0 ] + + +{{alias}}.ndarray( uplo, N, α, x, strideX, offsetX, A, sa1, sa2, offsetA ) + Performs the hermitian rank 1 operation `A = α*x*x**H + A`, where + `α` is a real scalar, `x` is an `N` element vector and `A` is an + `N` by `N` hermitian matrix 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 + ---------- + uplo: string + Specifies whether the upper or lower triangular matrix of `A` is + supplied. Must be either 'upper' or 'lower'. + + N: integer + Number of elements along each dimension of `A`. + + α: number + Scalar constant. + + x: Complex64Array + Input array. + + strideX: integer + Index increment for `x`. + + offsetX: integer + Starting index for `x`. + + A: Complex64Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + offsetA: integer + Starting index for `A`. + + Returns + ------- + A: Complex64Array + Input matrix. + + Examples + -------- + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var A = new {{alias:@stdlib/array/complex64}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > {{alias}}.ndarray( 'lower', 2, 2.0, x, 1, 0, A, 2, 1, 0 ) + [ 11.0, 0.0, 0.0, 0.0, 27.0, 2.0, 57.0, 0.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/cher/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cher/docs/types/index.d.ts new file mode 100644 index 000000000000..ff869d7b3543 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/docs/types/index.d.ts @@ -0,0 +1,117 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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, MatrixTriangle } from '@stdlib/types/blas'; + +/** +* Interface describing `cher`. +*/ +interface Routine { + /** + * Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. + * + * @param order - storage layout + * @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. + * @param N - number of elements along each dimension of `A` + * @param alpha - scalar constant + * @param x - input array + * @param strideX - `x` stride length + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns input matrix + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + * + * cher( 'row-major', 'lower', x.length, 2.0, x, 1, A, 2 ); + * // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] + */ + ( order: Layout, uplo: MatrixTriangle, N: number, alpha: number, x: Complex64Array, strideX: number, A: Complex64Array, LDA: number ): Complex64Array; + + /** + * Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. + * + * @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. + * @param N - number of elements along each dimension of `A` + * @param alpha - scalar + * @param x - input array + * @param strideX - `x` stride length + * @param offsetX - starting `x` index + * @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` + * @returns input matrix + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + * + * cher( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); + * // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] + */ + ndarray( uplo: MatrixTriangle, N: number, alpha: number, x: Complex64Array, strideX: number, offsetX: number, A: Complex64Array, strideA1: number, strideA2: number, offsetA: number ): Complex64Array; +} + +/** +* Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. +* +* @param order - storage layout +* @param uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. +* @param N - number of elements along each dimension of `A` +* @param alpha - scalar constant +* @param x - input array +* @param strideX - `x` stride length +* @param A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @returns input array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'row-major', 'lower', x.length, 2.0, x, 1, A, 2 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +*/ +declare var cher: Routine; + + +// EXPORTS // + +export = cher; diff --git a/lib/node_modules/@stdlib/blas/base/cher/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cher/docs/types/test.ts new file mode 100644 index 000000000000..5b464dd3ec72 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/docs/types/test.ts @@ -0,0 +1,346 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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 cher = require( './index' ); + + +// TESTS // + +// The function returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 10, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( '10', 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( true, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( false, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( null, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( undefined, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( [], 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( {}, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( ( x: number ): number => x, 'lower', 10, 1.0, x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 10, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', '10', 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', true, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', false, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', null, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', undefined, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', [], 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', {}, 10, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', ( x: number ): number => x, 10, 1.0, x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', '10', 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', true, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', false, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', null, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', undefined, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', [], 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', {}, 1.0, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', ( x: number ): number => x, 1.0, x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', 10, '10', x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, true, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, false, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, null, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, undefined, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, [], x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, {}, x, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, ( x: number ): number => x, x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex64Array... +{ + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', 10, 1.0, 10, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, '10', 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, true, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, false, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, null, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, undefined, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, [], 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, {}, 1, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, ( x: number ): number => x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', 10, 1.0, x, '10', A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, true, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, false, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, null, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, undefined, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, [], A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, {}, A, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, ( x: number ): number => x, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + + cher( 'row-major', 'lower', 10, 1.0, x, 1, 10, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, '10', 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, true, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, false, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, null, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, undefined, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, [], 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, {}, 3 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, ( x: number ): number => x, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, '10' ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, true ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, false ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, null ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, undefined ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, [] ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, {} ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher(); // $ExpectError + cher( 'row-major' ); // $ExpectError + cher( 'row-major', 'lower' ); // $ExpectError + cher( 'row-major', 'lower', 10 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1 ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A ); // $ExpectError + cher( 'row-major', 'lower', 10, 1.0, x, 1, A, 3, 1 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 10, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( '10', 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( true, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( false, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( null, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( undefined, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( [], 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( {}, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray.ndarray( 'row-major', ( x: number ): number => x, 10, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', '10', 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', true, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', false, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', null, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', undefined, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', [], 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', {}, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', ( x: number ): number => x, 1.0, x, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, '10', x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, true, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, false, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, null, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, undefined, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, [], x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, {}, x, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, ( x: number ): number => x, x, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex64Array... +{ + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, 10, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, '10', 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, true, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, false, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, null, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, undefined, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, [], 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, {}, 1, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, ( x: number ): number => x, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, '10', 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, true, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, false, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, null, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, undefined, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, [], 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, {}, 0, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, ( x: number ): number => x, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, '10', A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, true, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, false, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, null, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, undefined, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, [], A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, {}, A, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, ( x: number ): number => x, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, 10, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, '10', 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, true, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, false, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, null, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, undefined, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, [], 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, {}, 3, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, ( x: number ): number => x, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, '10', 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, true, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, false, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, null, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, undefined, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, [], 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, {}, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, '10', 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, true, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, false, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, null, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, undefined, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, [], 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, {}, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, '10' ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, true ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, false ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, null ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, undefined ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, [] ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, {} ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 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 Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cher.ndarray(); // $ExpectError + cher.ndarray( 'lower' ); // $ExpectError + cher.ndarray( 'lower', 10 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1 ); // $ExpectError + cher.ndarray( 'lower', 10, 1.0, x, 1, 0, A, 3, 1, 0, 1 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/examples/index.js b/lib/node_modules/@stdlib/blas/base/cher/examples/index.js new file mode 100644 index 000000000000..fc05c26d8422 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/examples/index.js @@ -0,0 +1,45 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var cher = require( './../lib' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var x = filledarrayBy( 3, 'complex64', rand ); +console.log( x.get( 0 ).toString() ); + +var A = filledarrayBy( 9, 'complex64', rand ); +console.log( A.get( 0 ).toString() ); + +cher( 'row-major', 'upper', 3, 1.0, x, 1, A, 3 ); + +// Print the results: +logEach( '(%s)', A ); + +cher.ndarray( 'upper', 3, 1.0, x, 1, 0, A, 3, 1, 0 ); + +// Print the results: +logEach( '(%s)', A ); diff --git a/lib/node_modules/@stdlib/blas/base/cher/lib/base.js b/lib/node_modules/@stdlib/blas/base/cher/lib/base.js new file mode 100644 index 000000000000..2f33e54762f3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/lib/base.js @@ -0,0 +1,138 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. +* +* @private +* @param {string} uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. +* @param {NonNegativeInteger} N - number of elements along each dimension of `A` +* @param {number} alpha - scalar +* @param {Complex64Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @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 - starting index for `A` +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +*/ +function cher( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offsetA ) { + var viewX; + var viewA; + var isrm; + var ix1; + var ix0; + var re0; + var re1; + var im0; + var im1; + var idx; + var sa0; + var sa1; + var i1; + var i0; + var ix; + var ia; + var re; + var im; + var sx; + + viewX = reinterpret( x, 0 ); + viewA = reinterpret( A, 0 ); + + isrm = isRowMajor( [ strideA1, strideA2 ] ); + if ( isrm ) { + sa0 = strideA2 * 2; // Stride for columns (inner dimension) + sa1 = strideA1 * 2; // Stride for rows (outer dimension) + } else { + sa0 = strideA1 * 2; // Stride for rows (inner dimension) + sa1 = strideA2 * 2; // Stride for columns (outer dimension) + } + + ix = offsetX * 2; + ia = offsetA * 2; + sx = strideX * 2; + + if ( ( isrm && uplo === 'upper' ) || ( !isrm && uplo === 'lower' ) ) { + for ( i1 = 0; i1 < N; i1++ ) { + ix1 = ix + ( i1 * sx ); + re0 = f32( viewX[ ix1 ] ); + im0 = f32( viewX[ ix1 + 1 ] ); + for ( i0 = i1; i0 < N; i0++ ) { + ix0 = ix + ( i0 * sx ); + re1 = f32( viewX[ ix0 ] ); + im1 = f32( viewX[ ix0 + 1 ] ); + re = f32( alpha * f32( ( re0 * re1 ) + ( im0 * im1 ) ) ); + im = f32( alpha * f32( ( im0 * re1 ) - ( re0 * im1 ) ) ); + idx = ia + ( i0 * sa0 ) + ( i1 * sa1 ); + viewA[ idx ] = f32( viewA[ idx ] + re ); + viewA[ idx + 1 ] = f32( viewA[ idx + 1 ] + im ); + if ( i0 === i1 ) { + viewA[ idx + 1 ] = 0.0; + } + } + } + return A; + } + // ( isrm && uplo === 'lower' ) || ( !isrm && uplo === 'upper' ) + for ( i1 = 0; i1 < N; i1++ ) { + ix1 = ix + ( i1 * sx ); + re0 = f32( viewX[ ix1 ] ); + im0 = f32( viewX[ ix1 + 1 ] ); + for ( i0 = 0; i0 <= i1; i0++ ) { + ix0 = ix + ( i0 * sx ); + re1 = f32( viewX[ ix0 ] ); + im1 = f32( viewX[ ix0 + 1 ] ); + re = f32( alpha * f32( ( re0 * re1 ) + ( im0 * im1 ) ) ); + im = f32( alpha * f32( ( im0 * re1 ) - ( re0 * im1 ) ) ); + idx = ia + ( i0 * sa0 ) + ( i1 * sa1 ); + viewA[ idx ] = f32( viewA[ idx ] + re ); + viewA[ idx + 1 ] = f32( viewA[ idx + 1 ] + im ); + if ( i0 === i1 ) { + viewA[ idx + 1 ] = 0.0; + } + } + } + return A; +} + + +// EXPORTS // + +module.exports = cher; diff --git a/lib/node_modules/@stdlib/blas/base/cher/lib/cher.js b/lib/node_modules/@stdlib/blas/base/cher/lib/cher.js new file mode 100644 index 000000000000..c212586972cb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/lib/cher.js @@ -0,0 +1,98 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 max = require( '@stdlib/math/base/special/fast/max' ); +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var format = require( '@stdlib/string/format' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. +* @param {NonNegativeInteger} N - number of elements along each dimension of `A` +* @param {number} alpha - scalar constant +* @param {Complex64Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {Complex64Array} A - input matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether to reference the lower or upper triangular matrix +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be non-zero +* @throws {RangeError} eighth argument must be greater than or equal to max(1,N) +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'row-major', 'lower', x.length, 2.0, x, 1, A, 2 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +*/ +function cher( order, uplo, N, alpha, x, strideX, A, LDA ) { + var sa1; + var sa2; + var ox; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must specify whether to reference the lower or upper triangular matrix. Value: `%s`.', uplo ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + if ( N === 0 || alpha === 0.0 ) { + return A; + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + } + ox = stride2offset( N, strideX ); + return ndarray( uplo, N, alpha, x, strideX, ox, A, sa1, sa2, 0 ); +} + + +// EXPORTS // + +module.exports = cher; diff --git a/lib/node_modules/@stdlib/blas/base/cher/lib/index.js b/lib/node_modules/@stdlib/blas/base/cher/lib/index.js new file mode 100644 index 000000000000..65ddcb996772 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/lib/index.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +/** +* Perform the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. +* +* @module @stdlib/blas/base/cher +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var cher = require( '@stdlib/blas/base/cher' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'row-major', 'lower', x.length, 2.0, x, 1 A, 2 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var cher = require( '@stdlib/blas/base/cher' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher.ndarray( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +*/ + +// 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 cher; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + cher = main; +} else { + cher = tmp; +} + + +// EXPORTS // + +module.exports = cher; + +// exports: { "ndarray": "cher.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/cher/lib/main.js b/lib/node_modules/@stdlib/blas/base/cher/lib/main.js new file mode 100644 index 000000000000..5edddebb5033 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var cher = require( './cher.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( cher, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cher; diff --git a/lib/node_modules/@stdlib/blas/base/cher/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cher/lib/ndarray.js new file mode 100644 index 000000000000..2dec7a7e1061 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/lib/ndarray.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `x` is an `N` element vector and `A` is an `N` by `N` hermitian matrix. +* +* @param {string} uplo - specifies whether `A` is an upper or lower triangular part of matrix is supplied. +* @param {NonNegativeInteger} N - number of elements along each dimension of `A` +* @param {number} alpha - scalar +* @param {Complex64Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @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 - starting index for `A` +* @throws {TypeError} first argument must specify whether to reference the lower or upper triangular matrix +* @throws {RangeError} second argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be non-zero +* @throws {RangeError} eighth argument must be non-zero +* @throws {RangeError} ninth argument must be non-zero +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var A = new Complex64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* +* cher( 'lower', x.length, 2.0, x, 1, 0, A, 2, 1, 0 ); +* // A => [ 11.0, 0.0, 0.0, 0.0, 24.0, -1.0, 54.0, 0.0 ] +*/ +function cher( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offsetA ) { + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. First argument must specify whether to reference the lower or upper triangular matrix. Value: `%s`.', uplo ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideA1 === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideA1 ) ); + } + if ( strideA2 === 0 ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideA2 ) ); + } + + if ( N === 0 || alpha === 0.0 ) { + return A; + } + return base( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offsetA ); +} + + +// EXPORTS // + +module.exports = cher; diff --git a/lib/node_modules/@stdlib/blas/base/cher/package.json b/lib/node_modules/@stdlib/blas/base/cher/package.json new file mode 100644 index 000000000000..88002f76839d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/package.json @@ -0,0 +1,79 @@ +{ + "name": "@stdlib/blas/base/cher", + "version": "0.0.0", + "description": "Performs the hermitian rank 1 operation `A = alpha*x*x**H + A`, where `alpha` is a real scalar, `X` is an `N` element vector and `A` is an `N` by `N` hermitian matrix.", + "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", + "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", + "level 2", + "linear", + "algebra", + "subroutines", + "cher", + "hermitian", + "matrix", + "vector", + "typed", + "array", + "ndarray", + "complex", + "complex64", + "float", + "float32", + "single", + "float32array" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 000000000000..d32193414129 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideX": 2, + "offsetX": 3, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 5.0, 6.0, 999.0, 999.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 8.0, 9.0, 999.0, 999.0, 0.0, 0.0, 1.0, 0.0, 7.0, 0.0, 11.0, 0.0, 999.0, 999.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 5, + "strideA1": -4, + "strideA2": 5, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 39.0, 14.0, 999.0, 999.0, 0.0, 0.0, 0.0, 0.0, 25.0, 8.0, 86.0, 13.0, 999.0, 999.0, 0.0, 0.0, 11.0, 0.0, 57.0, 0.0, 133.0, 0.0, 999.0, 999.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_l.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_l.json new file mode 100644 index 000000000000..931da5d5ad4c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_l.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_oa.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_oa.json new file mode 100644 index 000000000000..17b458e9ecad --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_oa.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 2, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_ox.json new file mode 100644 index 000000000000..62de4b705d60 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_ox.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 1, + "A": [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2.json new file mode 100644 index 000000000000..830173fb7f2a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 999.0, 999.0, 999.0, 999.0, 3.0, 4.0, 999.0, 999.0, 999.0, 999.0, 5.0, 6.0, 7.0, 0.0, 0.0, 0.0, 999.0, 999.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": 3, + "strideA2": 4, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 999.0, 999.0, 999.0, 999.0, 25.0, 8.0, 999.0, 999.0, 999.0, 999.0, 39.0, 14.0, 57.0, 0.0, 0.0, 0.0, 999.0, 999.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2n.json new file mode 100644 index 000000000000..c33c53414886 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1_sa2n.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 11.0, 0.0, 7.0, 0.0, 1.0, 0.0, 0.0, 0.0, 8.0, 9.0, 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, 5.0, 6.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": 3, + "strideA2": -4, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 133.0, 0.0, 57.0, 0.0, 11.0, 0.0, 0.0, 0.0, 86.0, 13.0, 25.0, 8.0, 0.0, 0.0, 0.0, 0.0, 39.0, 14.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2.json new file mode 100644 index 000000000000..39ed133c3fc8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 5.0, 6.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 8.0, 9.0, 0.0, 0.0, 1.0, 0.0, 7.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": -3, + "strideA2": 4, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 39.0, 14.0, 0.0, 0.0, 0.0, 0.0, 25.0, 8.0, 86.0, 13.0, 0.0, 0.0, 11.0, 0.0, 57.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2n.json new file mode 100644 index 000000000000..ef3d2c03cc12 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_sa1n_sa2n.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 11.0, 0.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 8.0, 9.0, 999.0, 999.0, 999.0, 999.0, 7.0, 0.0, 5.0, 6.0, 0.0, 0.0, 999.0, 999.0, 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": -3, + "strideA2": -4, + "offsetA": 20, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 133.0, 0.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 86.0, 13.0, 999.0, 999.0, 999.0, 999.0, 57.0, 0.0, 39.0, 14.0, 0.0, 0.0, 999.0, 999.0, 25.0, 8.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_u.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_u.json new file mode 100644 index 000000000000..1a93d925b824 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_u.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0 ], + [ 0.0, 0.0, 7.0, 0.0, 8.0, 9.0 ], + [ 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xn.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xn.json new file mode 100644 index 000000000000..23614cc00166 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xn.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "A": [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xp.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xp.json new file mode 100644 index 000000000000..18c3e388563d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/column_major_xp.json @@ -0,0 +1,20 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideX": 2, + "offsetX": 0, + "A": [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 7.0, 0.0, 8.0, 0.0 ], + [ 5.0, 6.0, 8.0, 9.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 000000000000..c7bcbc0ead07 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideX": 2, + "offsetX": 3, + "A": [ 999.0, 999.0, 999.0, 999.0, 7.0, 8.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 9.0, 10.0, 3.0, 4.0, 999.0, 999.0, 0.0, 0.0, 11.0, 0.0, 5.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 5, + "strideA1": -5, + "strideA2": 4, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 41.0, 0.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 87.0, 6.0, 25.0, 0.0, 999.0, 999.0, 0.0, 0.0, 133.0, 0.0, 55.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_l.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_l.json new file mode 100644 index 000000000000..55ca7b8ffe76 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_l.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_oa.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_oa.json new file mode 100644 index 000000000000..169bbf183bfa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_oa.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 2, + "A_out": [ 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_ox.json new file mode 100644 index 000000000000..f854a1ed993d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_ox.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 1, + "A": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2.json new file mode 100644 index 000000000000..92dc0aaf834e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 999.0, 999.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 999.0, 999.0, 999.0, 999.0, 5.0, 0.0, 7.0, 8.0, 999.0, 999.0, 0.0, 0.0, 9.0, 10.0, 999.0, 999.0, 999.0, 999.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": 4, + "strideA2": 3, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 999.0, 999.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 999.0, 999.0, 999.0, 999.0, 55.0, 0.0, 41.0, 0.0, 999.0, 999.0, 0.0, 0.0, 87.0, 6.0, 999.0, 999.0, 999.0, 999.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2n.json new file mode 100644 index 000000000000..63987f52d97e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1_sa2n.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 1.0, 0.0, 5.0, 0.0, 11.0, 0.0, 0.0, 0.0, 3.0, 4.0, 9.0, 10.0, 0.0, 0.0, 0.0, 0.0, 7.0, 8.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": 4, + "strideA2": -3, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 11.0, 0.0, 55.0, 0.0, 133.0, 0.0, 0.0, 0.0, 25.0, 0.0, 87.0, 6.0, 0.0, 0.0, 0.0, 0.0, 41.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2.json new file mode 100644 index 000000000000..ed0a420fc571 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 7.0, 8.0, 999.0, 999.0, 999.0, 999.0, 9.0, 10.0, 3.0, 4.0, 0.0, 0.0, 11.0, 0.0, 5.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": -4, + "strideA2": 3, + "offsetA": 12, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 41.0, 0.0, 999.0, 999.0, 999.0, 999.0, 87.0, 6.0, 25.0, 0.0, 0.0, 0.0, 133.0, 0.0, 55.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2n.json new file mode 100644 index 000000000000..68caaea83163 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_sa1n_sa2n.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 11.0, 0.0, 999.0, 999.0, 999.0, 999.0, 9.0, 10.0, 999.0, 999.0, 999.0, 999.0, 7.0, 8.0, 5.0, 0.0, 0.0, 0.0, 999.0, 999.0, 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 4, + "strideA1": -4, + "strideA2": -3, + "offsetA": 20, + "A_out": [ 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 999.0, 133.0, 0.0, 999.0, 999.0, 999.0, 999.0, 87.0, 6.0, 999.0, 999.0, 999.0, 999.0, 41.0, 0.0, 55.0, 0.0, 0.0, 0.0, 999.0, 999.0, 25.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999.0, 999.0, 11.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_u.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_u.json new file mode 100644 index 000000000000..a6da60d5d443 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_u.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "upper", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "A": [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 7.0, 0.0, 8.0, 9.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 3.0, 4.0, 5.0, 6.0 ], + [ 0.0, 0.0, 7.0, 0.0, 8.0, 9.0 ], + [ 0.0, 0.0, 0.0, 0.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 25.0, 8.0, 39.0, 14.0, 0.0, 0.0, 57.0, 0.0, 86.0, 13.0, 0.0, 0.0, 0.0, 0.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xn.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xn.json new file mode 100644 index 000000000000..f1fdc963792d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xn.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "A": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xp.json b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xp.json new file mode 100644 index 000000000000..6d0c8091f69c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/fixtures/row_major_xp.json @@ -0,0 +1,20 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": 2.0, + "x": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideX": 2, + "offsetX": 0, + "A": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, 4.0, 5.0, 0.0, 0.0, 0.0 ], + [ 7.0, 8.0, 9.0, 10.0, 11.0, 0.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 25.0, 0.0, 55.0, 0.0, 0.0, 0.0, 41.0, 0.0, 87.0, 6.0, 133.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/test.cher.js b/lib/node_modules/@stdlib/blas/base/cher/test/test.cher.js new file mode 100644 index 000000000000..955b3558e841 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/test.cher.js @@ -0,0 +1,469 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var cher = require( './../lib/cher.js' ); + + +// FIXTURES // + +var ru = require( './fixtures/row_major_u.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); + +var cu = require( './fixtures/column_major_u.json' ); +var cl = require( './fixtures/column_major_l.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cher, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( cher.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + 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() { + cher( value, data.uplo, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, new Complex64Array( data.A ), data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + 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() { + cher( data.order, value, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, new Complex64Array( data.A ), data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + -1, + -2, + -3 + ]; + + 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() { + cher( data.order, data.uplo, value, data.alpha, new Complex64Array( data.x ), data.strideX, new Complex64Array( data.A ), data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 0 + ]; + + 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() { + cher( data.order, data.uplo, data.N, data.alpha, new Complex64Array( data.x ), value, new Complex64Array( data.A ), data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 2, + 1, + 0, + -1, + -2, + -3 + ]; + + 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() { + cher( data.order, data.uplo, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, new Complex64Array( data.A ), value ); + }; + } +}); + +tape( 'the function performs hermitian rank 1 operation `A = alpha*x*x**H + A` (row-major, lower)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 1 operation `A = alpha*x*x**H + A` (column-major, lower)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 1 operation `A = alpha*x*x**H + A` (row-major, upper)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = ru; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 1 operation `A = alpha*x*x**H + A` (column-major, upper)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cu; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input matrix (row-major)', function test( t ) { + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input matrix (column-major)', function test( t ) { + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input matrix unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.order, data.uplo, 0, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input matrix unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.order, data.uplo, 0, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function returns the second input matrix unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.order, data.uplo, data.N, 0.0, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function returns the second input matrix unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.order, data.uplo, data.N, 0.0, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.order, data.uplo, data.N, data.alpha, x, data.strideX, a, data.LDA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/test.js b/lib/node_modules/@stdlib/blas/base/cher/test/test.js new file mode 100644 index 000000000000..f4a3b923f00e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isBrowser = require( '@stdlib/assert/is-browser' ); +var cher = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': isBrowser +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cher, '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 cher.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 cher = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cher, mock, 'returns native implementation' ); + 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 cher; + var main; + + main = require( './../lib/cher.js' ); + + cher = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cher, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/cher/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cher/test/test.ndarray.js new file mode 100644 index 000000000000..f088f5746609 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cher/test/test.ndarray.js @@ -0,0 +1,718 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var cher = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var ru = require( './fixtures/row_major_u.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); +var roa = require( './fixtures/row_major_oa.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var rsa1sa2 = require( './fixtures/row_major_sa1_sa2.json' ); +var rsa1nsa2 = require( './fixtures/row_major_sa1n_sa2.json' ); +var rsa1sa2n = require( './fixtures/row_major_sa1_sa2n.json' ); +var rsa1nsa2n = require( './fixtures/row_major_sa1n_sa2n.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); + +var cu = require( './fixtures/column_major_u.json' ); +var cl = require( './fixtures/column_major_l.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); +var coa = require( './fixtures/column_major_oa.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var csa1sa2 = require( './fixtures/column_major_sa1_sa2.json' ); +var csa1nsa2 = require( './fixtures/column_major_sa1n_sa2.json' ); +var csa1sa2n = require( './fixtures/column_major_sa1_sa2n.json' ); +var csa1nsa2n = require( './fixtures/column_major_sa1n_sa2n.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cher, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( cher.length, 10, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + 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() { + cher( value, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, data.offsetX, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + -1, + -2, + -3 + ]; + + 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() { + cher( data.uplo, value, data.alpha, new Complex64Array( data.x ), data.strideX, data.offsetX, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 0 + ]; + + 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() { + cher( data.uplo, data.N, data.alpha, new Complex64Array( data.x ), value, data.offsetX, new Complex64Array( data.A ), data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 0 + ]; + + 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() { + cher( data.uplo, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, data.offsetX, new Complex64Array( data.A ), value, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) { + var values; + var data; + var i; + + data = ru; + + values = [ + 0 + ]; + + 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() { + cher( data.uplo, data.N, data.alpha, new Complex64Array( data.x ), data.strideX, data.offsetX, new Complex64Array( data.A ), data.strideA1, value, data.offsetA ); + }; + } +}); + +tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (row-major, lower)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (column-major, lower)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (column-major, upper)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cu; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (row-major, upper)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = ru; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input matrix `A`', function test( t ) { + var data; + var out; + var a; + var x; + + data = ru; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or the scalar constant is zero, the function returns the input matrix `A` unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + out = cher( data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or the scalar constant is zero, the function returns the input matrix `A` unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cl; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A ); + + out = cher( data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + out = cher( data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1sa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1sa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1nsa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1nsa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1sa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1sa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports negative strides for both dimensions of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1nsa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports negative strides for both dimensions of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1nsa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `A` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = roa; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `A` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = coa; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rox; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cox; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rcap; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = ccap; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + + expected = new Complex64Array( data.A_out ); + + out = cher( data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex64Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +});