diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/README.md b/lib/node_modules/@stdlib/blas/base/chpmv/README.md new file mode 100644 index 000000000000..01c622e2d2f7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/README.md @@ -0,0 +1,294 @@ + + +# chpmv + +> Performs the matrix-vector operation `y = α*A*x + β*y` for complex-valued data. + +
+ +## Usage + +```javascript +var chpmv = require( '@stdlib/blas/base/chpmv' ); +``` + +#### chpmv( order, uplo, N, α, AP, x, sx, β, y, sy ) + +Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); // eslint-disable-line max-params, max-len +var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 ); +// y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.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 number of elements along each dimension of `A`. +- **α**: complex scalar constant. +- **AP**: Complex input matrix in packed form stored in linear memory as a [`Complex64Array`][@stdlib/array/complex64]. +- **x**: complex input vector [`Complex64Array`][@stdlib/array/complex64]. +- **sx**: stride length for `x`. +- **β**: complex scalar constant. +- **y**: output [`Complex64Array`][@stdlib/array/complex64]. +- **sy**: stride length for `y`. + +The stride parameters determine how elements are accessed. For example, to iterate over every other element in `x` and `y`, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); // eslint-disable-line max-params, max-len +var x = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0 ] ); // eslint-disable-line max-params, max-len +var y = new Complex64Array( [ 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] ); // eslint-disable-line max-params, max-len +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +chpmv( 'row-major', 'lower', 3, alpha, AP, x, 3, beta, y, 2 ); +// y => [ -10.0, 14.0, 0.0, 0.0, -11.0, 25.0, 0.0, 0.0, 14.0, 31.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +// Initial arrays... +var x0 = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +var y0 = new Complex64Array( [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); // eslint-disable-line max-params, max-len +var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); // eslint-disable-line max-params, max-len +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +// Create offset views... +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element +var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element + +chpmv( 'row-major', 'lower', 3, alpha, AP, x1, 1, beta, y1, 1 ); +// y1 => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +``` + + + +#### chpmv.ndarray( order, uplo, N, α, A, sap, oap, x, sx, ox, β, y, sy, oy ) + +Performs the matrix-vector operation `y = α*A*x + β*y` using alternative indexing semantics, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); // eslint-disable-line max-params, max-len +var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); +// y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +``` + +The function has the following additional parameters: + +- **sap**: stride of `AP`.. +- **oap**: starting index for `AP`. +- **ox**: starting index for `x`. +- **oy**: starting index for `y`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); // eslint-disable-line max-params, max-len +var x = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +var y = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] ); // eslint-disable-line max-params, max-len + +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 1, beta, y, -2, 4 ); +// y => [ 14.0, 31.0, 0.0, 0.0, -11.0, 25.0, 0.0, 0.0, -10.0, 14.0 ] +``` + +
+ + + +
+ +## Notes + +- `chpmv()` corresponds to the [BLAS][blas] level 2 function [`chpmv`][chpmv]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var logEach = require( '@stdlib/console/log-each' ); +var chpmv = require( '@stdlib/blas/base/chpmv' ); + +function rand() { + return new Complex64( discreteUniform( 0, 255 ), discreteUniform( -128, 127 ) ); // eslint-disable-line max-params, max-len +} + +var N = 5; + +var AP = filledarrayBy( N * ( N + 1 ) / 2, 'complex64', rand ); +var x = filledarrayBy( N, 'complex64', rand ); +var y = filledarrayBy( N, 'complex64', rand ); + +var alpha = new Complex64( 0.5, 0.5 ); +var beta = new Complex64( 0.5, -0.5 ); + +chpmv( 'row-major', 'lower', N, alpha, AP, x, 1, beta, y, 1 ); + +// Print the results: +logEach( '(%s)', x ); + +chpmv.ndarray( 'row-major', 'lower', N, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); + +// Print the results: +logEach( '(%s)', x ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.js new file mode 100644 index 000000000000..d1e434965a85 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.js @@ -0,0 +1,124 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var chpmv = require( './../lib/chpmv.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var APbuf; + var beta; + var xbuf; + var ybuf; + var AP; + var x; + var y; + + xbuf = uniform( N*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + ybuf = uniform( N*2, -100.0, 100.0, options ); + y = new Complex64Array( ybuf.buffer ); + APbuf = uniform( (N*(N+1)/2)*2, -100.0, 100.0, options ); + AP = new Complex64Array( APbuf.buffer ); + + alpha = new Complex64( 0.5, 0.5 ); + beta = new Complex64( 0.5, -0.5 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + var z; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = chpmv( 'row-major', 'lower', N, alpha, AP, x, 1, beta, y, 1 ); + if ( isnanf( z[ i% ( z.length ) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( z[ i % ( z.length ) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var len; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s:size=%d', pkg, ( len * ( len + 1 ) / 2 ) ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..f59240289de9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/benchmark/benchmark.ndarray.js @@ -0,0 +1,124 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var chpmv = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var APbuf; + var beta; + var xbuf; + var ybuf; + var AP; + var x; + var y; + + xbuf = uniform( N*2, -100.0, 100.0, options ); + x = new Complex64Array( xbuf.buffer ); + ybuf = uniform( N*2, -100.0, 100.0, options ); + y = new Complex64Array( ybuf.buffer ); + APbuf = uniform( (N*(N+1)/2)*2, -100.0, 100.0, options ); + AP = new Complex64Array( APbuf.buffer ); + + alpha = new Complex64( 0.5, 0.5 ); + beta = new Complex64( 0.5, -0.5 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + var z; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = chpmv( 'row-major', 'lower', N, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); + if ( isnanf( z[ i % ( z.length ) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( z[ i % ( z.length ) ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var len; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:size=%d', pkg, ( len * ( len + 1 ) / 2 ) ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/chpmv/docs/repl.txt new file mode 100644 index 000000000000..2f14136778ef --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/docs/repl.txt @@ -0,0 +1,172 @@ + +{{alias}}( order, uplo, N, α, AP, x, sx, β, y, sy ) + Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` + are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is + an `N` by `N` Hermitian matrix supplied in packed form. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is equal to 0, the function returns `y` unchanged. + + If `α` equals `0 + 0i` and `β` equals `1 + 0i`, the function returns `y` + 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`. + + α: Complex64 + Complex scalar constant. + + AP: Complex64Array + Complex input matrix in packed form. + + x: Complex64Array + First complex input vector. + + sx: integer + Index increment for `x`. + + β: Complex64 + Complex scalar constant. + + y: Complex64Array + Second complex input vector. + + sy: integer + Index increment for `y`. + + Returns + ------- + y: Complex64Array + Second complex input vector. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex64}}([1.0,1.0,2.0,2.0,3.0,3.0]); + > var y = new {{alias:@stdlib/array/complex64}}([3.0,3.0,2.0,2.0,1.0,1.0]); + > var buf = [1.0,0.0,2.0,-2.0,4.0,0.0,3.0,-3.0,5.0,-5.0,6.0,0.0]; + > var AP = new {{alias:@stdlib/array/complex64}}(buf); + > var alpha = new {{alias:@stdlib/complex/float32/ctor}}(0.5,0.5); + > var beta = new {{alias:@stdlib/complex/float32/ctor}}(0.5,-0.5); + > var ord = 'row-major'; + > var uplo = 'lower'; + > {{alias}}( ord, uplo, 3, alpha, AP, x, 1, beta, y, 1 ) + [-10.0,14.0,-11.0,25.0,14.0,31.0] + + // Advanced indexing: + > x = new {{alias:@stdlib/array/complex64}}([3.0,3.0,2.0,2.0,1.0,1.0]); + > y = new {{alias:@stdlib/array/complex64}}([1.0,1.0,2.0,2.0,3.0,3.0]); + > buf = [1.0,0.0,2.0,-2.0,4.0,0.0,3.0,-3.0,5.0,-5.0,6.0,0.0]; + > AP = new {{alias:@stdlib/array/complex64}}(buf); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}(0.5,0.5); + > beta = new {{alias:@stdlib/complex/float32/ctor}}(0.5,-0.5); + > ord = 'row-major'; + > uplo = 'lower'; + > {{alias}}( ord, uplo, 3, alpha, AP, x, -1, beta, y, -1 ) + [14.0,31.0,-11.0,25.0,-10.0,14.0] + + // Using typed array views: + > var x0buf = [0.0,0.0,3.0,3.0,2.0,2.0,1.0,1.0]; + > var x0 = new {{alias:@stdlib/array/complex64}}( x0buf ); + > var y0buf = [0.0,0.0,1.0,1.0,2.0,2.0,3.0,3.0]; + > var y0 = new {{alias:@stdlib/array/complex64}}( y0buf ); + > var x0bytes = x0.BYTES_PER_ELEMENT*1; + > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0bytes ); + > var y0bytes = y0.BYTES_PER_ELEMENT*1; + > var y1 = new {{alias:@stdlib/array/complex64}}( y0.buffer, y0bytes ); + > buf = [1.0,0.0,2.0,-2.0,4.0,0.0,3.0,-3.0,5.0,-5.0,6.0,0.0]; + > AP = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}(0.5,0.5); + > beta = new {{alias:@stdlib/complex/float32/ctor}}(0.5,-0.5); + > ord = 'row-major'; + > uplo = 'lower'; + > {{alias}}( ord, uplo, 3, alpha, AP, x1, -1, beta, y1, -1 ) + [14.0,31.0,-11.0,25.0,-10.0,14.0] + + +{{alias}}.ndarray( order, uplo, N, α, AP, sap, oap, x, sx, ox, β, y, sy, oy ) + Performs the matrix-vector operation `y = α*A*x + β*y`, using alternative + indexing semantics and, where `α` and `β` are complex scalars, `x` and `y` + are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix + supplied in packed form. + + While typed array views mandate a view offset based on the underlying buffer + , the offset parameters support indexing semantics based on starting + indices. + + 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 columns in `A`. + + α: Complex64 + Complex scalar constant. + + AP: Complex64Array + Complex input matrix. + + sap: integer + Stride of `AP`. + + oap: integer + Starting index (offset) for `AP`. + + x: Complex64Array + First complex input vector. + + sx: integer + Index increment for `x`. + + ox: integer + Starting index (offset) for `x`. + + β: Complex64 + Complex scalar constant. + + y: Complex64Array + Second complex input vector. + + sy: integer + Index increment for `y`. + + oy: integer + Starting index (offset) for `y`. + + Returns + ------- + y: Complex64Array + Second complex input vector. + + Examples + -------- + > x = new {{alias:@stdlib/array/complex64}}([1.0,1.0,2.0,2.0,3.0,3.0]); + > y = new {{alias:@stdlib/array/complex64}}([3.0,3.0,2.0,2.0,1.0,1.0]); + > buf = [1.0,0.0,2.0,-2.0,4.0,0.0,3.0,-3.0,5.0,-5.0,6.0,0.0]; + > AP = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}(0.5,0.5); + > beta = new {{alias:@stdlib/complex/float32/ctor}}(0.5,-0.5); + > ord = 'row-major'; + > uplo = 'lower'; + > {{alias}}.ndarray(ord,uplo,3,alpha,AP,1,0,x,1,0,beta,y,1,0) + [-10.0,14.0,-11.0,25.0,14.0,31.0] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/index.d.ts new file mode 100644 index 000000000000..cd3aae4cce12 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/index.d.ts @@ -0,0 +1,142 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex64Array } from '@stdlib/types/array'; +import { Layout, MatrixTriangle } from '@stdlib/types/blas'; +import { Complex64 } from '@stdlib/types/complex'; + +/** +* Interface describing `chpmv`. +*/ +interface Routine { + /** + * Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. + * + * @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 - complex scalar constant + * @param AP - complex input matrix in packed form + * @param x - first complex input vector + * @param strideX - `x` stride length + * @param beta - complex scalar constant + * @param y - second complex input vector + * @param strideY - `y` stride length + * @returns `y` + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); + * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + * var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); + * var alpha = new Complex64( 0.5, 0.5 ); + * var beta = new Complex64( 0.5, -0.5 ); + * + * chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 ); + * // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] + */ + ( order: Layout, uplo: MatrixTriangle, N: number, alpha: Complex64, AP: Complex64Array, x: Complex64Array, strideX: number, beta: Complex64, y: Complex64Array, strideY: number ): Complex64Array; + + /** + * Performs the matrix-vector operation `y = α*A*x + β*y`, using alternative indexing semantics. + * + * @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 - complex scalar constant + * @param AP - complex input matrix in packed form + * @param strideAP - `AP` stride length + * @param offsetAP - starting index for `AP` + * @param x - first complex input vector + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param beta - complex scalar constant + * @param y - second complex input vector + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` + * @returns `y` + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); + * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + * var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); + * var alpha = new Complex64( 0.5, 0.5 ); + * var beta = new Complex64( 0.5, -0.5 ); + * + * chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); + * // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] + */ + ndarray( order: Layout, uplo: MatrixTriangle, N: number, alpha: Complex64, AP: Complex64Array, strideAP: number, offsetAP: number, x: Complex64Array, strideX: number, offsetX: number, beta: Complex64, y: Complex64Array, strideY: number, offsetY: number ): Complex64Array; +} + +/** +* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. +* +* @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 - complex scalar constant +* @param AP - complex input matrix in packed form +* @param x - first complex input vector +* @param strideX - `x` stride length +* @param beta - complex scalar constant +* @param y - second complex input vector +* @param strideY - `y` stride length +* @returns `y` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +*/ +declare var chpmv: Routine; + + +// EXPORTS // + +export = chpmv; diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/test.ts new file mode 100644 index 000000000000..0d20b258d3a0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/docs/types/test.ts @@ -0,0 +1,521 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex64Array = require( '@stdlib/array/complex64' ); +import Complex64 = require( '@stdlib/complex/float32/ctor' ); +import chpmv = require( './index' ); + + +// TESTS // + +// The function returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 1.0, 0.0 ); + const beta = new Complex64( 1.0, 0.0 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 10, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( true, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( false, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( null, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( undefined, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( [], 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( {}, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( ( x: number ): number => x, 'lower', 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 10, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', true, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', false, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', null, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', undefined, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', [], 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', {}, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', ( x: number ): number => x, 10, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', '10', alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', true, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', false, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', null, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', undefined, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', [], alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', {}, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', ( x: number ): number => x, alpha, AP, x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a forth argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, '10', AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, true, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, false, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, null, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, undefined, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, [], AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, {}, AP, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, ( x: number ): number => x, AP, x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, 10, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, '10', x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, true, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, false, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, null, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, undefined, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, [ '1' ], x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, {}, x, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, ( x: number ): number => x, x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an sixth argument which is not a Complex64Array... +{ + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, 10, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, '10', 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, true, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, false, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, null, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, undefined, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, [ '1' ], 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, {}, 1, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, ( x: number ): number => x, 1, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, x, '10', beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, true, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, false, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, null, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, undefined, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, [], beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, {}, beta, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, ( x: number ): number => x, beta, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, '10', y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, 1.0, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, true, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, false, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, null, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, undefined, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, [], y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, {}, y, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an ninth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, 10, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, '10', 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, true, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, false, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, null, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, undefined, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, [], 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, {}, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, '10' ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, true ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, false ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, null ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, undefined ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, [] ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, {} ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv(); // $ExpectError + chpmv( 'row-major' ); // $ExpectError + chpmv( 'row-major', 'lower' ); // $ExpectError + chpmv( 'row-major', 'lower', 10 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1 ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y ); // $ExpectError + chpmv( 'row-major', 'lower', 10, alpha, AP, x, 1, beta, y, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns aP Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 10, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( true, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( false, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( null, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( undefined, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( [ '1' ], 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( {}, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( ( x: number ): number => x, 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', '10', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', true, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', false, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', null, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', undefined, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', [], 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', {}, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', ( x: number ): number => x, 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', '10', alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', true, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', false, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', null, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', undefined, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', [], alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', {}, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', ( x: number ): number => x, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a forth argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, 10, AP, 0, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, '10', AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, true, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, false, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, null, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, undefined, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, [], AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, {}, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, ( x: number ): number => x, AP, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, '10', 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, true, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, false, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, null, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, undefined, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, [], 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, {}, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, ( x: number ): number => x, 10, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, '10', 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, true, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, false, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, null, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, undefined, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, [], 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, {}, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, ( x: number ): number => x, 0, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, '10', x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, true, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, false, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, null, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, undefined, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, [], x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, {}, x, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, ( x: number ): number => x, x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a Complex64Array... +{ + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, 10, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, '10', 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, true, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, false, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, null, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, undefined, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, [], 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, {}, 1, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, ( x: number ): number => x, 1, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, '10', 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, true, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, false, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, null, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, undefined, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, [], 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, {}, 0, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, ( x: number ): number => x, 0, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, '10', beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, true, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, false, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, null, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, undefined, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, [], beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, {}, beta, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, ( x: number ): number => x, beta, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eleventh argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, '10', y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, 10, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, true, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, false, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, null, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, undefined, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, [], y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, {}, y, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, 10, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, '10', 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, true, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, false, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, null, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, undefined, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, [], 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, {}, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, '10', 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, true, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, false, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, null, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, undefined, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, [], 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, {}, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, '10' ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, true ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, false ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, null ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, undefined ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, [] ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, {} ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const AP = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + const beta = new Complex64( 0.5, -0.5 ); + + chpmv.ndarray(); // $ExpectError + chpmv.ndarray( 'row-major', 'lower' ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1 ); // $ExpectError + chpmv.ndarray( 'row-major', 'lower', 10, alpha, AP, 10, 0, x, 1, 0, beta, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/examples/index.js b/lib/node_modules/@stdlib/blas/base/chpmv/examples/index.js new file mode 100644 index 000000000000..cc13f5321614 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/examples/index.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var chpmv = require( './../lib' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var N = 3; + +var x = filledarrayBy( N, 'complex64', rand ); +console.log( x.get( 0 ).toString() ); + +var y = filledarrayBy( N, 'complex64', rand ); +console.log( y.get( 0 ).toString() ); + +var AP = filledarrayBy( ( N * ( N + 1 ) / 2 ), 'complex64', rand ); +console.log( AP.get( 0 ).toString() ); + +var alpha = new Complex64( 2.0, 3.0 ); +console.log( alpha.toString() ); + +var beta = new Complex64( 3.0, -2.0 ); +console.log( beta.toString() ); + +chpmv( 'row-major', 'lower', N, alpha, AP, x, 1, beta, y, 1 ); + +// Print the results: +logEach( '(%s)', y ); + +chpmv.ndarray( 'row-major', 'lower', N, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); + +// Print the results: +logEach( '(%s)', y ); diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/lib/base.js b/lib/node_modules/@stdlib/blas/base/chpmv/lib/base.js new file mode 100644 index 000000000000..dbfda8389d8d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/lib/base.js @@ -0,0 +1,220 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var cfill = require( '@stdlib/blas/ext/base/cfill' ).ndarray; +var cscal = require( '@stdlib/blas/base/cscal' ).ndarray; +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var muladd = require( '@stdlib/complex/float32/base/mul-add' ).assign; + + +// MAIN // + +/** +* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. +* +* @private +* @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 {Complex64} alpha - complex scalar constant +* @param {Complex64Array} AP - complex input matrix in packed form +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @param {Complex64Array} x - first complex input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64} beta - complex scalar constant +* @param {Complex64Array} y - second complex input vector +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {Complex64Array} `y` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +*/ +function chpmv( order, uplo, N, alpha, AP, strideAP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ) { // eslint-disable-line max-params, max-len + var realpha; + var imalpha; + var rebeta; + var imbeta; + var retmp1; + var imtmp1; + var retmp2; + var imtmp2; + var viewAP; + var viewX; + var viewY; + var cimap; + var isrm; + var sign; + var reap; + var imap; + var iap; + var sap; + var rex; + var imx; + var ix; + var jx; + var kx; + var iy; + var jy; + var ky; + var sx; + var sy; + var kk; + var k; + var j; + + // Layout + isrm = isRowMajor( order ); + + // Decompose scalars + rebeta = realf( beta ); + imbeta = imagf( beta ); + realpha = realf( alpha ); + imalpha = imagf( alpha ); + + // y = beta*y + if ( rebeta === 0.0 && imbeta === 0.0 ) { + cfill( N, 0.0, y, strideY, offsetY ); + } else if ( rebeta !== 1.0 || imbeta !== 0.0 ) { + cscal( N, beta, y, strideY, offsetY ); + } + + // If alpha is zero, early return y + if ( realpha === 0.0 && imalpha === 0.0 ) { + return y; + } + + // Reinterpret arrays to raw numeric views + viewAP = reinterpret( AP, 0 ); + viewX = reinterpret( x, 0 ); + viewY = reinterpret( y, 0 ); + + // Adjust sign to account for layout-dependent conjugation + if ( isrm ) { + sign = -1; + } else { + sign = 1; + } + + // Vector indexing base + kk = offsetAP * 2; + kx = offsetX * 2; + ky = offsetY * 2; + + // Vector strides + sx = strideX * 2; + sy = strideY * 2; + sap = strideAP * 2; + + jx = kx; + jy = ky; + + if ( ( isrm && uplo === 'upper' ) || ( !isrm && uplo === 'lower' ) ) { + for ( j = 0; j < N; j++ ) { + rex = viewX[ jx ]; + imx = viewX[ jx + 1 ]; + retmp1 = f32( ( realpha * rex ) - ( imalpha * imx ) ); + imtmp1 = f32( ( realpha * imx ) + ( imalpha * rex ) ); + retmp2 = 0.0; + imtmp2 = 0.0; + reap = viewAP[ kk ]; + viewY[ jy ] += f32( retmp1 * reap ); + viewY[ jy + 1 ] += f32( imtmp1 * reap ); + ix = jx + sx; + iy = jy + sy; + iap = kk + sap; + for ( k = j + 1; k < N; k++ ) { + reap = viewAP[ iap ]; + imap = viewAP[ iap + 1 ]; + cimap = sign * imap; + muladd( retmp1, imtmp1, reap, cimap, viewY[ iy ], viewY[ iy + 1 ], viewY, 1, iy ); // eslint-disable-line max-len + rex = viewX[ ix ]; + imx = viewX[ ix + 1 ]; + retmp2 += f32( ( reap * rex ) + ( cimap * imx ) ); + imtmp2 += f32( ( reap * imx ) - ( cimap * rex ) ); + ix += sx; + iy += sy; + iap += sap; + } + muladd( realpha, imalpha, retmp2, imtmp2, viewY[ jy ], viewY[ jy + 1 ], viewY, 1, jy ); // eslint-disable-line max-len + jx += sx; + jy += sy; + kk += ( N - j ) * sap; + } + return y; + } + + // ( isrm && uplo === 'lower' ) || ( !isrm && uplo === 'upper' ) + for ( j = 0; j < N; j++ ) { + rex = viewX[ jx ]; + imx = viewX[ jx + 1 ]; + retmp1 = f32( ( realpha * rex ) - ( imalpha * imx ) ); + imtmp1 = f32( ( realpha * imx ) + ( imalpha * rex ) ); + retmp2 = 0.0; + imtmp2 = 0.0; + ix = kx; + iy = ky; + iap = kk; + for ( k = 0; k < j; k++ ) { + reap = viewAP[ iap ]; + imap = viewAP[ iap + 1 ]; + cimap = sign * imap; + muladd( retmp1, imtmp1, reap, cimap, viewY[ iy ], viewY[ iy + 1 ], viewY, 1, iy ); // eslint-disable-line max-len + rex = viewX[ ix ]; + imx = viewX[ ix + 1 ]; + retmp2 += f32( ( reap * rex ) + ( cimap * imx ) ); + imtmp2 += f32( ( reap * imx ) - ( cimap * rex ) ); + ix += sx; + iy += sy; + iap += sap; + } + reap = viewAP[ iap ]; + viewY[ jy ] += f32( retmp1 * reap ); + viewY[ jy + 1 ] += f32( imtmp1 * reap ); + muladd( realpha, imalpha, retmp2, imtmp2, viewY[ jy ], viewY[ jy + 1 ], viewY, 1, jy ); // eslint-disable-line max-len + jx += sx; + jy += sy; + kk += ( j + 1 ) * sap; + } + return y; +} + + +// EXPORTS // + +module.exports = chpmv; diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/lib/chpmv.js b/lib/node_modules/@stdlib/blas/base/chpmv/lib/chpmv.js new file mode 100644 index 000000000000..c5830a33e03f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/lib/chpmv.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. +* +* @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 {Complex64} alpha - complex scalar constant +* @param {Complex64Array} AP - complex input matrix in packed form +* @param {Complex64Array} x - first complex input vector +* @param {integer} strideX - `x` stride length +* @param {Complex64} beta - complex scalar constant +* @param {Complex64Array} y - second complex input vector +* @param {integer} strideY - `y` stride length +* @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} seventh argument must be non-zero +* @throws {RangeError} tenth argument must be non-zero +* @returns {Complex64Array} `y` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +*/ +function chpmv( order, uplo, N, alpha, AP, x, strideX, beta, y, strideY ) { + var realpha; + var imalpha; + var rebeta; + var imbeta; + 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. Seventh argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Tenth argument must be non-zero. Value: `%d`.', strideY ) ); + } + rebeta = realf( beta ); + imbeta = imagf( beta ); + realpha = realf( alpha ); + imalpha = imagf( alpha ); + + // Check if we can early return... + if ( N === 0 || ( realpha === 0.0 && imalpha === 0.0 && rebeta === 1.0 && imbeta === 0.0 ) ) { // eslint-disable-line max-len + return y; + } + ox = stride2offset( N, strideX ); + oy = stride2offset( N, strideY ); + return base( order, uplo, N, alpha, AP, 1, 0, x, strideX, ox, beta, y, strideY, oy ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = chpmv; diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/lib/index.js b/lib/node_modules/@stdlib/blas/base/chpmv/lib/index.js new file mode 100644 index 000000000000..075acfea44af --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/lib/index.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 2 routine to performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. +* +* @module @stdlib/blas/base/chpmv +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var chpmv = require( '@stdlib/blas/base/chpmv' ); +* +* var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var chpmv = require( '@stdlib/blas/base/chpmv' ); +* +* var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.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 chpmv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); + +if ( isError( tmp ) ) { + chpmv = main; +} else { + chpmv = tmp; +} + + +// EXPORTS // + +module.exports = chpmv; + +// exports: { "ndarray": "chpmv.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/lib/main.js b/lib/node_modules/@stdlib/blas/base/chpmv/lib/main.js new file mode 100644 index 000000000000..df7fdcef5cd4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var chpmv = require( './chpmv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( chpmv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = chpmv; diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/chpmv/lib/ndarray.js new file mode 100644 index 000000000000..ef8183d95087 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/lib/ndarray.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var format = require( '@stdlib/string/format' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form. +* +* @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 {Complex64} alpha - complex scalar constant +* @param {Complex64Array} AP - complex input matrix in packed form +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @param {Complex64Array} x - first complex input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64} beta - complex scalar constant +* @param {Complex64Array} y - second complex input vector +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @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} fifth argument must be non-zero +* @throws {RangeError} sixth argument must be non-zero +* @throws {RangeError} ninth argument must be non-zero +* @throws {RangeError} thirteenth argument must be non-zero +* @returns {Complex64Array} `y` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +* var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); +* var alpha = new Complex64( 0.5, 0.5 ); +* var beta = new Complex64( 0.5, -0.5 ); +* +* chpmv( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 ); +* // y => [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +*/ +function chpmv( order, uplo, N, alpha, AP, strideAP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ) { // eslint-disable-line max-params, max-len + var realpha; + var imalpha; + var rebeta; + var imbeta; + + 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 ( strideAP === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideAP ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Thirteenth argument must be non-zero. Value: `%d`.', strideY ) ); + } + rebeta = realf( beta ); + imbeta = imagf( beta ); + realpha = realf( alpha ); + imalpha = imagf( alpha ); + + // Check if we can early return... + if ( N === 0 || ( realpha === 0.0 && imalpha === 0.0 && rebeta === 1.0 && imbeta === 0.0 ) ) { // eslint-disable-line max-len + return y; + } + return base( order, uplo, N, alpha, AP, strideAP, offsetAP, x, strideX, offsetX, beta, y, strideY, offsetY ); +} + + +// EXPORTS // + +module.exports = chpmv; diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/package.json b/lib/node_modules/@stdlib/blas/base/chpmv/package.json new file mode 100644 index 000000000000..12565866ef3d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/blas/base/chpmv", + "version": "0.0.0", + "description": "Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are `N` element complex vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form.", + "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", + "chemv", + "hermitian", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "complex", + "complex64", + "complex64array", + "float", + "float32", + "single", + "float32array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_alpha_zero.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_alpha_zero.json new file mode 100644 index 000000000000..21a87999d879 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_alpha_zero.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.0, 0.0 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 000000000000..c4a425379868 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 6.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": -4, + "offsetAP": 24, + "x": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 2, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "y_out": [ 14.0, 31.0, -11.0, 25.0, -10.0, 14.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_l.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_l.json new file mode 100644 index 000000000000..9ea14f186bbd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_l.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oap.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oap.json new file mode 100644 index 000000000000..4e7fa2068520 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oap.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 4, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_ox.json new file mode 100644 index 000000000000..6a0a69e20604 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_ox.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 5, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oy.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oy.json new file mode 100644 index 000000000000..7c0141c4a3e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_oy.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 2, + "y_out": [ 0.0, 0.0, 0.0, 0.0, -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sap.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sap.json new file mode 100644 index 000000000000..c53404726ec9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sap.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 4, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sapn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sapn.json new file mode 100644 index 000000000000..006a0a5f570f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_sapn.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 6.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": -5, + "offsetAP": 25, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_u.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_u.json new file mode 100644 index 000000000000..eed87b1def69 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_u.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 4.0, 0.0, 3.0, 3.0, 5.0, 5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 2.0, 2.0, 3.0, 3.0 ], + [ 0.0, 0.0, 4.0, 0.0, 5.0, 5.0 ], + [ 0.0, 0.0, 0.0, 0.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_x_zeros.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_x_zeros.json new file mode 100644 index 000000000000..2dfb7cbd80f8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_x_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 3.0, -3.0, 4.0, 0.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyn.json new file mode 100644 index 000000000000..cbf71e88f52d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyn.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 3.0, -3.0, 4.0, 4.0, 5.0, 0.0, 6.0, 6.0, 7.0, -7.0, 8.0, 0.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideY": -1, + "offsetY": 3, + "y_out": [ -16.0, 85.0, 29.0, 75.0, -9.0, 58.0, 15.0, 30.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyp.json new file mode 100644 index 000000000000..f308b8b9f4eb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xnyp.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 3.0, -3.0, 4.0, 4.0, 5.0, 0.0, 6.0, 6.0, 7.0, -7.0, 8.0, 0.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "beta": [ 0.5, -0.5 ], + "y": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 15.0, 30.0, -9.0, 58.0, 29.0, 75.0, -16.0, 85.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyn.json new file mode 100644 index 000000000000..f51c5e36133a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyn.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 3.0, -3.0, 4.0, 4.0, 5.0, 0.0, 6.0, 6.0, 7.0, -7.0, 8.0, 0.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideY": -1, + "offsetY": 3, + "y_out": [ -16.0, 85.0, 29.0, 75.0, -9.0, 58.0, 15.0, 30.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyp.json new file mode 100644 index 000000000000..ad9dcee4240f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/column_major_xpyp.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 3.0, -3.0, 4.0, 4.0, 5.0, 0.0, 6.0, 6.0, 7.0, -7.0, 8.0, 0.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 15.0, 30.0, -9.0, 58.0, 29.0, 75.0, -16.0, 85.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_alpha_zero.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_alpha_zero.json new file mode 100644 index 000000000000..359ea4fef9df --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_alpha_zero.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.0, 0.0 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 000000000000..40711866b825 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 6.0, 0.0, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": -2, + "offsetAP": 13, + "x": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 2, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "y_out": [ 14.0, 31.0, -11.0, 25.0, -10.0, 14.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_l.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_l.json new file mode 100644 index 000000000000..1e9f38978bd8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_l.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oap.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oap.json new file mode 100644 index 000000000000..25c1b894af55 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oap.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 3, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_ox.json new file mode 100644 index 000000000000..2bd4d6559ebe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_ox.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 2, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oy.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oy.json new file mode 100644 index 000000000000..9054243f62eb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_oy.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 1, + "y_out": [ 0.0, 0.0, -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sap.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sap.json new file mode 100644 index 000000000000..00801a978ea7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sap.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 999.9, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 5, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sapn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sapn.json new file mode 100644 index 000000000000..6848db13ec0b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_sapn.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 6.0, 0.0, 999.9, 999.9, 999.9, 999.9, 5.0, -5.0, 999.9, 999.9, 999.9, 999.9, 3.0, -3.0, 999.9, 999.9, 999.9, 999.9, 4.0, 0.0, 999.9, 999.9, 999.9, 999.9, 2.0, -2.0, 999.9, 999.9, 999.9, 999.9, 1.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": -3, + "offsetAP": 15, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_u.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_u.json new file mode 100644 index 000000000000..1c18a50efb92 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_u.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "upper", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 3.0, 3.0, 4.0, 0.0, 5.0, 5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 2.0, 2.0, 3.0, 3.0 ], + [ 0.0, 0.0, 4.0, 0.0, 5.0, 5.0 ], + [ 0.0, 0.0, 0.0, 0.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_x_zeros.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_x_zeros.json new file mode 100644 index 000000000000..b9d229efe72f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_x_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 3, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, -2.0, 4.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 3.0, 0.0, 2.0, 0.0, 1.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyn.json new file mode 100644 index 000000000000..f0437692ad83 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyn.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 5.0, 0.0, 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideY": -1, + "offsetY": 3, + "y_out": [ -16.0, 85.0, 29.0, 75.0, -9.0, 58.0, 15.0, 30.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyp.json new file mode 100644 index 000000000000..e53de889a742 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xnyp.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 5.0, 0.0, 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "beta": [ 0.5, -0.5 ], + "y": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 15.0, 30.0, -9.0, 58.0, 29.0, 75.0, -16.0, 85.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyn.json new file mode 100644 index 000000000000..0d4fa46cc303 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyn.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 5.0, 0.0, 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideY": -1, + "offsetY": 3, + "y_out": [ -16.0, 85.0, 29.0, 75.0, -9.0, 58.0, 15.0, 30.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyp.json new file mode 100644 index 000000000000..84c7da2de9e9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/fixtures/row_major_xpyp.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "uplo": "lower", + "N": 4, + "alpha": [ 0.5, 0.5 ], + "AP": [ 1.0, 0.0, 2.0, 2.0, 5.0, 0.0, 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ], + "A_mat": [ + [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 2.0, 2.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + [ 3.0, -3.0, 6.0, 6.0, 8.0, 0.0, 0.0, 0.0 ], + [ 4.0, 4.0, 7.0, -7.0, 9.0, 9.0, 10.0, 0.0 ] + ], + "strideAP": 1, + "offsetAP": 0, + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "beta": [ 0.5, -0.5 ], + "y": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "y_out": [ 15.0, 30.0, -9.0, 58.0, 29.0, 75.0, -16.0, 85.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/test.chpmv.js b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.chpmv.js new file mode 100644 index 000000000000..42d3a1736f66 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.chpmv.js @@ -0,0 +1,910 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var chpmv = require( './../lib/chpmv.js' ); + + +// FIXTURES // + +var cu = require( './fixtures/column_major_u.json' ); +var cl = require( './fixtures/column_major_l.json' ); +var cx = require( './fixtures/column_major_x_zeros.json' ); +var ca = require( './fixtures/column_major_alpha_zero.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); +var cxpyn = require( './fixtures/column_major_xpyn.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyp = require( './fixtures/column_major_xpyp.json' ); +var ru = require( './fixtures/row_major_u.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rx = require( './fixtures/row_major_x_zeros.json' ); +var ra = require( './fixtures/row_major_alpha_zero.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof chpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( chpmv.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 alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( value, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, value, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, value, alpha, ap, x, data.strideX, beta, y, data.strideY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventh argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, data.N, alpha, ap, x, value, beta, y, data.strideY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, value ); + }; + } +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (row-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (column-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (row-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ru; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (column-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cu; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input vector (row-major)', function test( t ) { + var alpha; + var beta; + var data; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input vector (column-major)', function test( t ) { + var alpha; + var beta; + var data; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, 0, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, 0, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `1`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `1`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is `1`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is `1`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function scales the second input vector by `β` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ra; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function scales the second input vector by `β` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ca; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` and `y` strides (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rxpyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` and `y` strides (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cxpyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rxnyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cxnyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( 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 beta; + var out; + var ap; + var x; + var y; + + data = rxpyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( 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 beta; + var out; + var ap; + var x; + var y; + + data = cxpyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( 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 beta; + var out; + var ap; + var x; + var y; + + data = rxnyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( 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 beta; + var out; + var ap; + var x; + var y; + + data = cxnyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, x, data.strideX, beta, y, data.strideY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/test.js b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.js new file mode 100644 index 000000000000..da22743c6c6e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var isBrowser = require( '@stdlib/assert/is-browser' ); +var chpmv = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': isBrowser +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof chpmv, '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 chpmv.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 chpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( chpmv, 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 chpmv; + var main; + + main = require( './../lib/chpmv.js' ); + + chpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( chpmv, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/chpmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.ndarray.js new file mode 100644 index 000000000000..5dc265b65533 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/chpmv/test/test.ndarray.js @@ -0,0 +1,1293 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var chpmv = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var cu = require( './fixtures/column_major_u.json' ); +var cl = require( './fixtures/column_major_l.json' ); +var cx = require( './fixtures/column_major_x_zeros.json' ); +var ca = require( './fixtures/column_major_alpha_zero.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var coy = require( './fixtures/column_major_oy.json' ); +var coap = require( './fixtures/column_major_oap.json' ); +var csap = require( './fixtures/column_major_sap.json' ); +var csapn = require( './fixtures/column_major_sapn.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); +var cxpyn = require( './fixtures/column_major_xpyn.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyp = require( './fixtures/column_major_xpyp.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); +var ru = require( './fixtures/row_major_u.json' ); +var rx = require( './fixtures/row_major_x_zeros.json' ); +var ra = require( './fixtures/row_major_alpha_zero.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var roy = require( './fixtures/row_major_oy.json' ); +var roap = require( './fixtures/row_major_oap.json' ); +var rl = require( './fixtures/row_major_l.json' ); +var rsap = require( './fixtures/row_major_sap.json' ); +var rsapn = require( './fixtures/row_major_sapn.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof chpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', function test( t ) { + t.strictEqual( chpmv.length, 14, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( value, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, value, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, value, alpha, ap, data.strideAP, data.OffsetA, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, data.N, alpha, ap, value, data.OffsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, value, data.offsetX, beta, y, data.strideY, data.offsetY ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid thirteenth argument', function test( t ) { + var values; + var alpha; + var data; + var beta; + var ap; + var i; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + 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() { + chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, value, data.offsetY ); + }; + } +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (row-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (column-major, lower)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (row-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ru; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function performs the matrix-vector operation `y = α*A*x + β*y` (column-major, upper)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cu; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input vector (row-major)', function test( t ) { + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function returns a reference to the second input vector (column-major)', function test( t ) { + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, 0, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is `0`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, 0, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `1`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `1`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cl; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is `1`, the function returns the second input vector unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is `1`, the function returns the second input vector unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( 1.0, 0.0 ); + + expected = new Complex64Array( data.y ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function scales the second input vector by `β` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ra; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0`, the function scales the second input vector by `β` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ca; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros and `β` is not `1`, the function scales the second input vector by `β` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cx; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (row-major', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rox; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (column-major', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cox; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a `y` offset (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = roy; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a `y` offset (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = coy; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = roap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = coap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rsap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = csap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rsapn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = csapn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` and `y` strides (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rxpyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying `x` and `y` strides (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cxpyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rxnyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cxnyp; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rxpyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `y` stride (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = cxpyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + 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 beta; + var out; + var ap; + var x; + var y; + + data = rxnyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + 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 beta; + var out; + var ap; + var x; + var y; + + data = cxnyn; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = rcap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var beta; + var out; + var ap; + var x; + var y; + + data = ccap; + + ap = new Complex64Array( data.AP ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + beta = new Complex64( data.beta[0], data.beta[1] ); + + expected = new Complex64Array( data.y_out ); + + out = chpmv( data.order, data.uplo, data.N, alpha, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX, beta, y, data.strideY, data.offsetY ); + t.strictEqual( isSameComplex64Array( out, y ), true, 'returns expected values' ); + t.deepEqual( isSameComplex64Array( out, expected ), true, 'returns expected values' ); + + t.end(); +});