diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.js new file mode 100644 index 000000000000..23710680fad4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.js @@ -0,0 +1,121 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zgemv = require( './../lib/zgemv.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var beta; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + xbuf = uniform( N*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + ybuf = uniform( N*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + Abuf = uniform( (N*N)*2, -100.0, 100.0, options ); + A = new Complex128Array( Abuf.buffer ); + + alpha = new Complex128( 1.0, 0.0 ); + beta = new Complex128( 1.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zgemv( 'row-major', 'no-transpose', N, N, alpha, A, N, x, 1, beta, y, 1 ); + if ( isnan( ybuf[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':size='+N, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..ae0725b7fffb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/benchmark/benchmark.ndarray.js @@ -0,0 +1,121 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var pkg = require( './../package.json' ).name; +var zgemv = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var beta; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + xbuf = uniform( N*2, -100.0, 100.0, options ); + x = new Complex128Array( xbuf.buffer ); + ybuf = uniform( N*2, -100.0, 100.0, options ); + y = new Complex128Array( ybuf.buffer ); + Abuf = uniform( (N*N)*2, -100.0, 100.0, options ); + A = new Complex128Array( Abuf.buffer ); + + alpha = new Complex128( 1.0, 0.0 ); + beta = new Complex128( 0.0, 0.0 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zgemv( 'row-major', 'no-transpose', N, N, alpha, A, N, 1, 0, x, 1, 0, beta, y, 1, 0 ); + if ( isnan( ybuf[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%N ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':ndarray:size='+N, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zgemv/docs/repl.txt new file mode 100644 index 000000000000..09f4c6d9d32c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/docs/repl.txt @@ -0,0 +1,173 @@ + +{{alias}}( ord, trans, M, N, α, A, LDA, x, sx, β, y, sy ) + Performs one of the matrix-vector operations `y = α*A*x + β*y`, or + `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, + `X` and `Y` are vectors and `A` is an `M` by `N` matrix. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `M` or `N` is equal to `0`, the function returns `y` unchanged. + + If `α` equals `0` and `β` equals `1`, the function returns `y` unchanged. + + Parameters + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. + + trans: string + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + α: number + Scalar constant. + + A: Complex128Array + Input matrix. + + lda: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + x: Complex128Array + First input vector. + + sx: integer + Stride length for `x`. + + β: number + Scalar constant. + + y: Complex128Array + Second input vector. + + sy: integer + Stride length for `y`. + + Returns + ------- + y: Complex128Array + Second input vector. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > ord = 'row-major'; + > trans = 'no-transpose'; + > {{alias}}( ord, trans, 2, 2, alpha, A, 2, beta, x, 1, y, 1 ) + [ -3.0, 17.0, -7.0, 37.0 ] + + // Advanced indexing: + > var x = new {{alias:@stdlib/array/complex128}}( [ 3.0, 4.0, 1.0, 2.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > ord = 'row-major'; + > trans = 'no-transpose'; + > {{alias}}( ord, trans, 2, 2, alpha, A, 2, beta, x, -1, y, -1 ) + [ -7.0, 37.0, -3.0, 17.0 ] + + // Using typed array views: + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 ] ); + > var y0 = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > ord = 'row-major'; + > trans = 'no-transpose'; + > {{alias}}( ord, trans, 2, 2, alpha, A, 2, beta, x, -1, y, -1 ) + [ 0.0, 0.0, -7.0, 37.0, -3.0, 17.0 ] + + +{{alias}}.ndarray( ord, trans, M, N, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy ) + Performs one of the matrix-vector operations `y = α*A*x + β*y`, or + `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, using alternative semantics + indexing and where `α` and `β` are scalars, `X` and `Y` are vectors and `A` + is an `M` by `N` matrix. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameter supports indexing semantics based on a starting + index. + + Parameters + ---------- + trans: string + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + α: number + Scalar constant. + + A: Complex128Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + x: Complex128Array + First input vector. + + sx: integer + Stride length for `x`. + + ox: integer + Starting index for `x`. + + β: number + Scalar constant. + + y: Complex128Array + Second input vector. + + sy: integer + Stride length for `y`. + + oy: integer + Starting index for `y`. + + Returns + ------- + y: Complex128Array + Second input vector. + + Examples + -------- + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] ); + > var A = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 0.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 0.0, 0.0 ); + > ord = 'row-major'; + > trans = 'no-transpose'; + > {{alias}}.ndarray( trans, 2, 2, alpha, A, 2, 1, 0, beta, x, 1, 0, y, 1, 0 ) + [ -3.0, 17.0, -7.0, 37.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/index.d.ts new file mode 100644 index 000000000000..7a4e1427724d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/index.d.ts @@ -0,0 +1,146 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex128Array } from '@stdlib/types/array'; +import { Layout, TransposeOperation } from '@stdlib/types/blas'; + +/** +* Interface describing `zgemv`. +*/ +interface Routine { + /** + * Performs one of the matrix-vector operations `y = α*A*x + β*y`, or `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, `X` and `Y` are vectors and `A` is an `M` by `N` matrix. + * + * @param order - storage layout + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param x - first input vector + * @param strideX - stride length for `x` + * @param beta - scalar constant + * @param y - second input vector + * @param strideY - stride length for `y` + * @returns `y` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + * var A = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + * var alpha = new Complex128( 1.0, 0.0 ); + * var beta = new Complex128( 0.0, 0.0 ); + * + * zgemv( 'row-major', 'no-transpose', 2, 2, alpha, A, 2, x, 1, beta, y, 1 ); + * // A => [ -3.0, 17.0, -7.0, 37.0 ] + */ + ( order: Layout, trans: TransposeOperation, M: number, N: number, alpha: number, A: Complex128Array, LDA: number, x: Complex128Array, strideX: number, beta: number, y: Complex128Array, strideY: number ): Complex128Array; + + /** + * Performs one of the matrix-vector operations `y = α*A*x + β*y`, or `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, using alternative semantics indexing and where `α` and `β` are scalars, `X` and `Y` are vectors and `A` is an `M` by `N` matrix. + * + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param A - input matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index for `A` + * @param x - first input vector + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param beta - scalar constant + * @param y - second input vector + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` + * @returns `y` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + * var A = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); + * var alpha = new Complex128( 1.0, 0.0 ); + * var beta = new Complex128( 0.0, 0.0 ); + * + * zgemv.ndarray( 'row-major', 'no-transpose', 2, 2, alpha, A, 2, 1, 0, x, 1, 0, beta, y, 1, 0 ); + * // A => [ -3.0, 17.0, -7.0, 37.0 ] + */ + ndarray( trans: TransposeOperation, M: number, N: number, alpha: number, A: Complex128Array, strideA1: number, strideA2: number, offsetA: number, x: Complex128Array, strideX: number, offsetX: number, beta: number, y: Complex128Array, strideY: number, offsetY: number ): Complex128Array; +} + +/** +* Performs one of the matrix-vector operations `y = α*A*x + β*y`, or `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, `X` and `Y` are vectors and `A` is an `M` by `N` matrix. +* +* @param order - storage layout +* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param M - number of rows in the matrix `A` +* @param N - number of columns in the matrix `A` +* @param alpha - scalar constant +* @param A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param x - first input vector +* @param strideX - stride length for `x` +* @param beta - scalar constant +* @param y - second input vector +* @param strideY - stride length for `y` +* @returns `y` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); +* var A = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* var beta = new Complex128( 0.0, 0.0 ); +* +* zgemv( 'row-major', 'no-transpose', 2, 2, alpha, A, 2, x, 1, beta, y, 1 ); +* // A => [ -3.0, 17.0, -7.0, 37.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); +* var A = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* var beta = new Complex128( 0.0, 0.0 ); +* +* zgemv.ndarray( 'row-major', 'no-transpose', 2, 2, alpha, A, 2, 1, 0, x, 1, 0, beta, y, 1, 0 ); +* // A => [ -3.0, 17.0, -7.0, 37.0 ] +*/ +declare var zgemv: Routine; + + +// EXPORTS // + +export = zgemv; diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/test.ts new file mode 100644 index 000000000000..1219bed63505 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/docs/types/test.ts @@ -0,0 +1,537 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex128Array = require( '@stdlib/array/complex128' ); +import zgemv = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 10, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( '10', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( true, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( false, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( null, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( undefined, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( [], 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( {}, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( ( x: number ): number => x, 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 10, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', '10', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', true, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', false, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', null, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', undefined, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', [], 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', {}, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', ( x: number ): number => x, 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', '10', 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', true, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', false, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', null, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', undefined, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', [], 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', {}, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', ( x: number ): number => x, 10, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, '10', 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, true, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, false, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, null, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, undefined, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, [], 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, {}, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, ( x: number ): number => x, 1.0, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, '10', A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, true, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, false, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, null, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, undefined, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, [], A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, {}, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, ( x: number ): number => x, A, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, 10, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, '10', 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, true, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, false, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, null, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, undefined, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, [], 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, {}, 3, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, ( x: number ): number => x, 3, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, '10', x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, true, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, false, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, null, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, undefined, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, [], x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, {}, x, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, ( x: number ): number => x, x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Complex128Array... +{ + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, 10, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, '10', 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, true, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, false, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, null, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, undefined, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, [], 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, {}, 1, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, ( x: number ): number => x, 1, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, '10', 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, true, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, false, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, null, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, undefined, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, [], 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, {}, 1.0, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, ( x: number ): number => x, 1.0, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, '10', y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, true, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, false, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, null, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, undefined, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, [], y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, {}, y, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, 10, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, '10', 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, true, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, false, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, null, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, undefined, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, [], 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, {}, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, '10' ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, true ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, false ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, null ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, undefined ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, [] ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, {} ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv(); // $ExpectError + zgemv( 'row-major' ); // $ExpectError + zgemv( 'row-major', 'no-transpose' ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0 ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y ); // $ExpectError + zgemv( 'row-major', 'no-transpose', 10, 10, 1.0, A, 3, x, 1, 1.0, y, 1, 3 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a string... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 10, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( '10', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( true, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( false, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( null, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( undefined, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( [], 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( {}, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( ( x: number ): number => x, 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', '10', 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', true, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', false, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', null, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', undefined, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', [], 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', {}, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', ( x: number ): number => x, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, '10', 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, true, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, false, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, null, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, undefined, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, [], 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, {}, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, ( x: number ): number => x, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, '10', A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, true, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, false, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, null, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, undefined, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, [], A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, {}, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, ( x: number ): number => x, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, 10, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, '10', 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, true, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, false, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, null, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, undefined, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, [], 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, {}, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, ( x: number ): number => x, 3, 1, 0, x, 1, 0, 1.0, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, '10', 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, true, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, false, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, null, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, undefined, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, [], 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, {}, 1, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, ( x: number ): number => x, 1, 0, x, 1, 0, 1.0, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, '10', 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, true, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, false, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, null, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, undefined, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, [], 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, {}, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, ( x: number ): number => x, 0, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, '10', x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, true, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, false, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, null, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, undefined, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, [], x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, {}, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, ( x: number ): number => x, x, 1, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Complex128Array... +{ + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, 10, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, '10', 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, true, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, false, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, null, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, undefined, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, [], 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, {}, 1, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, ( x: number ): number => x, 1, 0, 1.0, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, '10', 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, true, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, false, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, null, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, undefined, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, [], 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, {}, 0, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, ( x: number ): number => x, 0, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, '10', 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, true, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, false, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, null, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, undefined, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, [], 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, {}, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, ( x: number ): number => x, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, '10', 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, true, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, false, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, null, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, undefined, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, [], 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, {}, 1.0, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, ( x: number ): number => x, 1.0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, '10', y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, true, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, false, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, null, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, undefined, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, [], y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, {}, y, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, '10', 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, true, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, false, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, null, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, undefined, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, [], 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, {}, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifteenth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, '10', 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, true, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, false, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, null, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, undefined, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, [], 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, {}, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixteenth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, '10' ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, true ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, false ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, null ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, undefined ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, [] ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, {} ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + const A = new Complex128Array( 20 ); + + zgemv.ndarray(); // $ExpectError + zgemv.ndarray( 'no-transpose' ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1 ); // $ExpectError + zgemv.ndarray( 'no-transpose', 10, 10, 1.0, A, 3, 1, 0, x, 1, 0, 1.0, y, 1, 0, 3 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/examples/index.js b/lib/node_modules/@stdlib/blas/base/zgemv/examples/index.js new file mode 100644 index 000000000000..391f7415636c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/examples/index.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var logEach = require( '@stdlib/console/log-each' ); +var zgemv = require( './../lib' ); + +function rand() { + return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var x = filledarrayBy( 3, 'complex128', rand ); +console.log( x.get( 0 ).toString() ); + +var y = filledarrayBy( 3, 'complex128', rand ); +console.log( y.get( 0 ).toString() ); + +var A = filledarrayBy( 9, 'complex128', rand ); +console.log( A.get( 0 ).toString() ); + +var alpha = new Complex128( 2.0, 2.0 ); +console.log( alpha.toString() ); + +var beta = new Complex128( 2.0, 2.0 ); +console.log( beta.toString() ); + +// Perform `y = α*A*x + β*y`: +zgemv( 'row-major', 'no-transpose', 3, 3, alpha, A, 3, x, 1, beta, y, 1 ); + +// Print the results: +logEach( '(%s)', A ); + +// Perform `y = α*A*x + β*y` using alternative indexing semantics: +zgemv.ndarray( 'no-transpose', 3, 3, alpha, A, 3, 1, 0, x, 1, 0, beta, y, 1, 0 ); + +// Print the results: +logEach( '(%s)', A ); diff --git a/lib/node_modules/@stdlib/blas/base/zgemv/lib/base.js b/lib/node_modules/@stdlib/blas/base/zgemv/lib/base.js new file mode 100644 index 000000000000..0d22e99a74c7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zgemv/lib/base.js @@ -0,0 +1,234 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var mul = require( '@stdlib/complex/float64/base/mul' ); +var muladd = require( '@stdlib/complex/float64/base/mul-add' ); +var zfill = require( '@stdlib/blas/ext/base/zfill' ).ndarray; +var zscal = require( '@stdlib/blas/base/zscal' ).ndarray; + + +// FUNCTIONS // + +/** +* Tests whether a provided string indicates to transpose a matrix. +* +* @private +* @param {string} str - input string +* @returns {boolean} boolean indicating whether to transpose a matrix +* +* @example +* var bool = isTransposed( 'transpose' ); +* // returns true +* +* @example +* var bool = isTransposed( 'conjugate-transpose' ); +* // returns true +* +* @example +* var bool = isTransposed( 'no-transpose' ); +* // returns false +*/ +function isTransposed( str ) { // TODO: consider moving to a separate helper utility package + return ( str !== 'no-transpose' ); +} + + +// MAIN // + +/** +* Performs one of the matrix-vector operations `y = α*A*x + β*y`, or `y = α*A^T*x + β*y`, or `y = α*A^H*x + β*y`, where `α` and `β` are scalars, `X` and `Y` are vectors and `A` is an `M` by `N` matrix. +* +* @private +* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {number} alpha - scalar constant +* @param {Complex128Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Complex128Array} x - first input vector +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {number} beta - scalar constant +* @param {Complex128Array} y - second input vector +* @param {integer} strideY - stride length for `y` +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {Complex128Array} `y` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); +* var A = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ] ); +* var alpha = new Complex128( 1.0, 0.0 ); +* var beta = new Complex128( 0.0, 0.0 ); +* +* zgemv( 'row-major', 'no-transpose', 2, 2, alpha, A, 2, x, 1, beta, y, 1 ); +* // A => [ -3.0, 17.0, -7.0, 37.0 ] +*/ +function zgemv( trans, M, N, alpha, A, strideA1, strideA2, offsetA, x, strideX, offsetX, beta, y, strideY, offsetY ) { // eslint-disable-line max-params, max-len + var isrm; + var xlen; + var ylen; + var tmp; + var da0; + var da1; + var ix; + var iy; + var ia; + var i1; + var i0; + + // Note on variable naming convention: da#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + isrm = isRowMajor( [ strideA1, strideA2 ] ); + if ( isTransposed( trans ) ) { + xlen = M; + ylen = N; + } else { + xlen = N; + ylen = M; + } + // y = beta*y + if ( real( beta ) === 0.0 && imag( beta ) === 0.0 ) { + zfill( ylen, new Complex128( 0.0, 0.0 ), y, strideY, offsetY ); + } else if ( real( beta ) !== 1.0 && imag( beta ) === 0.0 ) { + zscal( ylen, beta, y, strideY, offsetY ); + } + if ( real( alpha ) === 0.0 && imag( alpha ) === 0.0 ) { + return y; + } + // Form: y = α*A*x + y + if ( + ( !isrm && !isTransposed( trans ) ) || + ( isrm && isTransposed( trans ) ) + ) { + if ( isrm ) { + // For row-major matrices, the last dimension has the fastest changing index... + da0 = strideA2; // offset increment for innermost loop + da1 = strideA1 - ( ylen*strideA2 ); // offset increment for outermost loop + } else { // isColMajor + // For column-major matrices, the first dimension has the fastest changing index... + da0 = strideA1; // offset increment for innermost loop + da1 = strideA2 - ( ylen*strideA1 ); // offset increment for outermost loop + } + ia = offsetA; + ix = offsetX; + for ( i1 = 0; i1 < xlen; i1++ ) { + tmp = mul( alpha, x[ ix ] ); + if ( real( tmp ) === 0.0 && imag( tmp ) === 0.0 ) { + ia += da0 * ylen; + } else { + iy = offsetY; + for ( i0 = 0; i0 < ylen; i0++ ) { + muladd( A[ ia ], tmp, y[ iy ] ); + iy += strideY; + ia += da0; + } + } + ix += strideX; + ia += da1; + } + return y; + } + // Form: y = α*A^T*x + y + + // ( !isrm && isTransposed( trans ) ) || ( isrm && !isTransposed( trans ) ) + if ( isrm ) { + // For row-major matrices, the last dimension has the fastest changing index... + da0 = strideA2; // offset increment for innermost loop + da1 = strideA1 - ( xlen*strideA2 ); // offset increment for outermost loop + } else { // isColMajor + // For column-major matrices, the first dimension has the fastest changing index... + da0 = strideA1; // offset increment for innermost loop + da1 = strideA2 - ( xlen*strideA1 ); // offset increment for outermost loop + } + ia = offsetA; + iy = offsetY; + for ( i1 = 0; i1 < ylen; i1++ ) { + tmp = new Complex128( 0.0, 0.0 ); + ix = offsetX; + for ( i0 = 0; i0 < xlen; i0++ ) { + muladd( A[ ia ], x[ ix ], tmp ); + ix += strideX; + ia += da0; + } + muladd( alpha, tmp, y[ iy ] ); + iy += strideY; + ia += da1; + } + return y; +} +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +console.log('Constructing inputs as you showed...'); + +// Your inputs (these are interleaved complex values): +// x = [1+2i, 3+4i] -> length = 2 complex elements +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +// y = [0+0i, 0+0i] +var y = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0 ] ); +// A = [[1+1i,2+2i],[3+3i,4+4i]] (row-major), 4 complex elements +var A = new Complex128Array( [ 1.0,1.0, 2.0,2.0, 3.0,3.0, 4.0,4.0 ] ); + +console.log('A.length=', A.length, '(complex elems, expect 4 for 2x2)'); +console.log('x.length=', x.length, '(complex elems, expect 2)'); +console.log('y.length=', y.length, '(complex elems, expect 2)'); + +console.log('Direct indexed values (should NOT be undefined):'); +console.log('A[0]=', A[0]); +console.log('x[0]=', x[0]); +console.log('y[0]=', y[0]); + +var alpha = new Complex128( 1.0, 0.0 ); +var beta = new Complex128( 0.0, 0.0 ); + +zgemv( + 'no-transpose', // trans + 2, // M + 2, // N + alpha, // alpha + A, // A + 2, // strideA1 (columns) + 1, // strideA2 (innermost index) + 0, // offsetA + x, // x + 1, // strideX + 0, // offsetX + beta, // beta + y, // y + 1, // strideY + 0 // offsetY +); + +console.log('Result y:', y.toString()); + +// EXPORTS // + +module.exports = zgemv;