diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/README.md b/lib/node_modules/@stdlib/lapack/base/zlacpy/README.md new file mode 100644 index 000000000000..05af4bb9c09a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/README.md @@ -0,0 +1,275 @@ + + +# zlacpy + +> Copy all or part of a matrix `A` to another matrix `B`. + +
+ +## Usage + +```javascript +var zlacpy = require( '@stdlib/lapack/base/zlacpy' ); +``` + +#### zlacpy( order, uplo, M, N, A, LDA, B, LDB ) + +Copies all or part of a matrix `A` to another matrix `B`. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); + +var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var B = new Complex128Array( 4 ); + +zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); + +var viewB = reinterpret( B, 0 ); +// returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether to copy the upper or lower triangular/trapezoidal part of a matrix `A`. +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **A**: input [`Complex128Array`][@stdlib/array/complex128]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). +- **B**: output [`Complex128Array`][@stdlib/array/complex128]. +- **LDB**: stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`). + +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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); + +// Initial arrays... +var A0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +var B0 = new Complex128Array( 5 ); + +// Create offset views... +var A1 = new Complex128Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var B1 = new Complex128Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +zlacpy( 'row-major', 'all', 2, 2, A1, 2, B1, 2 ); + +var viewB = reinterpret( B0, 0 ); +// returns [ 0.0, 0.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +``` + +#### zlacpy.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) + +Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); + +var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var B = new Complex128Array( 4 ); + +zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); + +var viewB = reinterpret( B, 0 ); +// returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] +``` + +The function has the following parameters: + +- **uplo**: specifies whether to copy the upper or lower triangular/trapezoidal part of a matrix `A`. +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **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`. +- **B**: output [`Complex128Array`][@stdlib/array/complex128]. +- **sb1**: stride of the first dimension of `B`. +- **sb2**: stride of the second dimension of `B`. +- **ob**: starting index for `B`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); + +var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +var B = new Complex128Array( 6 ); + +zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); + +var viewB = reinterpret( B, 0 ); +// returns [ 0.0, 0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] +``` + +
+ + + +
+ +## Notes + +- `zlacpy()` corresponds to the [LAPACK][lapack] routine [`zlacpy`][lapack-zlacpy]. + +
+ + + +
+ +## Examples + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var uniform = require( '@stdlib/random/array/discrete-uniform' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var zlacpy = require( '@stdlib/lapack/base/zlacpy' ); + +var shape = [ 5, 8 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var N = numel( shape ); + +var A = new Complex128Array( uniform( 2*N, -10, 10, { + 'dtype': 'generic' +})); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var B = new Complex128Array( uniform( 2*N, -10, 10, { + 'dtype': 'generic' +})); +console.log( ndarray2array( B, shape, strides, 0, order ) ); + +zlacpy( order, 'all', shape[ 0 ], shape[ 1 ], A, strides[ 0 ], B, strides[ 0 ] ); +console.log( ndarray2array( B, 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/zlacpy/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/benchmark/benchmark.js new file mode 100644 index 000000000000..ad44b061ffa6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/benchmark/benchmark.js @@ -0,0 +1,106 @@ +/** +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var zlacpy = require( './../lib/zlacpy.js' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var opts; + var A; + var B; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( 2*N*N, -10.0, 10.0, opts ) ); + B = new Complex128Array( uniform( 2*N*N, -10.0, 10.0, opts ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = zlacpy( 'column-major', 'all', N, N, A, N, B, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var 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+':order=column-major,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..52cd7ae0379b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/benchmark/benchmark.ndarray.js @@ -0,0 +1,106 @@ +/** +* @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 Complex128Array = require( '@stdlib/array/complex128' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var zlacpy = 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 opts; + var A; + var B; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( 2*N*N, -10.0, 10.0, opts ) ); + B = new Complex128Array( uniform( 2*N*N, -10.0, 10.0, opts ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = zlacpy( 'all', N, N, A, 1, N, 0, B, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var 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+':ndarray:order=column-major,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/repl.txt new file mode 100644 index 000000000000..131b8e15583b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/repl.txt @@ -0,0 +1,120 @@ + +{{alias}}( order, uplo, M, N, A, LDA, B, LDB ) + Copies all or part of a matrix `A` to another matrix `B`. + + 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`. + + A: Complex128Array + Input matrix `A`. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + B: Complex128Array + Output matrix `B`. + + LDB: integer + Stride of the first dimension of `B` (a.k.a., leading dimension of the + matrix `B`). + + Returns + ------- + B: Complex128Array + Output matrix. + + Examples + -------- + > var abuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]; + > var bbuf = [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ]; + > var A = new {{alias:@stdlib/array/complex128}}( abuf ); + > var B = new {{alias:@stdlib/array/complex128}}( bbuf ); + > {{alias}}( 'row-major', 'all', 2, 2, A, 2, B, 2 ); + > var z = B.get( 0 ); + > {{alias:@stdlib/complex/float64/real}}( z ) + 1.0 + > {{alias:@stdlib/complex/float64/imag}}( z ) + 2.0 + + +{{alias}}.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) + Copies all or part of a matrix `A` to another matrix `B` using alternative + indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + 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`. + + 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`. + + B: Complex128Array + Output matrix `B`. + + sb1: integer + Stride of the first dimension of `B`. + + sb2: integer + Stride of the second dimension of `B`. + + ob: integer + Starting index for `B`. + + Returns + ------- + B: Complex128Array + Output matrix. + + Examples + -------- + > var abuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ]; + > var bbuf = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + > var A = new {{alias:@stdlib/array/complex128}}( abuf ); + > var B = new {{alias:@stdlib/array/complex128}}( bbuf ); + > {{alias}}.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); + > var z = B.get( 2 ); + > {{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/zlacpy/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/types/index.d.ts new file mode 100644 index 000000000000..44091c88601d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/types/index.d.ts @@ -0,0 +1,158 @@ +/* +* @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 { Layout } from '@stdlib/types/blas'; +import { Complex128Array } from '@stdlib/types/array'; + +/** +* Interface describing `zlacpy`. +*/ +interface Routine { + /** + * Copies all or part of a matrix `A` to another matrix `B`. + * + * @param order - storage layout of `A` and `B` + * @param uplo - specifies whether to copy 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 A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param B - output matrix + * @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) + * @returns `B` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + * var B = new Complex128Array( 4 ); + * + * zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); + * + * var z = B.get( 0 ); + * // returns + * + * var v = real( z ); + * // returns 1.0 + * + * v = imag( z ); + * // returns 2.0 + */ + ( order: Layout, uplo: string, M: number, N: number, A: Complex128Array, LDA: number, B: Complex128Array, LDB: number ): Complex128Array; + + /** + * Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics. + * + * @param uplo - specifies whether to copy 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 A - input matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index for `A` + * @param B - output matrix + * @param strideB1 - stride of the first dimension of `B` + * @param strideB2 - stride of the second dimension of `B` + * @param offsetB - starting index for `B` + * @returns `B` + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * var real = require( '@stdlib/complex/float64/real' ); + * var imag = require( '@stdlib/complex/float64/imag' ); + * + * var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); + * var B = new Complex128Array( 12 ); + * + * zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); + * + * var z = B.get( 2 ); + * // returns + * + * var v = real( z ); + * // returns 3.0 + * + * v = imag( z ); + * // returns 4.0 + */ + ndarray( uplo: string, M: number, N: number, A: Complex128Array, strideA1: number, strideA2: number, offsetA: number, B: Complex128Array, strideB1: number, strideB2: number, offsetB: number ): Complex128Array; +} + +/** +* Copies all or part of a matrix `A` to another matrix `B`. +* +* @param order - storage layout of `A` and `B` +* @param uplo - specifies whether to copy 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 A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param B - output matrix +* @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) +* @returns `B` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +* var B = new Complex128Array( 12 ); +* +* zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); +* +* var z = B.get( 2 ); +* // returns +* +* var v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +*/ +declare var zlacpy: Routine; + + +// EXPORTS // + +export = zlacpy; diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/types/test.ts new file mode 100644 index 000000000000..a18f5b3ac71a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/docs/types/test.ts @@ -0,0 +1,359 @@ +/* +* @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 zlacpy = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 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( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 5, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( true, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( false, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( null, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( void 0, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( [], 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( {}, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( ( x: number ): number => x, 'all', 2, 2, A, 2, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 5, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', true, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', false, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', null, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', void 0, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', [], 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', {}, 2, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', ( x: number ): number => x, 2, 2, A, 2, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', '5', 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', true, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', false, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', null, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', void 0, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', [], 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', {}, 2, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', ( x: number ): number => x, 2, A, 2, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', 2, '5', A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, true, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, false, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, null, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, void 0, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, [], A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, {}, A, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, ( x: number ): number => x, A, 2, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Complex128Array... +{ + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', 2, 2, '5', 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, 5, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, true, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, false, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, null, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, void 0, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, [], 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, {}, 2, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, ( x: number ): number => x, 2, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', 2, 2, A, '5', B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, true, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, false, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, null, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, void 0, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, [], B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, {}, B, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, ( x: number ): number => x, B, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Complex128Array... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + zlacpy( 'row-major', 'all', 2, 2, A, 2, '5', 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, 5, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, true, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, false, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, null, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, void 0, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, [], 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, {}, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, ( 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( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, '5' ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, true ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, false ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, null ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, void 0 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, [] ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, {} ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy(); // $ExpectError + zlacpy( 'row-major' ); // $ExpectError + zlacpy( 'row-major', 'all' ); // $ExpectError + zlacpy( 'row-major', 'all', 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2 ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B ); // $ExpectError + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex128Array... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 5, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( true, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( false, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( null, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( void 0, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( [], 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( {}, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( ( x: number ): number => x, 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', '5', 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', true, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', false, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', null, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', void 0, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', [], 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', {}, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', ( x: number ): number => x, 2, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, '5', A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, true, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, false, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, null, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, void 0, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, [], A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, {}, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, ( x: number ): number => x, A, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex128Array... +{ + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, '5', 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, 5, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, true, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, false, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, null, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, void 0, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, [], 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, {}, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, ( x: number ): number => x, 2, 1, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, '5', 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, true, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, false, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, null, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, void 0, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, [], 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, {}, 1, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, ( x: number ): number => x, 1, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, '5', 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, true, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, false, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, null, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, void 0, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, [], 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, {}, 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, ( x: number ): number => x, 0, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, '5', B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, true, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, false, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, null, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, void 0, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, [], B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, {}, B, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, ( x: number ): number => x, B, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Complex128Array... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, '5', 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, 5, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, true, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, false, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, null, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, void 0, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, [], 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, {}, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, '5', 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, true, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, false, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, null, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, void 0, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, [], 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, {}, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, '5', 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, true, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, false, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, null, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, void 0, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, [], 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, {}, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, '5' ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, true ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, false ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, null ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, void 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, [] ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, {} ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 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( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + const B = new Complex128Array( 4 ); + + zlacpy.ndarray(); // $ExpectError + zlacpy.ndarray( 'all' ); // $ExpectError + zlacpy.ndarray( 'all', 2 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1 ); // $ExpectError + zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/examples/index.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/examples/index.js new file mode 100644 index 000000000000..8830534f3d0f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/examples/index.js @@ -0,0 +1,45 @@ +/** +* @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 ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var uniform = require( '@stdlib/random/array/discrete-uniform' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var dlacpy = require( './../lib' ); + +var shape = [ 5, 8 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var N = numel( shape ); + +var A = new Complex128Array( uniform( 2*N, -10, 10, { + 'dtype': 'float64' +})); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var B = new Complex128Array( uniform( 2*N, -10, 10, { + 'dtype': 'float64' +})); +console.log( ndarray2array( B, shape, strides, 0, order ) ); + +dlacpy( order, 'all', shape[ 0 ], shape[ 1 ], A, strides[ 0 ], B, strides[ 0 ] ); +console.log( ndarray2array( B, shape, strides, 0, order ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/base.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/base.js new file mode 100644 index 000000000000..d974bdeaa162 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/base.js @@ -0,0 +1,614 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var loopOrder = require( '@stdlib/ndarray/base/unary-loop-interchange-order' ); +var min = require( '@stdlib/math/base/special/fast/min' ); + + +// FUNCTIONS // + +/** +* Copies all of a matrix `A` to another matrix `B`. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @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` +* @param {Float64Array} B - output matrix view +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Float64Array} `B` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, 4, 2, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, 4, -2, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 1.0, 2.0, 7.0, 8.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, -4, 2, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 7.0, 8.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, -4, -2, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 5.0, 6.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, 2, 4, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 5.0, 6.0, 3.0, 4.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, -2, 4, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 7.0, 8.0, 1.0, 2.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, 2, -4, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 1.0, 2.0, 7.0, 8.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyAll( 2, 2, A, -2, -4, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 3.0, 4.0, 5.0, 6.0, 1.0, 2.0 ] +*/ +function copyAll( M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { + var da0; + var da1; + var db0; + var db1; + var sh; + var S0; + var S1; + var sa; + var sb; + var ia; + var ib; + var i0; + var i1; + var o; + + // Resolve the loop interchange order: + o = loopOrder( [ M, N ], [ strideA1, strideA2 ], [ strideB1, strideB2 ] ); + sh = o.sh; + sa = o.sx; + sb = o.sy; + + // 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] ); + db0 = sb[ 0 ]; + db1 = sb[ 1 ] - ( S0*sb[0] ); + + // Set the pointers to the first indexed elements in the respective matrices... + ia = offsetA; + ib = offsetB; + + // Iterate over the matrix dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + B[ ib ] = A[ ia ]; + B[ ib+1 ] = A[ ia+1 ]; + ia += da0; + ib += db0; + } + ia += da1; + ib += db1; + } + return B; +} + +/** +* Copies the upper triangular/trapezoidal part of a matrix `A` to another matrix `B`. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @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` +* @param {Float64Array} B - output matrix view +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Float64Array} `B` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, 4, 2, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, 4, -2, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 1.0, 2.0, 0.0, 0.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, -4, 2, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 7.0, 8.0, 0.0, 0.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, -4, -2, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 5.0, 6.0, 0.0, 0.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, 2, 4, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 5.0, 6.0, 0.0, 0.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, -2, 4, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 7.0, 8.0, 0.0, 0.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, 2, -4, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 1.0, 2.0, 0.0, 0.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyUpper( 2, 2, A, -2, -4, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0 ] +*/ +function copyUpper( M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { + var ia; + var ib; + var i0; + var i1; + var ja; + var jb; + + ia = offsetA; + ib = offsetB; + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + for ( i1 = 0; i1 < M; i1++ ) { + ja = ia + ( i1*strideA2 ); + jb = ib + ( i1*strideB2 ); + for ( i0 = i1; i0 < N; i0++ ) { + B[ jb ] = A[ ja ]; + B[ jb+1 ] = A[ ja+1 ]; + ja += strideA2; + jb += strideB2; + } + ia += strideA1; + ib += strideB1; + } + return B; + } + for ( i1 = 0; i1 < N; i1++ ) { + jb = ib; + ja = ia; + for ( i0 = 0; i0 <= min( i1, M-1 ); i0++ ) { + B[ jb ] = A[ ja ]; + B[ jb+1 ] = A[ ja+1 ]; + ja += strideA1; + jb += strideB1; + } + ia += strideA2; + ib += strideB2; + } + return B; +} + +/** +* Copies the lower triangular/trapezoidal part of a matrix `A` to another matrix `B`. +* +* @private +* @param {NonNegativeInteger} M - number of rows in matrix `A` +* @param {NonNegativeInteger} N - number of columns in matrix `A` +* @param {Float64Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} B - output matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Float64Array} `B` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, 4, 2, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 0.0, 0.0, 5.0, 6.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, 4, -2, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 0.0, 0.0, 7.0, 8.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, -4, 2, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, -4, -2, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 0.0, 0.0, 3.0, 4.0, 1.0, 2.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, 2, 4, 0, B, 4, 2, 0 ); +* // B => [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 7.0, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, -2, 4, 2, B, 4, 2, 0 ); +* // B => [ 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, 2, -4, 4, B, 4, 2, 0 ); +* // B => [ 5.0, 6.0, 0.0, 0.0, 7.0, 8.0, 3.0, 4.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Float64Array( 8 ); +* +* copyLower( 2, 2, A, -2, -4, 6, B, 4, 2, 0 ); +* // B => [ 7.0, 8.0, 0.0, 0.0, 5.0, 6.0, 1.0, 2.0 ] +*/ +function copyLower( M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { + var ia; + var ib; + var i0; + var i1; + var ja; + var jb; + + ia = offsetA; + ib = offsetB; + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + for ( i1 = 0; i1 < M; i1++ ) { + ja = ia; + jb = ib; + for ( i0 = 0; i0 <= min( i1, N-1 ); i0++ ) { + B[ jb ] = A[ ja ]; + B[ jb+1 ] = A[ ja+1 ]; + ja += strideA2; + jb += strideB2; + } + ia += strideA1; + ib += strideB1; + } + return B; + } + for ( i1 = 0; i1 < N; i1++ ) { + ja = ia + ( i1*strideA1 ); + jb = ib + ( i1*strideB1 ); + for ( i0 = i1; i0 < M; i0++ ) { + B[ jb ] = A[ ja ]; + B[ jb+1 ] = A[ ja+1 ]; + ja += strideA1; + jb += strideB1; + } + ia += strideA2; + ib += strideB2; + } + return B; +} + + +// MAIN // + +/** +* Copies all or part of a matrix `A` to another matrix `B`. +* +* @private +* @param {string} uplo - specifies whether to copy 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 {Complex128Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Complex128Array} B - output matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Complex128Array} `B` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'all', 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* z = B.get( 1 ); +* // returns +* +* v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +* +* z = B.get( 2 ); +* // returns +* +* v = real( z ); +* // returns 5.0 +* +* v = imag( z ); +* // returns 6.0 +* +* z = B.get( 3 ); +* // returns +* +* v = real( z ); +* // returns 7.0 +* +* v = imag( z ); +* // returns 8.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'upper', 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); +* // B => +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* z = B.get( 1 ); +* // returns +* +* v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +* +* z = B.get( 2 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +* +* z = B.get( 3 ); +* // returns +* +* v = real( z ); +* // returns 7.0 +* +* v = imag( z ); +* // returns 8.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'lower', 2, 2, A, 2, 1, 0, B, 2, 1, 0 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* z = B.get( 1 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +* +* z = B.get( 2 ); +* // returns +* +* v = real( z ); +* // returns 5.0 +* +* v = imag( z ); +* // returns 6.0 +* +* z = B.get( 3 ); +* // returns +* +* v = real( z ); +* // returns 7.0 +* +* v = imag( z ); +* // returns 8.0 +*/ +function zlacpy( uplo, M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { + var viewA; + var viewB; + + // Reinterpret the input and output arrays as real-valued arrays of interleaved real and imaginary components: + viewA = reinterpret( A, 0 ); + viewB = reinterpret( B, 0 ); + + // Adjust the strides and offsets accordingly: + strideA1 *= 2; + strideA2 *= 2; + strideB1 *= 2; + strideB2 *= 2; + + offsetA *= 2; + offsetB *= 2; + + if ( uplo === 'upper' ) { + copyUpper( M, N, viewA, strideA1, strideA2, offsetA, viewB, strideB1, strideB2, offsetB ); + } else if ( uplo === 'lower' ) { + copyLower( M, N, viewA, strideA1, strideA2, offsetA, viewB, strideB1, strideB2, offsetB ); + } else { + copyAll( M, N, viewA, strideA1, strideA2, offsetA, viewB, strideB1, strideB2, offsetB ); + } + return B; +} + + +// EXPORTS // + +module.exports = zlacpy; diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/index.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/index.js new file mode 100644 index 000000000000..1b4e0a1b3328 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/index.js @@ -0,0 +1,90 @@ +/** +* @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 copy all or part of a matrix `A` to another matrix `B`. +* +* @module @stdlib/lapack/base/zlacpy +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zlacpy = require( '@stdlib/lapack/base/zlacpy' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* var zlacpy = require( '@stdlib/lapack/base/zlacpy' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +* var B = new Complex128Array( 12 ); +* +* zlacpy.ndarray( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); +* +* var z = B.get( 2 ); +* // returns +* +* var v = real( z ); +* // returns 3.0 +* +* v = 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 zlacpy; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + zlacpy = main; +} else { + zlacpy = tmp; +} + + +// EXPORTS // + +module.exports = zlacpy; + +// exports: { "ndarray": "zlacpy.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/main.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/main.js new file mode 100644 index 000000000000..1a9441000e87 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/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 zlacpy = require( './zlacpy.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( zlacpy, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = zlacpy; diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/ndarray.js new file mode 100644 index 000000000000..c0336a8f34bb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/ndarray.js @@ -0,0 +1,126 @@ +/** +* @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 // + +/** +* Copies all or part of a matrix `A` to another matrix `B` using alternative indexing semantics. +* +* @param {string} uplo - specifies whether to copy 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 {Complex128Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Complex128Array} B - output matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Complex128Array} `B` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +* var B = new Complex128Array( 12 ); +* +* zlacpy( 'all', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); +* +* var z = B.get( 2 ); +* // returns +* +* var v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +* var B = new Complex128Array( 12 ); +* +* zlacpy( 'upper', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); +* +* var z = B.get( 2 ); +* // returns +* +* var v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +* +* z = B.get( 4 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 ] ); +* var B = new Complex128Array( 12 ); +* +* zlacpy( 'lower', 2, 2, A, 2, 1, 1, B, 2, 1, 2 ); +* +* var z = B.get( 2 ); +* // returns +* +* var v = real( z ); +* // returns 3.0 +* +* v = imag( z ); +* // returns 4.0 +* +* z = B.get( 1 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +*/ +function zlacpy( uplo, M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { // eslint-disable-line max-len, max-params + return base( uplo, M, N, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = zlacpy; diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/zlacpy.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/zlacpy.js new file mode 100644 index 000000000000..9573118e2ea2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/lib/zlacpy.js @@ -0,0 +1,152 @@ +/** +* @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 // + +/** +* Copies all or part of a matrix `A` to another matrix `B`. +* +* @param {string} order - storage layout of `A` and `B` +* @param {string} uplo - specifies whether to copy 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 {Complex128Array} A - input matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Complex128Array} B - output matrix +* @param {PositiveInteger} LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} sixth argument must be greater than or equal to `N` +* @throws {RangeError} eighth argument must be greater than or equal to `N` +* @returns {Complex128Array} `B` +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'row-major', 'all', 2, 2, A, 2, B, 2 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'row-major', 'upper', 2, 2, A, 2, B, 2 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* z = B.get( 2 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var real = require( '@stdlib/complex/float64/real' ); +* var imag = require( '@stdlib/complex/float64/imag' ); +* +* var A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var B = new Complex128Array( 4 ); +* +* zlacpy( 'row-major', 'lower', 2, 2, A, 2, B, 2 ); +* +* var z = B.get( 0 ); +* // returns +* +* var v = real( z ); +* // returns 1.0 +* +* v = imag( z ); +* // returns 2.0 +* +* z = B.get( 1 ); +* // returns +* +* v = real( z ); +* // returns 0.0 +* +* v = imag( z ); +* // returns 0.0 +*/ +function zlacpy( order, uplo, M, N, A, LDA, B, LDB ) { + var sa1; + var sa2; + var sb1; + var sb2; + 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; + sb1 = 1; + sb2 = LDB; + } else { // order === 'row-major' + if ( LDA < N ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be greater than or equal to %d. Value: `%d`.', N, LDA ) ); + } + if ( LDB < N ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to %d. Value: `%d`.', N, LDB ) ); + } + sa1 = LDA; + sa2 = 1; + sb1 = LDB; + sb2 = 1; + } + return base( uplo, M, N, A, sa1, sa2, 0, B, sb1, sb2, 0 ); +} + + +// EXPORTS // + +module.exports = zlacpy; diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/package.json b/lib/node_modules/@stdlib/lapack/base/zlacpy/package.json new file mode 100644 index 000000000000..78cd5c64976a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/lapack/base/zlacpy", + "version": "0.0.0", + "description": "Copy all or part of a matrix A to another matrix B.", + "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", + "zlacpy", + "copy", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "complex128", + "complex128array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.js new file mode 100644 index 000000000000..5c5fb7c1ff25 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/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 zlacpy = 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 zlacpy, '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 zlacpy.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 zlacpy = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zlacpy, 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 zlacpy; + var main; + + main = require( './../lib/zlacpy.js' ); + + zlacpy = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zlacpy, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.ndarray.js new file mode 100644 index 000000000000..d1d2bad06c70 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.ndarray.js @@ -0,0 +1,270 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var zlacpy = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zlacpy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( zlacpy.length, 11, 'returns expected value' ); + t.end(); +}); + +tape( 'the function copies all of a matrix `A` to another matrix `B` (row-major)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0] ); + + out = zlacpy( 'all', 2, 3, A, 3, 1, 1, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.0, 23.0, 20.0, 21.0, 18.0, 19.0, 16.0, 17.0, 14.0, 15.0, 12.0, 13.0 ] ); + + out = zlacpy( 'all', 2, 3, A, -3, -1, 6, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'all', 3, 2, A, 2, 1, 1, B, 2, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies part of a matrix `A` to another matrix `B` (row-major, upper)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 0.0, 0.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'upper', 2, 3, A, 3, 1, 1, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.0, 23.0, 20.0, 21.0, 18.0, 19.0, 0.0, 0.0, 14.0, 15.0, 12.0, 13.0 ] ); + + out = zlacpy( 'upper', 2, 3, A, -3, -1, 6, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 0.0, 0.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0 ] ); + + out = zlacpy( 'upper', 3, 2, A, 2, 1, 1, B, 2, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok(isSameComplex128Array(out, expected), 'returns expected value'); + + t.end(); +}); + +tape( 'the function copies part of a matrix `A` to another matrix `B` (row-major, lower)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 0.0, 0.0, 0.0, 0.0, 18.0, 19.0, 20.0, 21.0, 0.0, 0.0 ] ); + + out = zlacpy( 'lower', 2, 3, A, 3, 1, 1, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok(isSameComplex128Array(out, expected), 'returns expected value'); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 0.0, 0.0 ] ); + + out = zlacpy( 'lower', 2, 3, A, -3, 1, 4, B, 3, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 0.0, 0.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'lower', 3, 2, A, 2, 1, 1, B, 2, 1, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + t.end(); +}); +tape( 'the function copies all of a matrix `A` to another matrix `B` (column-major)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'all', 2, 3, A, 1, 2, 1, B, 1, 2, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.0, 23.0, 20.0, 21.0, 18.0, 19.0, 16.0, 17.0, 14.0, 15.0, 12.0, 13.0 ] ); + + out = zlacpy( 'all', 2, 3, A, 1, 2, 1, B, -1, -2, 8 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'all', 3, 2, A, 1, 3, 1, B, 1, 3, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies part of a matrix `A` to another matrix `B` (column-major, upper)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 0.0, 0.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'upper', 2, 3, A, 1, 2, 1, B, 1, 2, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 18.0, 19.0, 16.0, 17.0, 22.0, 23.0, 20.0, 21.0 ] ); + + out = zlacpy( 'upper', 2, 3, A, 1, 2, 1, B, -1, 2, 4 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 0.0, 0.0, 0.0, 0.0, 18.0, 19.0, 20.0, 21.0, 0.0, 0.0 ] ); + + out = zlacpy( 'upper', 3, 2, A, 1, 3, 1, B, 1, 3, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies part of a matrix `A` to another matrix `B` (column-major, lower)', function test( t ) { + var expected; + var out; + var A; + var B; + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 0.0, 0.0, 18.0, 19.0, 0.0, 0.0, 0.0, 0.0 ] ); + + out = zlacpy( 'lower', 2, 3, A, 1, 2, 1, B, 1, 2, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 18.0, 19.0, 12.0, 13.0, 14.0, 15.0 ] ); + + out = zlacpy( 'lower', 2, 3, A, 1, 2, 1, B, 1, -2, 7 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + A = new Complex128Array( [ 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0 ] ); + B = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + expected = new Complex128Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 0.0, 0.0, 20.0, 21.0, 22.0, 23.0 ] ); + + out = zlacpy( 'lower', 3, 2, A, 1, 3, 1, B, 1, 3, 3 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, expected ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies all of a matrix `A` to another matrix `B` (column-major, lower, complex access patterns)', function test( t ) { + var out; + var A; + var B; + + /* 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, 1, 2, 999, 999, 3, 4, 999, 999, 5, 6, + 999, 999, 7, 8, 999, 999, 9, 10, 999, 999, 11, 12, + 999, 999, 13, 14, 999, 999, 15, 16, 999, 999, 17, 18, + 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999 + ]); + B = 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 + ]); + + /* eslint-enable array-element-newline, no-multi-spaces */ + + out = zlacpy( 'all', 3, 3, A, 2, 6, 7, B, 2, 6, 7 ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.zlacpy.js b/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.zlacpy.js new file mode 100644 index 000000000000..e39ab1ad798d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/zlacpy/test/test.zlacpy.js @@ -0,0 +1,283 @@ +/** +* @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 uniform = require( '@stdlib/random/array/uniform' ); +var zlacpy = require( './../lib/zlacpy.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zlacpy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( zlacpy.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 A; + var B; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + B = new Complex128Array( 4 ); + + 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() { + zlacpy( value, 'all', 2, 2, A, 2, B, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument (row-major)', function test( t ) { + var values; + var A; + var B; + var i; + + values = [ + 0, + 1 + ]; + + A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + B = new Complex128Array( 4 ); + + 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() { + zlacpy( 'row-major', 'all', 2, 2, A, value, B, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth argument (row-major)', function test( t ) { + var values; + var A; + var B; + var i; + + values = [ + 0, + 1 + ]; + + A = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + B = new Complex128Array( 4 ); + + 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() { + zlacpy( 'row-major', 'all', 2, 2, A, 2, B, value ); + }; + } +}); + +tape( 'the function copies all of a matrix `A` to another matrix `B` (row-major)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'row-major', 'all', M, N, A, N, B, N ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies a part of a matrix `A` to another matrix `B` (row-major, upper)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'row-major', 'lower', M, N, A, N, B, N ); + t.strictEqual( out, B, 'returns expected value' ); + + out = zlacpy( 'row-major', 'upper', M, N, A, N, B, N ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies a part of a matrix `A` to another matrix `B` (row-major, lower)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'row-major', 'upper', M, N, A, N, B, N ); + t.strictEqual( out, B, 'returns expected value' ); + + out = zlacpy( 'row-major', 'lower', M, N, A, N, B, N ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies all of a matrix `A` to another matrix `B` (column-major)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'column-major', 'all', M, N, A, M, B, M ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies a part of a matrix `A` to another matrix `B` (column-major, upper)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'column-major', 'lower', M, N, A, M, B, M ); + t.strictEqual( out, B, 'returns expected value' ); + + out = zlacpy( 'column-major', 'upper', M, N, A, M, B, M ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function copies a part of a matrix `A` to another matrix `B` (column-major, lower)', function test( t ) { + var opts; + var out; + var A; + var B; + var M; + var N; + + M = 5; + N = 8; + + opts = { + 'dtype': 'float64' + }; + + A = new Complex128Array( uniform( M*N*2, -10.0, 10.0, opts ) ); + B = new Complex128Array( M*N ); + + out = zlacpy( 'column-major', 'upper', M, N, A, M, B, M ); + t.strictEqual( out, B, 'returns expected value' ); + + out = zlacpy( 'column-major', 'lower', M, N, A, M, B, M ); + t.strictEqual( out, B, 'returns expected value' ); + t.ok( isSameComplex128Array( out, A ), 'returns expected value' ); + + t.end(); +});