diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/README.md b/lib/node_modules/@stdlib/lapack/base/zlaset/README.md new file mode 100644 index 000000000000..a537dfa8313d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/README.md @@ -0,0 +1,333 @@ + + +# zlaset + +> Set the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. + +
+ +## Usage + +```javascript +var zlaset = require( '@stdlib/lapack/base/zlaset' ); +``` + +#### zlaset( order, uplo, M, N, alpha, beta, A, LDA ) + +Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var A = new Complex128Array( 4 ); + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); + +var z = A.get( 0 ); +// returns + +var re = real( z ); +// returns 3.0 + +var im = imag( z ); +// returns 4.0 + +z = A.get( 1 ); +// returns + +re = real( z ); +// returns 1.0 + +im = imag( z ); +// returns 2.0 +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether to set the upper or lower triangular/trapezoidal part of a matrix `A`. +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **alpha**: value assigned to off-diagonal elements. +- **beta**: value assigned to diagonal elements. +- **A**: input [`Complex128Array`][@stdlib/array/complex128]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +// Initial array: +var A0 = new Complex128Array( 5 ); + +// Create offset view: +var A1 = new Complex128Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset( 'row-major', 'all', 2, 2, alpha, beta, A1, 2 ); + +var z = A0.get( 1 ); +// returns + +var re = real( z ); +// returns 3.0 + +var im = imag( z ); +// returns 4.0 +``` + +#### zlaset.ndarray( uplo, M, N, alpha, beta, A, sa1, sa2, oa ) + +Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var A = new Complex128Array( 4 ); + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 0 ); + +var z = A.get( 0 ); +// returns + +var re = real( z ); +// returns 3.0 + +var im = imag( z ); +// returns 4.0 + +z = A.get( 1 ); +// returns + +re = real( z ); +// returns 1.0 + +im = imag( z ); +// returns 2.0 +``` + +The function has the following parameters: + +- **uplo**: specifies whether to set the upper or lower triangular/trapezoidal part of a matrix `A`. +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **alpha**: value assigned to off-diagonal elements. +- **beta**: value assigned to diagonal elements. +- **A**: input [`Complex128Array`][@stdlib/array/complex128]. +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); + +var A = new Complex128Array( 5 ); + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 1 ); + +var z = A.get( 0 ); +// returns + +var re = real( z ); +// returns 0.0 + +var im = imag( z ); +// returns 0.0 + +z = A.get( 1 ); +// returns + +re = real( z ); +// returns 3.0 + +im = imag( z ); +// returns 4.0 +``` + +
+ + + +
+ +## Notes + +- `zlaset()` corresponds to the [LAPACK][lapack] routine [`zlaset`][lapack-zlaset]. + +
+ + + +
+ +## Examples + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var zlaset = require( '@stdlib/lapack/base/zlaset' ); + +var shape = [ 5, 8 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var N = numel( shape ); + +var A = new Complex128Array( N ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset( order, 'all', shape[ 0 ], shape[ 1 ], alpha, beta, A, strides[ 0 ] ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.js new file mode 100644 index 000000000000..a169f03a8394 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +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 pkg = require( './../package.json' ).name; +var zlaset = require( './../lib/zlaset.js' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var beta; + var abuf; + var A; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + abuf = new Float64Array( N*N*2 ); + A = new Complex128Array( abuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zlaset( 'column-major', 'all', N, N, alpha, beta, A, N ); + if ( isnan( abuf[ i%abuf.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( abuf[ i%abuf.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+'::equidimensional:order=column-major,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..f1c535b69f60 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/benchmark/benchmark.ndarray.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +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 pkg = require( './../package.json' ).name; +var zlaset = require( './../lib/ndarray.js' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var alpha; + var beta; + var abuf; + var A; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + abuf = new Float64Array( N*N*2 ); + A = new Complex128Array( abuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zlaset( 'all', N, N, alpha, beta, A, 1, N, 0 ); + if ( isnan( abuf[ i%abuf.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( abuf[ i%abuf.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+'::equidimensional:ndarray:order=column-major,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/repl.txt new file mode 100644 index 000000000000..3e3c1767f725 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/repl.txt @@ -0,0 +1,113 @@ + +{{alias}}( order, uplo, M, N, alpha, beta, A, LDA ) + Sets the off-diagonal elements and the diagonal elements of a double- + precision complex floating-point matrix `A` to specified values. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether to copy the upper or lower triangular/trapezoidal part + of a matrix `A`. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + alpha: Complex128 + Value assigned to off-diagonal elements. + + beta: Complex128 + Value assigned to diagonal elements. + + A: Complex128Array + Input matrix `A`. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + Returns + ------- + A: Complex128Array + Input matrix. + + Examples + -------- + > var A = new {{alias:@stdlib/array/complex128}}( 4 ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 3.0, 4.0 ); + > {{alias}}( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); + > var z = A.get( 0 ); + > {{alias:@stdlib/complex/float64/real}}( z ) + 3.0 + > {{alias:@stdlib/complex/float64/imag}}( z ) + 4.0 + + +{{alias}}.ndarray( uplo, M, N, alpha, beta, A, sa1, sa2, oa ) + Sets the off-diagonal elements and the diagonal elements of a double- + precision complex floating-point matrix `A` to specified values using + alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameter supports indexing semantics based on a starting + index. + + Parameters + ---------- + uplo: string + Specifies whether to copy the upper or lower triangular/trapezoidal part + of a matrix `A`. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + alpha: Complex128 + Value assigned to off-diagonal elements. + + beta: Complex128 + Value assigned to diagonal elements. + + A: Complex128Array + Input matrix `A`. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + Returns + ------- + A: Complex128Array + Input matrix. + + Examples + -------- + > var A = new {{alias:@stdlib/array/complex128}}( 5 ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > var beta = new {{alias:@stdlib/complex/float64/ctor}}( 3.0, 4.0 ); + > {{alias}}.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 1 ); + > var z = A.get( 1 ); + > {{alias:@stdlib/complex/float64/real}}( z ) + 3.0 + > {{alias:@stdlib/complex/float64/imag}}( z ) + 4.0 + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/index.d.ts new file mode 100644 index 000000000000..5d067a66672b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/index.d.ts @@ -0,0 +1,127 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex128Array } from '@stdlib/types/array'; +import { Complex128 } from '@stdlib/types/complex'; +import { Layout } from '@stdlib/types/blas'; + +/** +* Interface describing `zlaset`. +*/ +interface Routine { + /** + * Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. + * + * @param order - storage layout of `A` + * @param uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` + * @param M - number of rows in matrix `A` + * @param N - number of columns in matrix `A` + * @param alpha - value assigned to off-diagonal elements + * @param beta - value assigned to diagonal elements + * @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 Complex128Array = require( '@stdlib/array/complex128' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var A = new Complex128Array( 4 ); + * + * var alpha = new Complex128( 1.0, 2.0 ); + * var beta = new Complex128( 3.0, 4.0 ); + * + * zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); + * // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] + */ + ( order: Layout, uplo: string, M: number, N: number, alpha: Complex128, beta: Complex128, A: Complex128Array, LDA: number ): Complex128Array; + + /** + * Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values using alternative indexing semantics. + * + * @param uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` + * @param M - number of rows in matrix `A` + * @param N - number of columns in matrix `A` + * @param alpha - value assigned to off-diagonal elements + * @param beta - value assigned to diagonal elements + * @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 Complex128Array = require( '@stdlib/array/float64' ); + * var Complex128 = require( '@stdlib/complex/float64/ctor' ); + * + * var A = new Complex128Array( 4 ); + * + * var alpha = new Complex128( 1.0, 2.0 ); + * var beta = new Complex128( 3.0, 4.0 ); + * + * zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 0 ); + * // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] + */ + ndarray( uplo: string, M: number, N: number, alpha: Complex128, beta: Complex128, A: Complex128Array, strideA1: number, strideA2: number, offsetA: number ): Complex128Array; +} + +/** +* Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. +* +* @param order - storage layout of `A` +* @param uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` +* @param M - number of rows in matrix `A` +* @param N - number of columns in matrix `A` +* @param alpha - value assigned to off-diagonal elements +* @param beta - value assigned to diagonal elements +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var A = new Complex128Array( 5 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset.ndarray( 'all', 2, 2, A, 2, 1, 1 ); +* // A => [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +*/ +declare var zlaset: Routine; + + +// EXPORTS // + +export = zlaset; diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/test.ts new file mode 100644 index 000000000000..57b1e7a37fa9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/docs/types/test.ts @@ -0,0 +1,348 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex128Array = require( '@stdlib/array/complex128' ); +import Complex128 = require( '@stdlib/complex/float64/ctor' ); +import zlaset = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 5, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( true, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( false, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( null, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( void 0, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( [], 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( {}, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( ( x: number ): number => x, 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 5, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', true, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', false, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', null, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', void 0, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', [], 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', {}, 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', ( x: number ): number => x, 2, 2, alpha, beta, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', '5', 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', true, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', false, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', null, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', void 0, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', [], 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', {}, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', ( x: number ): number => x, 2, alpha, beta, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', 2, '5', alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, true, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, false, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, null, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, void 0, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, [], alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, {}, alpha, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, ( x: number ): number => x, alpha, beta, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a complex number... +{ + const A = new Complex128Array( 4 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', 2, 2, '5', beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, 5, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, true, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, false, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, null, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, void 0, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, [], beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, {}, beta, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, ( x: number ): number => x, beta, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a complex number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + + zlaset( 'row-major', 'all', 2, 2, alpha, '5', A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, true, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, false, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, null, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, void 0, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, [], A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, {}, A, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, ( x: number ): number => x, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex128Array... +{ + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', 2, 2, alpha, beta, '5', 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, 5, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, true, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, false, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, null, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, void 0, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, [], 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, {}, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, ( x: number ): number => x, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, '5' ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, true ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, false ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, null ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, void 0 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, [] ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, {} ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset(); // $ExpectError + zlaset( 'row-major' ); // $ExpectError + zlaset( 'row-major', 'all' ); // $ExpectError + zlaset( 'row-major', 'all', 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2 ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A ); // $ExpectError + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2, 3 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a string... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 5, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( true, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( false, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( null, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( void 0, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( [], 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( {}, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( ( x: number ): number => x, 2, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', '5', 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', true, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', false, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', null, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', void 0, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', [], 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', {}, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', ( x: number ): number => x, 2, alpha, beta, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, '5', alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, true, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, false, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, null, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, void 0, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, [], alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, {}, alpha, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, ( x: number ): number => x, alpha, beta, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a complex number... +{ + const A = new Complex128Array( 4 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, '5', beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, 5, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, true, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, false, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, null, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, void 0, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, [], beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, {}, beta, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, ( x: number ): number => x, beta, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a complex number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, '5', A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, 5, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, true, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, false, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, null, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, void 0, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, [], A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, {}, A, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, ( x: number ): number => x, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Complex128Array... +{ + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, beta, '5', 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, 5, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, true, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, false, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, null, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, void 0, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, [], 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, {}, 2, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, '5', 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, true, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, false, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, null, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, void 0, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, [], 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, {}, 1, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, '5', 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, true, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, false, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, null, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, void 0, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, [], 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, {}, 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, '5' ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, true ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, false ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, null ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, void 0 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, [] ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, {} ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Complex128Array( 4 ); + const alpha = new Complex128( 1.0, 2.0 ); + const beta = new Complex128( 3.0, 4.0 ); + + zlaset.ndarray(); // $ExpectError + zlaset.ndarray( 'all' ); // $ExpectError + zlaset.ndarray( 'all', 2 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1 ); // $ExpectError + zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 0, 3 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/examples/index.js b/lib/node_modules/@stdlib/lapack/base/zlaset/examples/index.js new file mode 100644 index 000000000000..44e451212a05 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/examples/index.js @@ -0,0 +1,41 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var zlaset = require( './../lib' ); + +var shape = [ 5, 8 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var N = numel( shape ); + +var A = new Complex128Array( N ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var alpha = new Complex128( 1.0, 2.0 ); +var beta = new Complex128( 3.0, 4.0 ); + +zlaset( order, 'all', shape[ 0 ], shape[ 1 ], alpha, beta, A, strides[ 0 ] ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/lib/base.js b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/base.js new file mode 100644 index 000000000000..ab3937650535 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/base.js @@ -0,0 +1,630 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var min = require( '@stdlib/math/base/special/fast/min' ); + + +// FUNCTIONS // + +/** +* Sets the diagonal of a double-precision complex floating-point matrix `A` to a specified value. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {number} breal - real component of the value to assign to diagonal elements +* @param {number} bimag - imaginary component of the value to assign to diagonal elements +* @param {Float64Array} A - input matrix view +* @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 {Float64Array} `A` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); +* +* setDiagonal( 2, 3, 1.0, 2.0, A, 6, 2, 0 ); +* // A => [ 1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); +* +* setDiagonal( 2, 2, 1.0, 2.0, A, 4, 2, 0 ); +* // A => [ 1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); +* +* setDiagonal( 3, 2, 1.0, 2.0, A, 4, 2, 0 ); +* // A => [ 1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.0, 0.0, 0.0 ] +*/ +function setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ) { + var sa; + var ia; + var i; + + sa = strideA1 + strideA2; + ia = offsetA; + for ( i = 0; i < min( M, N ); i++ ) { + A[ ia ] = breal; + A[ ia+1 ] = bimag; + ia += sa; + } + return A; +} + +/** +* Sets all elements of a double-precision complex floating-point matrix `A` to specified values. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {number} areal - real component of the value to assign to off-diagonal elements +* @param {number} aimag - imaginary component of the value to assign to off-diagonal elements +* @param {number} breal - real component of the value to assign to diagonal elements +* @param {number} bimag - imaginary component of the value to assign to diagonal elements +* @param {Float64Array} A - input matrix view +* @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 {Float64Array} `A` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, 2, 0 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, -2, 2 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, 2, 4 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, -2, 6 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, 4, 0 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, 4, 2 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, -4, 4 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setAll( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, -4, 6 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 3.0, 4.0 ] +*/ +function setAll( M, N, areal, aimag, breal, bimag, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-len + var da0; + var da1; + var sh; + var S0; + var S1; + var sa; + var ia; + var i0; + var i1; + var o; + + // Resolve the loop interchange order: + o = loopOrder( [ M, N ], [ strideA1, strideA2 ] ); + sh = o.sh; + sa = o.sx; + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + da0 = sa[ 0 ]; + da1 = sa[ 1 ] - ( S0*sa[0] ); + + // Set the pointer to the first indexed element: + ia = offsetA; + + // Fill the array with a scalar value... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + A[ ia ] = areal; + A[ ia+1 ] = aimag; + ia += da0; + } + ia += da1; + } + // Replace the diagonal: + setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ); + + return A; +} + +/** +* Sets the upper triangular/trapezoidal part of a double-precision complex floating-point matrix `A` to specified values. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {number} areal - real component of the value to assign to off-diagonal elements +* @param {number} aimag - imaginary component of the value to assign to off-diagonal elements +* @param {number} breal - real component of the value to assign to diagonal elements +* @param {number} bimag - imaginary component of the value to assign to diagonal elements +* @param {Float64Array} A - input matrix view +* @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 {Float64Array} `A` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, 2, 0 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, -2, 2 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, 2, 4 ); +* // A => [ 0.0, 0.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, -2, 6 ); +* // A => [ 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, 4, 0 ); +* // A => [ 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, 4, 2 ); +* // A => [ 0.0, 0.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, -4, 4 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setUpper( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, -4, 6 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0 ] +*/ +function setUpper( M, N, areal, aimag, breal, bimag, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-len + var idx; + var ia; + var i0; + var i1; + + ia = offsetA; + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + for ( i1 = 0; i1 < M; i1++ ) { + idx = ia + ( i1*strideA2 ); + for ( i0 = i1; i0 < N; i0++ ) { + A[ idx ] = areal; + A[ idx+1 ] = aimag; + idx += strideA2; + } + ia += strideA1; + } + setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ); + return A; + } + for ( i1 = 0; i1 < N; i1++ ) { + idx = ia; + for ( i0 = 0; i0 <= min( i1, M-1 ); i0++ ) { + A[ idx ] = areal; + A[ idx+1 ] = aimag; + idx += strideA1; + } + ia += strideA2; + } + setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ); + return A; +} + +/** +* Sets the lower triangular/trapezoidal part of a double-precision complex floating-point matrix `A` to specified values. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {number} areal - real component of the value to assign to off-diagonal elements +* @param {number} aimag - imaginary component of the value to assign to off-diagonal elements +* @param {number} breal - real component of the value to assign to diagonal elements +* @param {number} bimag - imaginary component of the value to assign to diagonal elements +* @param {Float64Array} A - input matrix view +* @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 {Float64Array} `A` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, 2, 0 ); +* // A => [ 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 4, -2, 2 ); +* // A => [ 0.0, 0.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, 2, 4 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -4, -2, 6 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, 4, 0 ); +* // A => [ 3.0, 4.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, 4, 2 ); +* // A => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, 2, -4, 4 ); +* // A => [ 0.0, 0.0, 3.0, 4.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( 8 ); +* // returns [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* setLower( 2, 2, 1.0, 2.0, 3.0, 4.0, A, -2, -4, 6 ); +* // A => [ 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] +*/ +function setLower( M, N, areal, aimag, breal, bimag, A, strideA1, strideA2, offsetA ) { // eslint-disable-line max-len + var idx; + var ia; + var i0; + var i1; + + ia = offsetA; + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + for ( i1 = 0; i1 < M; i1++ ) { + idx = ia; + for ( i0 = 0; i0 <= min( i1, N-1 ); i0++ ) { + A[ idx ] = areal; + A[ idx+1 ] = aimag; + idx += strideA2; + } + ia += strideA1; + } + setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ); + return A; + } + for ( i1 = 0; i1 < N; i1++ ) { + idx = ia + ( i1*strideA1 ); + for ( i0 = i1; i0 < M; i0++ ) { + A[ idx ] = areal; + A[ idx+1 ] = aimag; + idx += strideA1; + } + ia += strideA2; + } + setDiagonal( M, N, breal, bimag, A, strideA1, strideA2, offsetA ); + return A; +} + + +// MAIN // + +/** +* Sets elements of matrix `A` to specified values. +* +* @private +* @param {string} uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {Complex128} alpha - value assigned to off-diagonal elements +* @param {Complex128} beta - value assigned to diagonal elements +* @param {Complex128Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @returns {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'all', 2, 2, alpha, beta, A, 2, 1, 0 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'upper', 2, 2, alpha, beta, A, 2, 1, 0 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'lower', 2, 2, alpha, beta, A, 2, 1, 0 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +*/ +function zlaset( uplo, M, N, alpha, beta, A, strideA1, strideA2, offsetA ) { + var viewA; + var ar; + var ai; + var br; + var bi; + + // Reinterpret the input array as a real-valued array of interleaved real and imaginary components: + viewA = reinterpret( A, 0 ); + + // Adjust the strides and offset accordingly: + strideA1 *= 2; + strideA2 *= 2; + + offsetA *= 2; + + // Decompose the scalars to real and imaginary components: + ar = real( alpha ); + ai = imag( alpha ); + br = real( beta ); + bi = imag( beta ); + + if ( uplo === 'upper' ) { + setUpper( M, N, ar, ai, br, bi, viewA, strideA1, strideA2, offsetA ); + } else if ( uplo === 'lower' ) { + setLower( M, N, ar, ai, br, bi, viewA, strideA1, strideA2, offsetA ); + } else { + setAll( M, N, ar, ai, br, bi, viewA, strideA1, strideA2, offsetA ); + } + return A; +} + + +// EXPORTS // + +module.exports = zlaset; diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/lib/index.js b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/index.js new file mode 100644 index 000000000000..1321adf90b15 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/index.js @@ -0,0 +1,94 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to set the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. +* +* @module @stdlib/lapack/base/zlaset +* +* @example +* var Complex128Array = require( '@stdlib/array/float64' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zlaset = require( '@stdlib/lapack/base/zlaset' ); +* +* var A = new Complex128Array( 4 ); +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ) +* // returns 4.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/float64' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zlaset = require( '@stdlib/lapack/base/zlaset' ); +* +* var A = new Complex128Array( 5 ); +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset.ndarray( 'all', 2, 2, alpha, beta, A, 2, 1, 1 ); +* +* var z = A.get( 1 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.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 zlaset; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + zlaset = main; +} else { + zlaset = tmp; +} + + +// EXPORTS // + +module.exports = zlaset; + +// exports: { "ndarray": "zlaset.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/lib/main.js b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/main.js new file mode 100644 index 000000000000..75aecdd63b25 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var zlaset = require( './zlaset.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( zlaset, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = zlaset; diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/ndarray.js new file mode 100644 index 000000000000..49a6ffe1360a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/ndarray.js @@ -0,0 +1,167 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var base = require( './base.js' ); + + +// MAIN // + +/** +* Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. +* +* @param {string} uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {Complex128} alpha - value assigned to off-diagonal elements +* @param {Complex128} beta - value assigned to diagonal elements +* @param {Complex128Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @returns {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 5 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'all', 2, 2, alpha, beta, A, 2, 1, 1 ); +* +* var z = A.get( 1 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 3 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 5 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'upper', 2, 2, alpha, beta, A, 2, 1, 1 ); +* +* var z = A.get( 1 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 3 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* +* var A = new Complex128Array( 5 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'lower', 2, 2, alpha, beta, A, 2, 1, 1 ); +* +* var z = A.get( 1 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* z = A.get( 3 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +*/ +function zlaset( uplo, M, N, alpha, beta, A, strideA1, strideA2, offsetA ) { + return base( uplo, M, N, alpha, beta, A, strideA1, strideA2, offsetA ); +} + + +// EXPORTS // + +module.exports = zlaset; diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/lib/zlaset.js b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/zlaset.js new file mode 100644 index 000000000000..d2a89594e7ab --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/lib/zlaset.js @@ -0,0 +1,187 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Sets the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values. +* +* @param {string} order - storage layout of `A` +* @param {string} uplo - specifies whether to set the upper or lower triangular/trapezoidal part of matrix `A` +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {Complex128} alpha - value assigned to off-diagonal elements +* @param {Complex128} beta - value assigned to diagonal elements +* @param {Complex128Array} A - input matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} eighth argument must be greater than or equal to `N` +* @returns {Complex128Array} `A` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, 2 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'row-major', 'upper', 2, 2, alpha, beta, A, 2 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var Complex128 = require( '@stdlib/complex/float64/ctor' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( 4 ); +* +* var alpha = new Complex128( 1.0, 2.0 ); +* var beta = new Complex128( 3.0, 4.0 ); +* +* zlaset( 'row-major', 'lower', 2, 2, alpha, beta, A, 2 ); +* +* var z = A.get( 0 ); +* // returns +* +* var re = real( z ); +* // returns 3.0 +* +* var im = imag( z ); +* // returns 4.0 +* +* z = A.get( 1 ); +* // returns +* +* re = real( z ); +* // returns 0.0 +* +* im = imag( z ); +* // returns 0.0 +* +* z = A.get( 2 ); +* // returns +* +* re = real( z ); +* // returns 1.0 +* +* im = imag( z ); +* // returns 2.0 +*/ +function zlaset( order, uplo, M, N, alpha, beta, A, LDA ) { + var sa1; + var sa2; + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( order === 'column-major' ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + if ( LDA < N ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to %d. Value: `%d`.', N, LDA ) ); + } + sa1 = LDA; + sa2 = 1; + } + return base( uplo, M, N, alpha, beta, A, sa1, sa2, 0 ); +} + + +// EXPORTS // + +module.exports = zlaset; diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/package.json b/lib/node_modules/@stdlib/lapack/base/zlaset/package.json new file mode 100644 index 000000000000..632bda7f1d59 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/lapack/base/zlaset", + "version": "0.0.0", + "description": "Set the off-diagonal elements and the diagonal elements of a double-precision complex floating-point matrix to specified values.", + "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", + "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", + "lapack", + "zlaset", + "copy", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array", + "complex", + "cmplx", + "complex128array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.js b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.js new file mode 100644 index 000000000000..b0dd34a7cda6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var zlaset = 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 zlaset, '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 zlaset.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 zlaset = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zlaset, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var zlaset; + var main; + + main = require( './../lib/zlaset.js' ); + + zlaset = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zlaset, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.ndarray.js new file mode 100644 index 000000000000..fbeb69a4ffd1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.ndarray.js @@ -0,0 +1,466 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var zlaset = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zlaset, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 9', function test( t ) { + t.strictEqual( zlaset.length, 9, 'returns expected value' ); + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var M; + var N; + var A; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + M = 2; + N = 3; + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 2, 3, alpha, beta, A, 3, 1, 1 ); + + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 2, 3, alpha, beta, A, -3, -1, 6 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 3, 2, alpha, beta, A, 2, 1, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, upper)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var M; + var N; + var A; + + M = 3; + N = 2; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + A = new Complex128Array( ( M * N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 2, 3, alpha, beta, A, 3, 1, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 2, 3, alpha, beta, A, 3, -1, 3 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, + 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 3, 2, alpha, beta, A, 2, 1, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, lower)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 2; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 2, 3, alpha, beta, A, 3, 1, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 2, 3, alpha, beta, A, -3, 1, 4 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 3, 2, alpha, beta, A, 2, 1, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 2; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'all', 3, 2, alpha, beta, A, 1, 3, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, upper)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 2; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'upper', 3, 2, alpha, beta, A, 1, 3, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, lower)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 2; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, + 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, + 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 2, 3, alpha, beta, A, 1, 2, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + A = new Complex128Array( ( M*N ) + 1 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 0.0, 0.0, + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'lower', 3, 2, alpha, beta, A, 1, 3, 1 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, lower, complex access patterns)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline, no-multi-spaces */ + + A = new Complex128Array([ + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999 + ]); + + expected = new Complex128Array([ + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, + 999, 999, 3, 4, 999, 999, 1, 2, 999, 999, 1, 2, + 999, 999, 1, 2, 999, 999, 3, 4, 999, 999, 1, 2, + 999, 999, 1, 2, 999, 999, 1, 2, 999, 999, 3, 4, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999 + ]); + + /* eslint-enable array-element-newline, no-multi-spaces */ + + out = zlaset( 'all', 3, 3, alpha, beta, A, 2, 6, 7 ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.zlaset.js b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.zlaset.js new file mode 100644 index 000000000000..bdf5290295fd --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlaset/test/test.zlaset.js @@ -0,0 +1,489 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var zlaset = require( './../lib/zlaset.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zlaset, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( zlaset.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var alpha; + var beta; + var A; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + A = new Complex128Array( 4 ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + 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() { + zlaset( value, 'all', 2, 2, alpha, beta, A, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument (row-major)', function test( t ) { + var values; + var alpha; + var beta; + var A; + var i; + + values = [ + 0, + 1 + ]; + + A = new Complex128Array( 4 ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.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() { + zlaset( 'row-major', 'all', 2, 2, alpha, beta, A, value ); + }; + } +}); + +tape( 'the function assigns values to matrix `A` (row-major, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'all', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'all', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, upper, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'upper', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, upper, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0, + 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'upper', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, lower, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'lower', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (row-major, lower, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'row-major', 'lower', M, N, alpha, beta, A, N ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'all', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'all', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, upper, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 1.0, 2.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'upper', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, upper, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 2.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'upper', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, lower, wide)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 3; + N = 4; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0, + 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'lower', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function assigns values to matrix `A` (column-major, lower, tall)', function test( t ) { + var expected; + var alpha; + var beta; + var out; + var A; + var M; + var N; + + M = 4; + N = 3; + + A = new Complex128Array( M*N ); + alpha = new Complex128( 1.0, 2.0 ); + beta = new Complex128( 3.0, 4.0 ); + + /* eslint-disable array-element-newline */ + expected = new Complex128Array([ + 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 3.0, 4.0, 1.0, 2.0, 1.0, 2.0, + 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 + ]); + + /* eslint-enable array-element-newline */ + + out = zlaset( 'column-major', 'lower', M, N, alpha, beta, A, M ); + t.strictEqual( out, A, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( out, expected ), true, 'returns expected value' ); + + t.end(); +});