diff --git a/lib/node_modules/@stdlib/blas/base/zher2/README.md b/lib/node_modules/@stdlib/blas/base/zher2/README.md new file mode 100644 index 000000000000..6a526fe21bc8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/README.md @@ -0,0 +1,296 @@ + + +# zher2 + +> Perform the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`. + +
+ +## Usage + +```javascript +var zher2 = require( '@stdlib/blas/base/zher2' ); +``` + +#### zher2( order, uplo, N, α, x, strideX, y, strideY, A, LDA ) + +Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors and `A` is an `N` by `N` hermitian matrix. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +var alpha = new Complex128( 1.0, 0.0 ); + +zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); +// A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.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**: first input vector [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `x`. +- **y**: second input vector [`Complex128Array`][@stdlib/array/complex128]. +- **strideY**: index increment for `y`. +- **A**: input matrix stored in linear memory as [`Complex128Array`][@stdlib/array/complex128]. +- **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 Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +var alpha = new Complex128( 1.0, 0.0 ); + +zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); +// A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.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 Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +// Initial array: +var x0 = new Complex128Array( [ 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ] ); +var y0 = new Complex128Array( [ 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ] ); + +var alpha = new Complex128( 1.0, 0.0 ); + +// Define a input matrix: +var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + +// Create an offset view: +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +zher2( 'row-major', 'lower', x1.length, alpha, x1, 1, y1, 1, A, 2 ); +// A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +``` + + + +#### zher2.ndarray( uplo, N, α, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) + +Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, using alternative indexing semantics and where `α` is a scalar, `x` and `y` are `N` element vectors and `A` is an `N` by `N` hermitian matrix. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +var alpha = new Complex128( 1.0, 0.0 ); + +zher2.ndarray( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); +// A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.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`. +- **offsetY**: starting index for `y`. +- **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 Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); + +var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +var alpha = new Complex128( 1.0, 0.0 ); + +zher2.ndarray( 'lower', x.length, alpha, x, -1, 0, y, -1, 0, A, 2, 1, 0 ); +// A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +``` + +
+ + + +
+ +## Notes + +- If `N = 0` or `real( α ) = 0.0` or `imag( α ) = 0.0`, both functions return `x` unchanged. +- `zher2()` corresponds to the [BLAS][blas] level 2 function [`zher2`][zher2]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var zher2 = require( '@stdlib/blas/base/zher2' ); + +function rand() { + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var x = filledarrayBy( 3, 'complex128', rand ); +console.log( x.get( 0 ).toString() ); + +var y = filledarrayBy( 3, 'complex128', rand ); +console.log( y.get( 0 ).toString() ); + +var A = filledarrayBy( 9, 'complex128', rand ); +console.log( A.get( 0 ).toString() ); + +var alpha = new Complex128( 2.0, 2.0 ); +console.log( alpha.toString() ); + +zher2( 'row-major', 'upper', 3, alpha, x, 1, y, 1, A, 3 ); + +// Print the results: +logEach( '(%s)', A ); + +zher2.ndarray( 'upper', 3, alpha, x, 1, 0, y, 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/zher2/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zher2/benchmark/benchmark.js new file mode 100644 index 000000000000..4561515eff05 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/benchmark/benchmark.js @@ -0,0 +1,119 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zher2 = require( './../lib/zher2.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + ybuf = uniform( len*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + Abuf = uniform( (len*len)*2, -100.0, 100.0, options ); + A = new Complex128Array( Abuf.buffer ); + + alpha = new Complex128( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zher2( 'row-major', 'lower', len, alpha, x, 1, y, 1, A, len ); + if ( isnan( Abuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( 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/zher2/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/zher2/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..01084de4b771 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/benchmark/benchmark.ndarray.js @@ -0,0 +1,119 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zher2 = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var alpha; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + xbuf = uniform( len*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + ybuf = uniform( len*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + Abuf = uniform( (len*len)*2, -100.0, 100.0, options ); + A = new Complex128Array( Abuf.buffer ); + + alpha = new Complex128( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zher2( 'lower', len, alpha, x, 1, 0, y, 1, 0, A, len, 1, 0 ); + if ( isnan( Abuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( 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/zher2/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zher2/docs/repl.txt new file mode 100644 index 000000000000..487f963a73f7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/docs/repl.txt @@ -0,0 +1,150 @@ + +{{alias}}( order, uplo, N, α, x, strideX, y, strideY, A, LDA ) + Performs the hermitian rank 2 operation + `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, + `x` and `y` are `N` element vectors 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: Complex128Array + First input array. + + strideX: integer + Index increment for `x`. + + y: Complex128Array + Second input array. + + strideY: integer + Index increment for `y`. + + A: Complex128Array + Input matrix. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + Returns + ------- + A: Complex128Array + Input matrix. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > {{alias}}( 'row-major', 'lower', 2, alpha, x, 1, y, 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/complex128}}( [ 3.0, 4.0, 1.0, 2.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 3.0, 4.0, 1.0, 2.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > {{alias}}( 'row-major', 'lower', 2, alpha, x, -1, y, -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/complex128}}( [ 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 ] ); + > var y0 = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > {{alias}}( 'row-major', 'lower', 2, alpha, x1, -1, y1, -1, A, 2 ) + [ 11.0, 0.0, 0.0, 0.0, 27.0, 2.0, 57.0, 0.0 ] + + +{{alias}}.ndarray( uplo, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa ) + Performs the hermitian rank 2 operation + `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, + `x` and `y` are `N` element vectors 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: Complex128Array + First input array. + + sx: integer + Index increment for `x`. + + ox: integer + Starting index for `x`. + + y: Complex128Array + Second input array. + + sy: integer + Index increment for `y`. + + oy: integer + Starting index for `y`. + + A: Complex128Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + Returns + ------- + A: Complex128Array + Input matrix. + + Examples + -------- + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 0.0, 0.0, 0.0, 5.0, 6.0, 7.0, 0.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > {{alias}}.ndarray( 'lower', 2, alpha, x, 1, 0, y, 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/zher2/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zher2/docs/types/index.d.ts new file mode 100644 index 000000000000..dc91cb64ba11 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/docs/types/index.d.ts @@ -0,0 +1,137 @@ +/* +* @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 { Complex128Array } from '@stdlib/types/array'; +import { Complex128 } from '@stdlib/types/complex'; +import { Layout, MatrixTriangle } from '@stdlib/types/blas'; + +/** +* Interface describing `zher2`. +*/ +interface Routine { + /** + * Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` 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 Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + * var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + * var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + * var alpha = new Complex128( 1.0, 0.0 ); + * + * zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); + * // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] + */ + ( order: Layout, uplo: MatrixTriangle, N: number, alpha: Complex128, x: Complex128Array, strideX: number, y: Complex128Array, strideY: number, A: Complex128Array, LDA: number ): Complex128Array; + + /** + * Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 - first input array + * @param strideX - `x` stride length + * @param offsetX - starting `x` index + * @param y - second input array + * @param strideY - `y` stride length + * @param offsetY - starting `y` 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 Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + * var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); + * var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); + * var alpha = new Complex128( 1.0, 0.0 ); + * + * zher2( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); + * // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] + */ + ndarray( uplo: MatrixTriangle, N: number, alpha: Complex128, x: Complex128Array, strideX: number, offsetX: number, y: Complex128Array, strideY: number, offsetY: number, A: Complex128Array, strideA1: number, strideA2: number, offsetA: number ): Complex128Array; +} + +/** +* Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 - first input array +* @param strideX - `x` stride length +* @param y - second input array +* @param strideY - `y` 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 Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +*/ +declare var zher2: Routine; + + +// EXPORTS // + +export = zher2; diff --git a/lib/node_modules/@stdlib/blas/base/zher2/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zher2/docs/types/test.ts new file mode 100644 index 000000000000..d00e6fe41c9b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/docs/types/test.ts @@ -0,0 +1,479 @@ +/* +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +import Complex128 = require( '@stdlib/complex/float64/ctor' ); +import zher2 = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 10, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( '10', 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( true, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( false, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( null, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( undefined, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( [], 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( {}, 'lower', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( ( x: number ): number => x, 'lower', 10, alpha, x, 1, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 10, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', '10', 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', true, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', false, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', null, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', undefined, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', [], 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', {}, 10, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', ( x: number ): number => x, 10, alpha, x, 1, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', '10', alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', true, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', false, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', null, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', undefined, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', [], alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', {}, alpha, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', ( x: number ): number => x, alpha, x, 1, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zher2( 'row-major', 'lower', 10, '10', x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, true, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, false, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, null, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, undefined, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, [], x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, {}, x, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, ( x: number ): number => x, x, 1, y, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex128Array... +{ + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, 10, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, '10', 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, true, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, false, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, null, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, undefined, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, [], 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, {}, 1, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, ( x: number ): number => x, 1, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, '10', y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, true, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, false, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, null, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, undefined, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, [], y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, {}, y, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, ( x: number ): number => x, y, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, 1, 10, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, '10', 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, true, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, false, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, null, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, undefined, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, [], 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, {}, 1, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, ( x: number ): number => x, 1, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, '10', A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, true, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, false, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, null, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, undefined, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, [], A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, {}, A, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, ( x: number ): number => x, A, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, 10, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, '10', 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, true, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, false, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, null, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, undefined, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, [], 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, {}, 3 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, ( x: number ): number => x, 3 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, '10' ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, true ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, false ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, null ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, undefined ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, [] ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, {} ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2(); // $ExpectError + zher2( 'row-major' ); // $ExpectError + zher2( 'row-major', 'lower' ); // $ExpectError + zher2( 'row-major', 'lower', 10 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1 ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A ); // $ExpectError + zher2( 'row-major', 'lower', 10, alpha, x, 1, y, 1, A, 3, 1 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( '10', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( true, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( false, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( null, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( undefined, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( [], 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( {}, 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( ( x: number ): number => x, 10, alpha, x, 1, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', '10', alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', true, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', false, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', null, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', undefined, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', [], alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', {}, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', ( x: number ): number => x, alpha, x, 1, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zher2.ndarray( 'lower', 10, '10', x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, true, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, false, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, null, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, undefined, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, [], x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, {}, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, ( x: number ): number => x, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex128Array... +{ + const A = new Complex128Array( 20 ); + const y = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, 10, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, '10', 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, true, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, false, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, null, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, undefined, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, [], 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, {}, 1, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, ( x: number ): number => x, 1, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, '10', 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, true, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, false, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, null, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, undefined, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, [], 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, {}, 0, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, ( x: number ): number => x, 0, y, 1, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, '10', y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, true, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, false, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, null, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, undefined, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, [], y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, {}, y, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, ( x: number ): number => x, y, 1, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, 10, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, '10', 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, true, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, false, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, null, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, undefined, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, [], 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, {}, 1, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, ( x: number ): number => x, 1, 0, A, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, '10', 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, true, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, false, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, null, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, undefined, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, [], 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, {}, 0, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, ( x: number ): number => x, 0, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, '10', A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, true, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, false, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, null, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, undefined, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, [], A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, {}, A, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, ( x: number ): number => x, A, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, 10, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, '10', 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, true, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, false, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, null, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, undefined, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, [], 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, {}, 3, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, ( x: number ): number => x, 3, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eleventh argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, '10', 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, true, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, false, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, null, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, undefined, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, [], 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, {}, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, '10', 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, true, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, false, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, null, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, undefined, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, [], 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, {}, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, '10' ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, true ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, false ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, null ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, undefined ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, [] ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, {} ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zher2.ndarray(); // $ExpectError + zher2.ndarray( 'lower' ); // $ExpectError + zher2.ndarray( 'lower', 10 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1 ); // $ExpectError + zher2.ndarray( 'lower', 10, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0, 1 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/zher2/examples/index.js b/lib/node_modules/@stdlib/blas/base/zher2/examples/index.js new file mode 100644 index 000000000000..8a654906aea7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/examples/index.js @@ -0,0 +1,51 @@ +/** +* @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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var zher2 = require( './../lib' ); + +function rand() { + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var x = filledarrayBy( 3, 'complex128', rand ); +console.log( x.get( 0 ).toString() ); + +var y = filledarrayBy( 3, 'complex128', rand ); +console.log( y.get( 0 ).toString() ); + +var A = filledarrayBy( 9, 'complex128', rand ); +console.log( A.get( 0 ).toString() ); + +var alpha = new Complex128( 2.0, 2.0 ); +console.log( alpha.toString() ); + +zher2( 'row-major', 'upper', 3, alpha, x, 1, y, 1, A, 3 ); + +// Print the results: +logEach( '(%s)', A ); + +zher2.ndarray( 'upper', 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); + +// Print the results: +logEach( '(%s)', A ); diff --git a/lib/node_modules/@stdlib/blas/base/zher2/lib/base.js b/lib/node_modules/@stdlib/blas/base/zher2/lib/base.js new file mode 100644 index 000000000000..272cea0ff054 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/lib/base.js @@ -0,0 +1,202 @@ +/** +* @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-complex128' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + + +// MAIN // + +/** +* Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 {Complex128} alpha - scalar +* @param {Complex128Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Complex128Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @param {Complex128Array} 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 {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +*/ +function zher2( uplo, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-params, max-len + var realpha; + var imalpha; + var retmp1; + var imtmp1; + var retmp2; + var imtmp2; + var viewX; + var viewY; + var viewA; + var xre0; + var xim0; + var yre0; + var yim0; + var xre1; + var xim1; + var yre1; + var yim1; + var isrm; + var idx; + var ix1; + var iy1; + var ix0; + var iy0; + var re0; + var im0; + var re1; + var im1; + var sa0; + var sa1; + var re; + var im; + var i1; + var i0; + var ix; + var iy; + var ia; + var sx; + var sy; + + realpha = real( alpha ); + imalpha = imag( alpha ); + + viewX = reinterpret( x, 0 ); + viewY = reinterpret( y, 0 ); + viewA = reinterpret( A, 0 ); + + isrm = isRowMajor( [ strideA1, strideA2 ] ); + if ( isrm ) { + sa0 = strideA2 * 2; + sa1 = strideA1 * 2; + } else { + sa0 = strideA1 * 2; + sa1 = strideA2 * 2; + } + ix = offsetX * 2; + iy = offsetY * 2; + ia = offsetA * 2; + sx = strideX * 2; + sy = strideY * 2; + if ( ( isrm && uplo === 'upper' ) || ( !isrm && uplo === 'lower' ) ) { + for ( i1 = 0; i1 < N; i1++ ) { + ix1 = ix + ( i1 * sx ); + iy1 = iy + ( i1 * sy ); + xre0 = viewX[ ix1 ]; + xim0 = viewX[ ix1 + 1 ]; + yre0 = viewY[ iy1 ]; + yim0 = viewY[ iy1 + 1 ]; + for ( i0 = i1; i0 < N; i0++ ) { + ix0 = ix + ( i0 * sx ); + iy0 = iy + ( i0 * sy ); + xre1 = viewX[ ix0 ]; + xim1 = viewX[ ix0 + 1 ]; + yre1 = viewY[ iy0 ]; + yim1 = viewY[ iy0 + 1 ]; + + re0 = ( xre0 * yre1 ) + ( xim0 * yim1 ); + im0 = ( xim0 * yre1 ) - ( xre0 * yim1 ); + retmp1 = ( realpha * re0 ) - ( imalpha * im0 ); + imtmp1 = ( realpha * im0 ) + ( imalpha * re0 ); + + re1 = ( yre0 * xre1 ) + ( yim0 * xim1 ); + im1 = ( yim0 * xre1 ) - ( yre0 * xim1 ); + retmp2 = ( realpha * re1 ) + ( imalpha * im1 ); + imtmp2 = ( realpha * im1 ) - ( imalpha * re1 ); + + re = retmp1 + retmp2; + im = imtmp1 + imtmp2; + idx = ia + ( i0 * sa0 ) + ( i1 * sa1 ); + viewA[ idx ] += re; + 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 ); + iy1 = iy + ( i1 * sy ); + xre0 = viewX[ ix1 ]; + xim0 = viewX[ ix1 + 1 ]; + yre0 = viewY[ iy1 ]; + yim0 = viewY[ iy1 + 1 ]; + for ( i0 = 0; i0 <= i1; i0++ ) { + ix0 = ix + ( i0 * sx ); + iy0 = iy + ( i0 * sy ); + xre1 = viewX[ ix0 ]; + xim1 = viewX[ ix0 + 1 ]; + yre1 = viewY[ iy0 ]; + yim1 = viewY[ iy0 + 1 ]; + + re0 = ( xre0 * yre1 ) + ( xim0 * yim1 ); + im0 = ( xim0 * yre1 ) - ( xre0 * yim1 ); + retmp1 = ( realpha * re0 ) - ( imalpha * im0 ); + imtmp1 = ( realpha * im0 ) + ( imalpha * re0 ); + + re1 = ( yre0 * xre1 ) + ( yim0 * xim1 ); + im1 = ( yim0 * xre1 ) - ( yre0 * xim1 ); + retmp2 = ( realpha * re1 ) + ( imalpha * im1 ); + imtmp2 = ( realpha * im1 ) - ( imalpha * re1 ); + + re = retmp1 + retmp2; + im = imtmp1 + imtmp2; + idx = ia + ( i0 * sa0 ) + ( i1 * sa1 ); + viewA[ idx ] += re; + viewA[ idx + 1 ] += im; + if ( i0 === i1 ) { + viewA[ idx + 1 ] = 0.0; + } + } + } + return A; +} + + +// EXPORTS // + +module.exports = zher2; diff --git a/lib/node_modules/@stdlib/blas/base/zher2/lib/index.js b/lib/node_modules/@stdlib/blas/base/zher2/lib/index.js new file mode 100644 index 000000000000..12eb105074f9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/lib/index.js @@ -0,0 +1,76 @@ +/** +* @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'; + +/** +* BLAS level 2 routine to perform the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors and `A` is an `N` by `N` hermitian matrix. +* +* @module @stdlib/blas/base/zher2 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var zher2 = require( '@stdlib/blas/base/zher2' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var zher2 = require( '@stdlib/blas/base/zher2' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2.ndarray( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.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 zher2; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + zher2 = main; +} else { + zher2 = tmp; +} + + +// EXPORTS // + +module.exports = zher2; + +// exports: { "ndarray": "zher2.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/zher2/lib/main.js b/lib/node_modules/@stdlib/blas/base/zher2/lib/main.js new file mode 100644 index 000000000000..4714efc0dcd3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/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 zher2 = require( './zher2.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( zher2, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = zher2; diff --git a/lib/node_modules/@stdlib/blas/base/zher2/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/zher2/lib/ndarray.js new file mode 100644 index 000000000000..66fe8d11c094 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/lib/ndarray.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 isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var format = require( '@stdlib/string/format' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 {Complex128} alpha - scalar +* @param {Complex128Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Complex128Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @param {Complex128Array} 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} eleventh argument must be non-zero +* @throws {RangeError} twelfth argument must be non-zero +* @returns {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'lower', x.length, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +*/ +function zher2( uplo, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-params, max-len + 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 ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) ); + } + if ( strideA1 === 0 ) { + throw new RangeError( format( 'invalid argument. Eleventh argument must be non-zero. Value: `%d`.', strideA1 ) ); + } + if ( strideA2 === 0 ) { + throw new RangeError( format( 'invalid argument. Twelfth argument must be non-zero. Value: `%d`.', strideA2 ) ); + } + + if ( N === 0 || ( real( alpha ) === 0.0 && imag( alpha ) === 0.0 ) ) { + return A; + } + return base( uplo, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ); +} + + +// EXPORTS // + +module.exports = zher2; diff --git a/lib/node_modules/@stdlib/blas/base/zher2/lib/zher2.js b/lib/node_modules/@stdlib/blas/base/zher2/lib/zher2.js new file mode 100644 index 000000000000..e9318effe2e2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/lib/zher2.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 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 real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var format = require( '@stdlib/string/format' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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 {Complex128} alpha - scalar constant +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {Complex128Array} y - input array +* @param {integer} strideY - `y` stride length +* @param {Complex128Array} 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 non-zero +* @throws {RangeError} tenth argument must be greater than or equal to max(1,N) +* @returns {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +* var A = new Complex128Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 3.0, 4.0, 0.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* +* zher2( 'row-major', 'lower', x.length, alpha, x, 1, y, 1, A, 2 ); +* // A => [ 5.0, 0.0, 0.0, 0.0, 6.0, 3.0, 8.0, 0.0 ] +*/ +function zher2( order, uplo, N, alpha, x, strideX, y, strideY, A, LDA ) { + var sa1; + var sa2; + var ox; + var oy; + + 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 ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) ); + } + if ( LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Tenth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + if ( N === 0 || ( real( alpha ) === 0.0 && imag( alpha ) === 0.0 ) ) { + return A; + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + } + ox = stride2offset( N, strideX ); + oy = stride2offset( N, strideY ); + return ndarray( uplo, N, alpha, x, strideX, ox, y, strideY, oy, A, sa1, sa2, 0 ); +} + + +// EXPORTS // + +module.exports = zher2; diff --git a/lib/node_modules/@stdlib/blas/base/zher2/package.json b/lib/node_modules/@stdlib/blas/base/zher2/package.json new file mode 100644 index 000000000000..fe87b16abe70 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/package.json @@ -0,0 +1,79 @@ +{ + "name": "@stdlib/blas/base/zher2", + "version": "0.0.0", + "description": "Perform the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A`, where `α` is a scalar, `x` and `y` are `N` element vectors 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", + "zher2", + "hermitian", + "vector", + "matrix", + "typed", + "array", + "ndarray", + "complex", + "complex128", + "float", + "float64", + "double", + "float64array" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 000000000000..664ea712256a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,24 @@ + +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 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 ], + "strideY": 2, + "offsetY": 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/zher2/test/fixtures/column_major_l.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_l.json new file mode 100644 index 000000000000..dbe3014a1e63 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_l.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_oa.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_oa.json new file mode 100644 index 000000000000..891d0956238b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_oa.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_ox.json new file mode 100644 index 000000000000..39a241c4b53a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_ox.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 1, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_oy.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_oy.json new file mode 100644 index 000000000000..8a9a2537bb27 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_oy.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1_sa2.json new file mode 100644 index 000000000000..d67e5569c1b0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1_sa2.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1_sa2n.json new file mode 100644 index 000000000000..888f13baaf67 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1_sa2n.json @@ -0,0 +1,24 @@ + +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1n_sa2.json new file mode 100644 index 000000000000..7b708d644950 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1n_sa2.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1n_sa2n.json new file mode 100644 index 000000000000..a27fab2a6cd1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_sa1n_sa2n.json @@ -0,0 +1,24 @@ + +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_u.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_u.json new file mode 100644 index 000000000000..1daf0811e551 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_u.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/column_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xnyn.json new file mode 100644 index 000000000000..4aa51d4e4f3c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xnyn.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "y": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideY": -1, + "offsetY": 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/zher2/test/fixtures/column_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xnyp.json new file mode 100644 index 000000000000..2c16024eae17 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xnyp.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "y": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideY": 2, + "offsetY": 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/zher2/test/fixtures/column_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xpyn.json new file mode 100644 index 000000000000..3267846dfc7c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xpyn.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideY": -1, + "offsetY": 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/zher2/test/fixtures/column_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xpyp.json new file mode 100644 index 000000000000..11cfb1df8db5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/column_major_xpyp.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideY": 2, + "offsetY": 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/zher2/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 000000000000..209cf6f8b433 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 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 ], + "strideY": 2, + "offsetY": 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/zher2/test/fixtures/row_major_l.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_l.json new file mode 100644 index 000000000000..268f6836ef2a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_l.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_oa.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_oa.json new file mode 100644 index 000000000000..fbb0a6ec9f26 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_oa.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_ox.json new file mode 100644 index 000000000000..f5831752072e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_ox.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 1, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_oy.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_oy.json new file mode 100644 index 000000000000..aaf7ce3c175c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_oy.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1_sa2.json new file mode 100644 index 000000000000..da684a1990f6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1_sa2.json @@ -0,0 +1,24 @@ + +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1_sa2n.json new file mode 100644 index 000000000000..9c839a580b63 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1_sa2n.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1n_sa2.json new file mode 100644 index 000000000000..d3c2b6f67f3d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1n_sa2.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1n_sa2n.json new file mode 100644 index 000000000000..6940cb5c665f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_sa1n_sa2n.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_u.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_u.json new file mode 100644 index 000000000000..63d5befb4232 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_u.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "upper", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideY": 1, + "offsetY": 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/zher2/test/fixtures/row_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xnyn.json new file mode 100644 index 000000000000..977d00e612d3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xnyn.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "y": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideY": -1, + "offsetY": 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/zher2/test/fixtures/row_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xnyp.json new file mode 100644 index 000000000000..50394ac55c09 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xnyp.json @@ -0,0 +1,24 @@ + +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.0 ], + "x": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideX": -1, + "offsetX": 2, + "y": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideY": 2, + "offsetY": 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/zher2/test/fixtures/row_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xpyn.json new file mode 100644 index 000000000000..05a3700e4e2c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xpyn.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ], + "strideY": -1, + "offsetY": 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/zher2/test/fixtures/row_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xpyp.json new file mode 100644 index 000000000000..6db54255a0c8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/fixtures/row_major_xpyp.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 1.0, 0.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, + "y": [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0, 5.0, 6.0 ], + "strideY": 2, + "offsetY": 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/zher2/test/test.js b/lib/node_modules/@stdlib/blas/base/zher2/test/test.js new file mode 100644 index 000000000000..25d43d0ffc7e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/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 zher2 = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': isBrowser +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zher2, '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 zher2.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 zher2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zher2, 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 zher2; + var main; + + main = require( './../lib/zher2.js' ); + + zher2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zher2, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/zher2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/zher2/test/test.ndarray.js new file mode 100644 index 000000000000..1bd4dfb258b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/test.ndarray.js @@ -0,0 +1,998 @@ +/** +* @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 isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var zher2 = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var ru = require( './fixtures/row_major_u.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); +var roa = require( './fixtures/row_major_oa.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var roy = require( './fixtures/row_major_oy.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 cxpyp = require( './fixtures/column_major_xpyp.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyn = require( './fixtures/column_major_xpyp.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); +var coa = require( './fixtures/column_major_oa.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var coy = require( './fixtures/column_major_oy.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 zher2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 13', function test( t ) { + t.strictEqual( zher2.length, 13, '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() { + zher2( value, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( 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() { + zher2( data.uplo, value, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( 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() { + zher2( data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), value, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( 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() { + zher2( data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( data.A ), value, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eleventh 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() { + zher2( data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( data.A ), data.strideA1, value, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid twelfth 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() { + zher2( data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, data.offsetX, new Complex128Array( data.y ), data.strideY, data.offsetY, new Complex128Array( data.A ), data.strideA1, value, data.offsetA ); + }; + } +}); + +tape( 'the function performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (row-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (column-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (column-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cu; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (row-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ru; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input matrix `A`', function test( t ) { + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ru; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.uplo, 0, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + out = zher2( data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.uplo, 0, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( a, expected, 'returns expected value' ); + + out = zher2( data.uplo, data.N, new Complex128( 0.0, 0.0 ), x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1sa2; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1sa2; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1nsa2; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1nsa2; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1sa2n; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1sa2n; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1nsa2n; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1nsa2n; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `A` offset (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = roa; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `A` offset (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = coa; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying strides (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxpyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying strides (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxpyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxnyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxnyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxpyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxpyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative strides for `x` and `y` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxnyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative strides for `x` and `y` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxnyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rox; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cox; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `y` offset (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = roy; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `y` offset (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = coy; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rcap; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ccap; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.uplo, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/zher2/test/test.zher2.js b/lib/node_modules/@stdlib/blas/base/zher2/test/test.zher2.js new file mode 100644 index 000000000000..966302b564d3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zher2/test/test.zher2.js @@ -0,0 +1,649 @@ +/** +* @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 isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var zher2 = require( './../lib/zher2.js' ); + + +// FIXTURES // + +var ru = require( './fixtures/row_major_u.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); + +var cu = require( './fixtures/column_major_u.json' ); +var cl = require( './fixtures/column_major_l.json' ); +var cxpyp = require( './fixtures/column_major_xpyp.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyn = require( './fixtures/column_major_xpyp.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zher2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( zher2.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 = 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() { + zher2( value, data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, new Complex128Array( data.y ), data.strideY, new Complex128Array( 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() { + zher2( data.uplo, value, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, new Complex128Array( data.y ), data.strideY, new Complex128Array( 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() { + zher2( data.order, data.uplo, value, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, new Complex128Array( data.y ), data.strideY, new Complex128Array( 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() { + zher2( data.order, data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), value, new Complex128Array( data.y ), data.strideY, new Complex128Array( 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 = [ + 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() { + zher2( data.order, data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, new Complex128Array( data.y ), value, new Complex128Array( data.A ), data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid tenth 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() { + zher2( data.order, data.uplo, data.N, new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ), new Complex128Array( data.x ), data.strideX, new Complex128Array( data.y ), data.strideY, new Complex128Array( data.A ), value ); + }; + } +}); + +tape( 'the function performs hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (row-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (column-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (row-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ru; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs hermitian rank 2 operation `A = α*x*y**H + conjg( α )*y*x**H + A` (column-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cu; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.order, data.uplo, 0, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.order, data.uplo, 0, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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; + var y; + + data = rl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.order, data.uplo, data.N, new Complex128( 0.0, 0.0 ), x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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; + var y; + + data = cl; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + + expected = new Complex128Array( data.A ); + + out = zher2( data.order, data.uplo, data.N, new Complex128( 0.0, 0.0 ), x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying strides (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxpyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying strides (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxpyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxnyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( 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 alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxnyp; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxpyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxpyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative strides for `x` and `y (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxnyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying negative strides for `x` and `y (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxnyn; + + a = new Complex128Array( data.A ); + x = new Complex128Array( data.x ); + y = new Complex128Array( data.y ); + alpha = new Complex128( data.alpha[ 0 ], data.alpha[ 1 ] ); + + expected = new Complex128Array( data.A_out ); + + out = zher2( data.order, data.uplo, data.N, alpha, x, data.strideX, y, data.strideY, a, data.LDA ); + t.strictEqual( isSameComplex128Array( out, a ), true, 'returns expected value' ); + t.deepEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +});