diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/README.md b/lib/node_modules/@stdlib/blas/base/cgeru/README.md new file mode 100644 index 000000000000..1f8169ef3557 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/README.md @@ -0,0 +1,307 @@ + + +# cgeru + +> Perform the rank 1 operation `A = α*x*y^T + A`. + +
+ +
+ + + +
+ +## Usage + +```javascript +var cgeru = require( '@stdlib/blas/base/cgeru' ); +``` + +#### cgeru( ord, M, N, α, x, sx, y, sy, A, lda ) + +Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. + + + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); + +cgeru( 'row-major', 2, 3, alpha, x, 1, y, 1, A, 3 ); +// A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +``` + +The function has the following parameters: + +- **ord**: storage layout. +- **M**: number of rows in the matrix `A`. +- **N**: number of columns in the matrix `A`. +- **α**: scalar constant. +- **x**: an `M` element [`Complex64Array`][@stdlib/array/complex64]. +- **sx**: stride length for `x`. +- **y**: an `N` element [`Complex64Array`][@stdlib/array/complex64]. +- **sy**: stride length for `y`. +- **A**: input matrix stored in linear memory as a [`Complex64Array`][@stdlib/array/complex64]. +- **lda**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). + +The stride parameters determine which elements in the strided arrays are accessed at runtime. 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 A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +var x = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0 ] ); +var y = new Complex64Array( [ 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] ); +var alpha = new Complex64( 0.5, 0.5 ); + +cgeru( 'row-major', 2, 3, alpha, x, 2, y, 2, A, 3 ); +// A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.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, 2.0, 2.0, 1.0, 1.0 ] ); +var y0 = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); +var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); + +var alpha = new Complex64( 0.5, 0.5 ); + +// Create offset views... +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +cgeru( 'row-major', 2, 3, alpha, x1, -1, y1, -1, A, 3 ); +// A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +``` + +#### cgeru.ndarray( M, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa ) + +Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. + + + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); + +cgeru.ndarray( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); +// A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +``` + +The function has the following additional parameters: + +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. +- **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 A = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +var x = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 2.0, 2.0 ] ); +var y = new Complex64Array( [ 0.0, 0.0, 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] ); +var alpha = new Complex64( 0.5, 0.5 ); + +cgeru.ndarray( 2, 3, alpha, x, 2, 1, y, 2, 1, A, 3, 1, 2 ); +// A => [ 0.0, 0.0, 0.0, 0.0, -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +``` + +
+ + + +
+ +## Notes + +- `cgeru()` corresponds to the [BLAS][blas] level 2 function [`cgeru`][cgeru]. + +
+ + + +
+ +## 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 cgeru = require( '@stdlib/blas/base/cgeru' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var M = 3; +var N = 3; + +var x = filledarrayBy( N, 'complex64', rand ); +var y = filledarrayBy( M, 'complex64', rand ); +var A = filledarrayBy( M*N, 'complex64', rand ); + +var alpha = new Complex64( 0.5, 0.5 ); + +cgeru( 'row-major', M, N, alpha, x, 1, y, 1, A, N ); + +// Print the results: +logEach( '%s', A ); + +cgeru.ndarray( M, N, alpha, x, 1, 0, y, 1, 0, A, N, 1, 0 ); + +// Print the results: +logEach( '%s', A ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.js new file mode 100644 index 000000000000..8bd57d533fc8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.js @@ -0,0 +1,122 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +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 pkg = require( './../package.json' ).name; +var cgeru = require( './../lib/cgeru.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + 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 ); + Abuf = uniform( (N*N)*2, -100.0, 100.0, options ); + A = new Complex64Array( Abuf.buffer ); + + alpha = new Complex64( 0.5, 0.5 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = cgeru( 'row-major', N, N, alpha, x, 1, y, 1, A, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s:size=%d', pkg, len*len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..43042b9cd779 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/benchmark/benchmark.ndarray.js @@ -0,0 +1,122 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +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 pkg = require( './../package.json' ).name; +var cgeru = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var xbuf; + var ybuf; + var Abuf; + var x; + var y; + var A; + + 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 ); + Abuf = uniform( (N*N)*2, -100.0, 100.0, options ); + A = new Complex64Array( Abuf.buffer ); + + alpha = new Complex64( 0.5, 0.5 ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = cgeru( N, N, alpha, x, 1, 0, y, 1, 0, A, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:size=%d', pkg, len*len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cgeru/docs/repl.txt new file mode 100644 index 000000000000..b9c92481c2fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/docs/repl.txt @@ -0,0 +1,156 @@ + +{{alias}}( ord, M, N, α, x, sx, y, sy, A, lda ) + Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` + is an `M` element vector, `y` is an `N` element vector, 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`, `N`, or `α` is equal to `0`, the function returns `A` unchanged. + + Parameters + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + α: Complex64 + Scalar constant. + + x: Complex64Array + First input vector. + + sx: integer + Stride length for `x`. + + y: Complex64Array + Second input vector. + + sy: integer + Stride length for `y`. + + A: Complex64Array + Input matrix. + + lda: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + Returns + ------- + A: Complex64Array + Input matrix. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 2.0, 2.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 2.0, 2.0, 1.0, 1.0 ] ); + > var buf = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ]; + > var A = new {{alias:@stdlib/array/complex64}}( buf ); + > var alpha = new {{alias:@stdlib/complex/float32/ctor}}( 0.5, 0.5 ); + > var ord = 'row-major'; + > {{alias}}( ord, 2, 2, alpha, x, 1, y, 1, A, 2 ) + [ -1.0, 3.0, 1.0, 3.0, -1.0, 7.0, 2.0, 6.0 ] + + // Advanced indexing: + > x = new {{alias:@stdlib/array/complex64}}( [ 2.0, 2.0, 1.0, 1.0 ] ); + > y = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 2.0, 2.0 ] ); + > buf = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ]; + > A = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 0.5, 0.5 ); + > ord = 'row-major'; + > {{alias}}( ord, 2, 2, alpha, x, -1, y, -1, A, 2 ) + [ -1.0, 3.0, 1.0, 3.0, -1.0, 7.0, 2.0, 6.0 ] + + // Using typed array views: + > var x0buf = [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0 ]; + > var x0 = new {{alias:@stdlib/array/complex64}}( x0buf ); + > var y0buf = [ 0.0, 0.0, 2.0, 2.0, 1.0, 1.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, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ]; + > A = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 0.5, 0.5 ); + > ord = 'row-major'; + > {{alias}}( ord, 2, 2, alpha, x1, 1, y1, 1, A, 2 ) + [ -1.0, 3.0, 1.0, 3.0, -1.0, 7.0, 2.0, 6.0 ] + + +{{alias}}.ndarray( M, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa ) + Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing + semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an + `N` element vector, and `A` is an `M` by `N` matrix. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + α: Complex64 + Scalar constant. + + x: Complex64Array + First input vector. + + sx: integer + Stride length for `x`. + + ox: integer + Starting index for `x`. + + y: Complex64Array + Second input vector. + + sy: integer + Stride length for `y`. + + oy: integer + Starting index for `y`. + + A: Complex64Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + Returns + ------- + A: Complex64Array + Input matrix. + + Examples + -------- + > x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 2.0, 2.0 ] ); + > y = new {{alias:@stdlib/array/complex64}}( [ 2.0, 2.0, 1.0, 1.0 ] ); + > buf = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ]; + > A = new {{alias:@stdlib/array/complex64}}( buf ); + > alpha = new {{alias:@stdlib/complex/float32/ctor}}( 0.5, 0.5 ); + > ord = 'row-major'; + > {{alias}}.ndarray( 2, 2, alpha, x, 1, 0, y, 1, 0, A, 2, 1, 0 ) + [ -1.0, 3.0, 1.0, 3.0, -1.0, 7.0, 2.0, 6.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/index.d.ts new file mode 100644 index 000000000000..d7927ae37efb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/index.d.ts @@ -0,0 +1,137 @@ +/* +* @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 { Layout } from '@stdlib/types/blas'; +import { Complex64Array } from '@stdlib/types/array'; +import { Complex64 } from '@stdlib/types/complex'; + +/** +* Interface describing `cgeru`. +*/ +interface Routine { + /** + * Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. + * + * @param order - storage layout + * @param M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param x - first input vector + * @param strideX - `x` stride length + * @param y - second input vector + * @param strideY - `y` stride length + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns `A` + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); + * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); + * + * cgeru( 'row-major', 2, 3, alpha, x, 1, y, 1, A, 3 ); + * // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] + */ + ( order: Layout, M: number, N: number, alpha: Complex64, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number, A: Complex64Array, LDA: number ): Complex64Array; + + /** + * Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. + * + * @param M - number of rows in the matrix `A` + * @param N - number of columns in the matrix `A` + * @param alpha - scalar constant + * @param x - first input vector + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param y - second input vector + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` + * @param A - input matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index for `A` + * @returns `A` + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * + * var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); + * var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); + * + * cgeru.ndarray( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); + * // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] + */ + ndarray( M: number, N: number, alpha: Complex64, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number, A: Complex64Array, strideA1: number, strideA2: number, offsetA: number ): Complex64Array; +} + +/** +* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. +* +* @param order - storage layout +* @param M - number of rows in the matrix `A` +* @param N - number of columns in the matrix `A` +* @param alpha - scalar constant +* @param x - first input vector +* @param strideX - `x` stride length +* @param y - second input vector +* @param strideY - `y` stride length +* @param A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @returns `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru( 'row-major', 2, 3, alpha, x, 1, y, 1, A, 3 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru.ndarray( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +*/ +declare var cgeru: Routine; + + +// EXPORTS // + +export = cgeru; diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/test.ts new file mode 100644 index 000000000000..109faafc047e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/docs/types/test.ts @@ -0,0 +1,476 @@ +/* +* @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 cgeru = require( './index' ); + + +// TESTS // + +// The function returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, 10 ); // $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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 10, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( true, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( false, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( null, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( undefined, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( [], 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( {}, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( ( x: number ): number => x, 10, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', '10', 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', true, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', false, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', null, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', undefined, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', [], 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', {}, 10, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', ( x: number ): number => x, 10, alpha, x, 1, y, 1, A, 10 ); // $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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, '10', alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, true, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, false, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, null, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, undefined, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, [], alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, {}, alpha, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, ( x: number ): number => x, alpha, x, 1, y, 1, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cgeru( 'row-major', 10, 10, '10', x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, true, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, false, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, null, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, undefined, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, [], x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, {}, x, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, ( x: number ): number => x, x, 1, y, 1, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex64Array... +{ + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, 10, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, '10', 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, true, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, false, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, null, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, undefined, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, [ '1' ], 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, {}, 1, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, ( x: number ): number => x, 1, y, 1, A, 10 ); // $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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, '10', y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, true, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, false, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, null, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, undefined, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, [], y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, {}, y, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, ( x: number ): number => x, y, 1, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, 1, 10, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, '10', 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, true, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, false, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, null, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, undefined, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, [ '1' ], 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, {}, 1, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, ( x: number ): number => x, 1, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, 1, y, '10', A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, true, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, false, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, null, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, undefined, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, [], A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, {}, A, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, ( x: number ): number => x, A, 10 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, 10, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, '10', 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, true, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, false, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, null, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, undefined, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, [ '1' ], 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, {}, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, ( 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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, '10' ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, true ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, false ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, null ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, undefined ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, [] ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, {} ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru(); // $ExpectError + cgeru( 'row-major' ); // $ExpectError + cgeru( 'row-major', 10 ); // $ExpectError + cgeru( 'row-major', 10, 10 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1 ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A ); // $ExpectError + cgeru( 'row-major', 10, 10, alpha, x, 1, y, 1, A, 10, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectType Complex64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( '10', 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( true, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( false, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( null, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( undefined, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( [], 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( {}, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( ( x: number ): number => x, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, '10', alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, true, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, false, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, null, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, undefined, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, [], alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, {}, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, ( x: number ): number => x, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + + cgeru.ndarray( 10, 10, '10', x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, true, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, false, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, null, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, undefined, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, [], x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, {}, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, ( x: number ): number => x, x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex64Array... +{ + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, 10, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, '10', 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, true, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, false, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, null, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, undefined, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, [ '1' ], 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, {}, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, ( x: number ): number => x, 1, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, '10', 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, true, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, false, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, null, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, undefined, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, [], 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, {}, 0, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, ( x: number ): number => x, 0, y, 1, 0, A, 10, 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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, '10', y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, true, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, false, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, null, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, undefined, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, [], y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, {}, y, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, ( x: number ): number => x, y, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, 10, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, '10', 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, true, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, false, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, null, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, undefined, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, [ '1' ], 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, {}, 1, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, ( x: number ): number => x, 1, 0, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, '10', 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, true, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, false, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, null, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, undefined, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, [], 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, {}, 0, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, ( x: number ): number => x, 0, A, 10, 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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, '10', A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, true, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, false, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, null, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, undefined, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, [], A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, {}, A, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, ( x: number ): number => x, A, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Complex64Array... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, 10, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, '10', 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, true, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, false, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, null, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, undefined, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, [ '1' ], 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, {}, 10, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, ( x: number ): number => x, 10, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, '10', 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, true, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, false, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, null, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, undefined, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, [], 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, {}, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, '10', 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, true, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, false, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, null, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, undefined, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, [], 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, {}, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + const A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, '10' ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, true ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, false ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, null ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, undefined ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, [] ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, {} ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 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 A = new Complex64Array( 20 ); + const alpha = new Complex64( 0.5, 0.5 ); + + cgeru.ndarray(); // $ExpectError + cgeru.ndarray( 10 ); // $ExpectError + cgeru.ndarray( 10, 10 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1 ); // $ExpectError + cgeru.ndarray( 10, 10, alpha, x, 1, 0, y, 1, 0, A, 10, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/examples/index.js b/lib/node_modules/@stdlib/blas/base/cgeru/examples/index.js new file mode 100644 index 000000000000..cb353b7495a1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/examples/index.js @@ -0,0 +1,48 @@ +/** +* @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 cgeru = require( './../lib' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var M = 3; +var N = 3; + +var x = filledarrayBy( N, 'complex64', rand ); +var y = filledarrayBy( M, 'complex64', rand ); +var A = filledarrayBy( M*N, 'complex64', rand ); + +var alpha = new Complex64( 0.5, 0.5 ); + +cgeru( 'row-major', M, N, alpha, x, 1, y, 1, A, N ); + +// Print the results: +logEach( '%s', A ); + +cgeru.ndarray( M, N, alpha, x, 1, 0, y, 1, 0, A, N, 1, 0 ); + +// Print the results: +logEach( '%s', A ); diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/lib/base.js b/lib/node_modules/@stdlib/blas/base/cgeru/lib/base.js new file mode 100644 index 000000000000..28c852760f01 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/lib/base.js @@ -0,0 +1,172 @@ +/** +* @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' ); +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 rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. +* +* @private +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - first input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64Array} y - second input vector +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @param {Complex64Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +*/ +function cgeru( M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-params, max-len + var realpha; + var imalpha; + var viewA; + var viewX; + var viewY; + var retmp; + var imtmp; + var tmp; + var rex; + var imx; + var rey; + var imy; + var sa1; + var sa2; + var da0; + var da1; + var S0; + var S1; + var oa; + var ox; + var oy; + var sx; + var sy; + var ia; + var ix; + var iy; + var i0; + var i1; + + // Note on variable naming convention: S#, da#, ia#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Decompose scalars into real and imaginary components: + realpha = realf( alpha ); + imalpha = imagf( alpha ); + if ( realpha === 0.0 && imalpha === 0.0 ) { + return A; + } + oa = offsetA * 2; + sa1 = strideA1 * 2; + sa2 = strideA2 * 2; + ox = offsetX * 2; + oy = offsetY * 2; + sx = strideX * 2; + sy = strideY * 2; + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + // For row-major matrices, the last dimension has the fastest changing index... + S0 = N; + S1 = M; + da0 = sa2; // offset increment for innermost loop + da1 = sa1 - (S0*sa2); // offset increment for outermost loop + + // Swap the vectors... + tmp = x; + x = y; + y = tmp; + + tmp = sx; + sx = sy; + sy = tmp; + + tmp = ox; + ox = oy; + oy = tmp; + } else { // order === 'column-major' + // For column-major matrices, the first dimension has the fastest changing index... + S0 = M; + S1 = N; + da0 = sa1; // offset increment for innermost loop + da1 = sa2 - (S0*sa1); // offset increment for outermost loop + } + // Reinterpret arrays as real-valued views of interleaved real and imaginary components: + viewA = reinterpret( A, 0 ); + viewX = reinterpret( x, 0 ); + viewY = reinterpret( y, 0 ); + ix = ox; + iy = oy; + ia = oa; + for ( i1 = 0; i1 < S1; i1++ ) { + rey = viewY[ iy ]; + imy = viewY[ iy+1 ]; + + // Check whether we can avoid the inner loop entirely... + if ( rey === 0.0 && imy === 0.0 ) { + ia += da0 * S0; + } else { + retmp = f32(f32(realpha*rey) - f32(imalpha*imy)); + imtmp = f32(f32(realpha*imy) + f32(imalpha*rey)); + ix = ox; + for ( i0 = 0; i0 < S0; i0++ ) { + rex = viewX[ ix ]; + imx = viewX[ ix+1 ]; + muladd( rex, imx, retmp, imtmp, viewA[ ia ], viewA[ ia+1 ], viewA, 1, ia ); // eslint-disable-line max-len + ix += sx; + ia += da0; + } + } + iy += sy; + ia += da1; + } + return A; +} + + +// EXPORTS // + +module.exports = cgeru; diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/lib/cgeru.js b/lib/node_modules/@stdlib/blas/base/cgeru/lib/cgeru.js new file mode 100644 index 000000000000..6fe5b74be9ee --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/lib/cgeru.js @@ -0,0 +1,117 @@ +/** +* @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 isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var max = require( '@stdlib/math/base/special/fast/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. +* +* @param {string} order - storage layout +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - first input vector +* @param {integer} strideX - `x` stride length +* @param {Complex64Array} y - second input vector +* @param {integer} strideY - `y` stride length +* @param {Complex64Array} A - input matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} second argument must be a nonnegative integer +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be non-zero +* @throws {RangeError} eighth argument must be non-zero +* @throws {RangeError} tenth argument must be a valid stride +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru( 'row-major', 2, 3, alpha, x, 1, y, 1, A, 3 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +*/ +function cgeru( order, M, N, alpha, x, strideX, y, strideY, A, LDA ) { + var iscm; + var vala; + var sa1; + var sa2; + var ox; + var oy; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) ); + } + iscm = isColumnMajor( order ); + if ( iscm ) { + vala = M; + } else { + vala = N; + } + if ( LDA < max( 1, vala ) ) { + throw new RangeError( format( 'invalid argument. Tenth argument must be greater than or equal to max(1,%d). Value: `%d`.', vala, LDA ) ); + } + // Check if we can early return... + if ( M === 0 || N === 0 ) { + return A; + } + ox = stride2offset( M, strideX ); + oy = stride2offset( N, strideY ); + if ( iscm ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + } + return base( M, N, alpha, x, strideX, ox, y, strideY, oy, A, sa1, sa2, 0 ); +} + + +// EXPORTS // + +module.exports = cgeru; diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/lib/index.js b/lib/node_modules/@stdlib/blas/base/cgeru/lib/index.js new file mode 100644 index 000000000000..f9181414c41c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/lib/index.js @@ -0,0 +1,76 @@ +/** +* @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 perform the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. +* +* @module @stdlib/blas/base/cgeru +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var cgeru = require( '@stdlib/blas/base/cgeru' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru( 'row-major', 2, 3, alpha, x, 1, y, 1, A, 3 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var cgeru = require( '@stdlib/blas/base/cgeru' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru.ndarray( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.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 cgeru; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + cgeru = main; +} else { + cgeru = tmp; +} + + +// EXPORTS // + +module.exports = cgeru; + +// exports: { "ndarray": "cgeru.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/lib/main.js b/lib/node_modules/@stdlib/blas/base/cgeru/lib/main.js new file mode 100644 index 000000000000..c5c93cb6e983 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/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 cgeru = require( './cgeru.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( cgeru, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cgeru; diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cgeru/lib/ndarray.js new file mode 100644 index 000000000000..51dab0579ac8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/lib/ndarray.js @@ -0,0 +1,86 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix. +* +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {Complex64} alpha - scalar constant +* @param {Complex64Array} x - first input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64Array} y - second input vector +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @param {Complex64Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @throws {RangeError} first argument must be a nonnegative integer +* @throws {RangeError} second argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be non-zero +* @throws {RangeError} eighth argument must be non-zero +* @returns {Complex64Array} `A` +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* +* var A = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); +* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.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 ); +* +* cgeru( 2, 3, alpha, x, 1, 0, y, 1, 0, A, 3, 1, 0 ); +* // A => [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +*/ +function cgeru( M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-params, max-len + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideY === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideY ) ); + } + // Check if we can early return... + if ( M === 0 || N === 0 ) { + return A; + } + return base( M, N, alpha, x, strideX, offsetX, y, strideY, offsetY, A, strideA1, strideA2, offsetA ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = cgeru; diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/package.json b/lib/node_modules/@stdlib/blas/base/cgeru/package.json new file mode 100644 index 000000000000..4f6a0b029185 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/blas/base/cgeru", + "version": "0.0.0", + "description": "Perform the rank 1 operation A = α⋅x⋅y^T + A.", + "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", + "cgeru", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "complex64", + "single", + "complex64array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major.json new file mode 100644 index 000000000000..6fd480e3fb43 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 2.0, 2.0, 5.0, 5.0, 3.0, 3.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 2, + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, 0.0, 4.0, 1.0, 9.0, 2.0, 4.0, 4.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 000000000000..bfe18fadf378 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 1, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 0.0, 0.0, 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -3, + "strideA2": -7, + "offsetA": 18, + "A_out": [ 0.0, 0.0, 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oa.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oa.json new file mode 100644 index 000000000000..8d5d11d76258 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oa.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 0.0, 0.0, 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 1, + "strideA2": 4, + "offsetA": 1, + "A_out": [ 0.0, 0.0, -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_ox.json new file mode 100644 index 000000000000..6a8a0e4bbb2e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_ox.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 1, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oy.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oy.json new file mode 100644 index 000000000000..99fff5d0b006 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_oy.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 1, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2.json new file mode 100644 index 000000000000..506dcc87b216 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": 3, + "strideA2": 7, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2n.json new file mode 100644 index 000000000000..e45672b4a9bb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1_sa2n.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": 3, + "strideA2": -7, + "offsetA": 14, + "A_out": [ 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2.json new file mode 100644 index 000000000000..512275330869 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -3, + "strideA2": 7, + "offsetA": 3, + "A_out": [ -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2n.json new file mode 100644 index 000000000000..60af0931c753 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_sa1n_sa2n.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -3, + "strideA2": -7, + "offsetA": 17, + "A_out": [ 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_x_zeros.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_x_zeros.json new file mode 100644 index 000000000000..ba508266cae3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_x_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 0.0, 0.0, 0.0, 0.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 2.0, 2.0, 5.0, 5.0, 3.0, 3.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 2, + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "A_out": [ 1.0, 1.0, 4.0, 4.0, 2.0, 2.0, 5.0, 5.0, 3.0, 3.0, 6.0, 6.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyn.json new file mode 100644 index 000000000000..2edcdb6da76c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyn.json @@ -0,0 +1,24 @@ +{ + "order": "column-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 4, + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyp.json new file mode 100644 index 000000000000..969b3436155b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xnyp.json @@ -0,0 +1,24 @@ +{ + "order": "column-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 4, + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyn.json new file mode 100644 index 000000000000..1d1561867845 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyn.json @@ -0,0 +1,24 @@ +{ + "order": "column-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 4, + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyp.json new file mode 100644 index 000000000000..f593c5138ffb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_xpyp.json @@ -0,0 +1,24 @@ +{ + "order": "column-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 7.0, 7.0, 10.0, 10.0, 2.0, 2.0, 5.0, 5.0, 8.0, 8.0, 11.0, 11.0, 3.0, 3.0, 6.0, 6.0, 9.0, 9.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 4, + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "A_out": [ -2.0, 4.0, -2.0, 10.0, -2.0, 16.0, -2.0, 22.0, 0.0, 4.0, 1.0, 9.0, 2.0, 14.0, 3.0, 19.0, 2.0, 4.0, 4.0, 8.0, 6.0, 12.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_y_zeros.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_y_zeros.json new file mode 100644 index 000000000000..948667fa1a85 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/column_major_y_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 4.0, 4.0, 2.0, 2.0, 5.0, 5.0, 3.0, 3.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 2, + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "A_out": [ 1.0, 1.0, 4.0, 4.0, 2.0, 2.0, 5.0, 5.0, 3.0, 3.0, 6.0, 6.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major.json new file mode 100644 index 000000000000..eb0d95114abc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 000000000000..f80639658e8f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 1, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 0.0, 0.0, 0.0, 0.0, 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -7, + "strideA2": -3, + "offsetA": 15, + "A_out": [ 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oa.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oa.json new file mode 100644 index 000000000000..3eb1bc820322 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oa.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 2, + "A_out": [ 0.0, 0.0, 0.0, 0.0, -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_ox.json new file mode 100644 index 000000000000..6de4849eefa5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_ox.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 2, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oy.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oy.json new file mode 100644 index 000000000000..7cefccb43085 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_oy.json @@ -0,0 +1,22 @@ +{ + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "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, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2.json new file mode 100644 index 000000000000..a3fca652fde1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 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, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": 7, + "strideA2": 3, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0, -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2n.json new file mode 100644 index 000000000000..6f0306460995 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1_sa2n.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": 7, + "strideA2": -3, + "offsetA": 6, + "A_out": [ 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0, 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2.json new file mode 100644 index 000000000000..80af4746ce8b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 4.0, 4.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 6.0, 6.0, 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 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -7, + "strideA2": 3, + "offsetA": 7, + "A_out": [ -2.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, -2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2n.json new file mode 100644 index 000000000000..8887c7c2f47a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_sa1n_sa2n.json @@ -0,0 +1,20 @@ +{ + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 6.0, 6.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "strideA1": -7, + "strideA2": -3, + "offsetA": 13, + "A_out": [ 4.0, 8.0, 0.0, 0.0, 0.0, 0.0, 1.0, 9.0, 0.0, 0.0, 0.0, 0.0, -2.0, 10.0, 2.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, -2.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_x_zeros.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_x_zeros.json new file mode 100644 index 000000000000..87c7ab36df64 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_x_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 0.0, 0.0, 0.0, 0.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyn.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyn.json new file mode 100644 index 000000000000..79186cf82f23 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyn.json @@ -0,0 +1,24 @@ +{ + "order": "row-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyp.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyp.json new file mode 100644 index 000000000000..ed4852fc1cb1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xnyp.json @@ -0,0 +1,24 @@ +{ + "order": "row-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 4.0, 4.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideX": -1, + "offsetX": 3, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyn.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyn.json new file mode 100644 index 000000000000..7113d5fc59e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyn.json @@ -0,0 +1,24 @@ +{ + "order": "row-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + "strideY": -1, + "offsetY": 2, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyp.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyp.json new file mode 100644 index 000000000000..14e477eb8d18 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_xpyp.json @@ -0,0 +1,24 @@ +{ + "order": "row-major", + "M": 4, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 8.0, 9.0, 9.0, 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + [ 7.0, 7.0, 8.0, 8.0, 9.0, 9.0 ], + [ 10.0, 10.0, 11.0, 11.0, 12.0, 12.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ -2.0, 4.0, 0.0, 4.0, 2.0, 4.0, -2.0, 10.0, 1.0, 9.0, 4.0, 8.0, -2.0, 16.0, 2.0, 14.0, 6.0, 12.0, -2.0, 22.0, 3.0, 19.0, 8.0, 16.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_y_zeros.json b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_y_zeros.json new file mode 100644 index 000000000000..34bf7166b1e0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/fixtures/row_major_y_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "M": 2, + "N": 3, + "alpha": [ 0.5, 0.5 ], + "x": [ 1.0, 1.0, 2.0, 2.0 ], + "strideX": 1, + "offsetX": 0, + "y": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideY": 1, + "offsetY": 0, + "A": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ], + "A_mat": [ + [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ], + [ 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] + ], + "lda": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A_out": [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/test.cgeru.js b/lib/node_modules/@stdlib/blas/base/cgeru/test/test.cgeru.js new file mode 100644 index 000000000000..cbd23369e61a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/test.cgeru.js @@ -0,0 +1,774 @@ +/** +* @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 cgeru = require( './../lib/cgeru.js' ); + + +// FIXTURES // + +var cm = require( './fixtures/column_major.json' ); +var cxpyp = require( './fixtures/column_major_xpyp.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyn = require( './fixtures/column_major_xpyn.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); +var cx0 = require( './fixtures/column_major_x_zeros.json' ); +var cy0 = require( './fixtures/column_major_y_zeros.json' ); +var rm = require( './fixtures/row_major.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); +var rx0 = require( './fixtures/row_major_x_zeros.json' ); +var ry0 = require( './fixtures/row_major_y_zeros.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cgeru, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( cgeru.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 a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( value, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.order, value, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.order, data.M, value, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.order, data.M, data.N, alpha, x, value, y, data.strideY, a, data.lda ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, value, a, data.lda ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + values = [ + -3, + -2, + -1, + 0, + 1 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, value ); + }; + } +}); + +tape( 'the function performs the rank 1 operation `A = α*x*y^T + A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the rank 1 operation `A = α*x*y^T + A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the input matrix (row-major)', function test( t ) { + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the input matrix (column-major)', function test( t ) { + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.order, 0, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + out = cgeru( data.order, data.M, 0, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.order, 0, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + out = cgeru( data.order, data.M, 0, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rx0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cx0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ry0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cy0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxpyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxpyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxnyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxnyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxpyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxpyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rxnyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cxnyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.order, data.M, data.N, alpha, x, data.strideX, y, data.strideY, a, data.lda ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/test.js b/lib/node_modules/@stdlib/blas/base/cgeru/test/test.js new file mode 100644 index 000000000000..e8a9014bd328 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/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 IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var cgeru = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cgeru, '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 cgeru.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 cgeru = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cgeru, mock, 'returns native implementation' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock native implementation... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var cgeru; + var main; + + main = require( './../lib/cgeru.js' ); + + cgeru = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cgeru, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/cgeru/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cgeru/test/test.ndarray.js new file mode 100644 index 000000000000..b6c857b15d88 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cgeru/test/test.ndarray.js @@ -0,0 +1,1118 @@ +/** +* @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 cgeru = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var cm = require( './fixtures/column_major.json' ); +var coa = require( './fixtures/column_major_oa.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var coy = require( './fixtures/column_major_oy.json' ); +var cxpyp = require( './fixtures/column_major_xpyp.json' ); +var cxnyp = require( './fixtures/column_major_xnyp.json' ); +var cxpyn = require( './fixtures/column_major_xpyn.json' ); +var cxnyn = require( './fixtures/column_major_xnyn.json' ); +var csa1sa2 = require( './fixtures/column_major_sa1_sa2.json' ); +var csa1nsa2 = require( './fixtures/column_major_sa1n_sa2.json' ); +var csa1sa2n = require( './fixtures/column_major_sa1_sa2n.json' ); +var csa1nsa2n = require( './fixtures/column_major_sa1n_sa2n.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); +var cx0 = require( './fixtures/column_major_x_zeros.json' ); +var cy0 = require( './fixtures/column_major_y_zeros.json' ); +var rm = require( './fixtures/row_major.json' ); +var roa = require( './fixtures/row_major_oa.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var roy = require( './fixtures/row_major_oy.json' ); +var rxpyp = require( './fixtures/row_major_xpyp.json' ); +var rxnyp = require( './fixtures/row_major_xnyp.json' ); +var rxpyn = require( './fixtures/row_major_xpyn.json' ); +var rxnyn = require( './fixtures/row_major_xnyn.json' ); +var rsa1sa2 = require( './fixtures/row_major_sa1_sa2.json' ); +var rsa1nsa2 = require( './fixtures/row_major_sa1n_sa2.json' ); +var rsa1sa2n = require( './fixtures/row_major_sa1_sa2n.json' ); +var rsa1nsa2n = require( './fixtures/row_major_sa1n_sa2n.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); +var rx0 = require( './fixtures/row_major_x_zeros.json' ); +var ry0 = require( './fixtures/row_major_y_zeros.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cgeru, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 13', function test( t ) { + t.strictEqual( cgeru.length, 13, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( value, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() + { + cgeru( data.M, value, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.M, data.N, alpha, x, value, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) { + var values; + var alpha; + var data; + var a; + var x; + var y; + var i; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[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() { + cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, value, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + }; + } +}); + +tape( 'the function performs the rank 1 operation `A = α*x*y^T + A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the rank 1 operation `A = α*x*y^T + A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the input matrix (row-major)', function test( t ) { + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the input matrix (column-major)', function test( t ) { + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A ); + + out = cgeru( 0, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + out = cgeru( data.M, 0, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A ); + + out = cgeru( 0, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + out = cgeru( data.M, 0, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0.0`, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cm; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( 0.0, 0.0 ); + + expected = new Complex64Array( data.A ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rx0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `x` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cx0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ry0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if `y` contains only zeros, the function returns the input matrix unchanged (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cy0; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1sa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1sa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1nsa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1nsa2; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1sa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1sa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rsa1nsa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = csa1nsa2n; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `A` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = roa; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `A` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = coa; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxpyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxpyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxnyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxnyp; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxpyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxpyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = rxnyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( 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 out; + var a; + var x; + var y; + + data = cxnyn; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `x` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rox; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `x` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = cox; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `y` (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = roy; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `y` (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = coy; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = rcap; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var alpha; + var data; + var out; + var a; + var x; + var y; + + data = ccap; + + a = new Complex64Array( data.A ); + x = new Complex64Array( data.x ); + y = new Complex64Array( data.y ); + + alpha = new Complex64( data.alpha[0], data.alpha[1] ); + + expected = new Complex64Array( data.A_out ); + + out = cgeru( data.M, data.N, alpha, x, data.strideX, data.offsetX, y, data.strideY, data.offsetY, a, data.strideA1, data.strideA2, data.offsetA ); + t.strictEqual( out, a, 'returns expected value' ); + t.strictEqual( isSameComplex64Array( out, expected ), true, 'returns expected value' ); + t.end(); +});