diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/README.md b/lib/node_modules/@stdlib/blas/base/dtrsv/README.md new file mode 100644 index 00000000000..acc57ba98ce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/README.md @@ -0,0 +1,259 @@ + + +# dtrsv + +> Solve one of the systems of equations `A*x = b` or `A^T*x = b`. + +
+ +## Usage + +```javascript +var dtrsv = require( '@stdlib/blas/base/dtrsv' ); +``` + +#### dtrsv( order, uplo, trans, diag, N, A, LDA, x, sx ) + +Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 ); +// x => [ 0.0, -4.0, 3.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether `A` is an upper or lower triangular matrix. +- **trans**: specifies whether `A` should be transposed, conjugate-transposed, or not transposed. +- **diag**: specifies whether `A` has a unit diagonal. +- **N**: number of elements along each dimension of `A`. +- **A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array]. +- **lda**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). +- **x**: input vector [`Float64Array`][mdn-float64array]. +- **sx**: `x` stride length. + +The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order, + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +var x = new Float64Array( [ 3.0, 2.0, 1.0 ] ); + +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, -1 ); +// x => [ 3.0, -4.0, 0.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var x0 = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); + +// Create offset views... +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x1, 1 ); +// x0 => [ 1.0, 0.0, -1.0, 1.0 ] +``` + +#### dtrsv.ndarray( uplo, trans, diag, N, A, sa1, sa2, oa, x, sx, ox ) + +Solves one of the systems of equations `A*x = b` or `A^T*x = b`, using alternative indexing semantics and where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); +// x => [ 0.0, -4.0, 3.0 ] +``` + +The function has the following additional parameters: + +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. +- **ox**: starting index for `x`. + +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 Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +var x = new Float64Array( [ 3.0, 2.0, 1.0 ] ); + +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, -1, 2 ); +// x => [ 3.0, -4.0, 0.0 ] +``` + +
+ + + +
+ +## Notes + +- `dtrsv()` corresponds to the [BLAS][blas] level 2 function [`dtrsv`][blas-dtrsv]. +- Neither routine tests for singularity or near-singularity. Such tests must be performed before calling the routines. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var dtrsv = require( '@stdlib/blas/base/dtrsv' ); + +var opts = { + 'dtype': 'float64' +}; + +var N = 5; + +var A = discreteUniform( N*N, -10.0, 10.0, opts ); +var x = discreteUniform( N, -10.0, 10.0, opts ); + +dtrsv( 'column-major', 'upper', 'no-transpose', 'unit', N, A, N, x, 1 ); +console.log( x ); + +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', N, A, 1, N, 0, x, 1, 0 ); +console.log( x ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.js new file mode 100644 index 00000000000..4c3cf8cbe0c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dtrsv = require( './../lib/dtrsv.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = discreteUniform( N*N, -10.0, 10.0, options ); + var x = zeros( N, options.dtype ); + 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 = dtrsv( 'row-major', 'upper', 'transpose', 'non-unit', N, A, N, x, 1 ); + 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+':size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.ndarray.js new file mode 100644 index 00000000000..15be7512074 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/benchmark/benchmark.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dtrsv = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = discreteUniform( N*N, -10.0, 10.0, options ); + var x = zeros( N, options.dtype ); + 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 = dtrsv( 'upper', 'transpose', 'non-unit', N, A, N, 1, 0, x, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var 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:size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/repl.txt new file mode 100644 index 00000000000..7358ba7b102 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/repl.txt @@ -0,0 +1,118 @@ + +{{alias}}( ord, uplo, trans, diag, N, A, lda, x, sx ) + Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` + and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, + upper or lower triangular matrix. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N` is equal to `0`, the function returns `x` unchanged. + + Parameters + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether `A` is an upper or lower triangular matrix. + + trans: string + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. + + diag: string + Specifies whether `A` has a unit diagonal. + + N: integer + Number of elements along each dimension of `A`. + + A: Float64Array + Input matrix. + + lda: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + x: Float64Array + Input vector. + + sx: integer + Index increment for `x`. + + Returns + ------- + x: Float64Array + Input vector. + + Examples + -------- + > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 1.0 ] ); + > {{alias}}( 'row-major', 'upper', 'no-transpose', 'unit', 2, A, 2, x, 1 ) + [ -1.0, 1.0 ] + + +{{alias}}.ndarray( uplo, trans, diag, N, A, sa1, sa2, oa, x, sx, ox ) + Solves one of the systems of equations `A*x = b` or `A^T*x = b`, using + alternative indexing semantics and where `b` and `x` are `N` element vectors + and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular + matrix. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + uplo: string + Specifies whether `A` is an upper or lower triangular matrix. + + trans: string + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. + + diag: string + Specifies whether `A` has a unit diagonal. + + N: integer + Number of elements along each dimension of `A`. + + A: Float64Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + x: Float64Array + Input vector. + + sx: integer + Index increment for `x`. + + ox: integer + Starting index for `x`. + + Returns + ------- + x: Float64Array + Input vector. + + Examples + -------- + > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 0.0, 1.0 ] ); + > var uplo = 'upper'; + > var trans = 'no-transpose'; + > {{alias}}.ndarray( uplo, trans, 'unit', 2, A, 2, 1, 0, x, 1, 0 ) + [ -1.0, 1.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/index.d.ts new file mode 100644 index 00000000000..fb26d177f58 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/index.d.ts @@ -0,0 +1,119 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout, MatrixTriangle, TransposeOperation, DiagonalType } from '@stdlib/types/blas'; + +/** +* Interface describing `dtrsv`. +*/ +interface Routine { + /** + * Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + * + * @param order - storage layout + * @param uplo - specifies whether `A` is an upper or lower triangular matrix + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param diag - specifies whether `A` has a unit diagonal + * @param N - number of elements along each dimension in the 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 x - input vector + * @param strideX - `x` stride length + * @returns `x` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ] + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 ); + * // x => [ 0.0, -4.0, 3.0 ] + */ + ( order: Layout, uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, LDA: number, x: Float64Array, strideX: number ): Float64Array; + + /** + * Solves one of the systems of equations `A*x = b` or `A^T*x = b`, using alternative indexing semantics and where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. + * + * @param uplo - specifies whether `A` is an upper or lower triangular matrix + * @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param diag - specifies whether `A` has a unit diagonal + * @param N - number of elements along each dimension in the matrix `A` + * @param A - input matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the first dimension of `A` + * @param offsetA - starting index for `A` + * @param x - input vector + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @returns `x` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ] + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * dtrsv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); + * // x => [ 0.0, -4.0, 3.0 ] + */ + ndarray( uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; +} + +/** +* Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. +* +* @param order - storage layout +* @param uplo - specifies whether `A` is an upper or lower triangular matrix +* @param trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param diag - specifies whether `A` has a unit diagonal +* @param N - number of elements along each dimension in the 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 x - input vector +* @param strideX - `x` stride length +* @returns `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* dtrsv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, A, 3, x, 1 ); +* // x => [ 1.0, ~-0.33, ~-0.22 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* dtrsv.ndarray( 'lower', 'no-transpose', 'non-unit', 3, A, 3, 1, 0, x, 1, 0 ); +* // x => [ 1.0, ~-0.33, ~-0.22 ] +*/ +declare var dtrsv: Routine; + + +// EXPORTS // + +export = dtrsv; diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/test.ts new file mode 100644 index 00000000000..dc628c4cda5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/docs/types/test.ts @@ -0,0 +1,374 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dtrsv = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 10, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( true, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( false, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( null, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( undefined, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( [], 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( {}, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( ( x: number ): number => x, 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 10, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', true, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', false, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', null, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', undefined, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', [], 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', {}, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', ( x: number ): number => x, 'no-transpose', 'unit', 10, A, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 10, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', true, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', false, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', null, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', undefined, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', [], 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', {}, 'unit', 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', ( x: number ): number => x, 'unit', 10, A, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 10, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', true, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', false, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', null, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', undefined, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', [], 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', {}, 10, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', ( x: number ): number => x, 10, A, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', '10', A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', true, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', false, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', null, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', undefined, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', [], A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', {}, A, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', ( x: number ): number => x, A, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const x = new Float64Array( 10 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, 10, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, '10', 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, true, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, false, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, null, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, undefined, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, [ '1' ], 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, {}, 10, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, ( x: number ): number => x, 10, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, '10', x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, true, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, false, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, null, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, undefined, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, [], x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, {}, x, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, ( x: number ): number => x, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Float64Array... +{ + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, 10, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, '10', 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, true, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, false, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, null, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, undefined, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, [ '1' ], 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, {}, 1 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, '10' ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, true ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, false ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, null ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, undefined ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, [] ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, {} ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv(); // $ExpectError + dtrsv( 'row-major' ); // $ExpectError + dtrsv( 'row-major', 'upper' ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose' ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit' ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10 ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x ); // $ExpectError + dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 10, A, 10, x, 1, 1 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 10, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( true, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( false, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( null, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( undefined, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( [], 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( {}, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( ( x: number ): number => x, 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 10, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', true, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', false, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', null, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', undefined, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', [], 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', {}, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', ( x: number ): number => x, 'unit', 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 10, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', true, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', false, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', null, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', undefined, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', [], 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', {}, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', ( x: number ): number => x, 10, A, 10, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', '10', A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', true, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', false, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', null, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', undefined, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', [], A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', {}, A, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', ( x: number ): number => x, A, 10, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +{ + const x = new Float64Array( 10 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, 10, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, '10', 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, true, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, false, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, null, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, undefined, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, [ '1' ], 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, {}, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, ( x: number ): number => x, 10, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, '10', 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, true, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, false, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, null, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, undefined, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, [], 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, {}, 1, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, ( x: number ): number => x, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, '10', 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, true, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, false, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, null, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, undefined, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, [], 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, {}, 0, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, ( x: number ): number => x, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, '10', x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, true, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, false, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, null, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, undefined, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, [], x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, {}, x, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, ( x: number ): number => x, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, 10, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, '10', 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, true, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, false, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, null, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, undefined, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, [ '1' ], 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, {}, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, ( 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 x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, '10', 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, true, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, false, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, null, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, undefined, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, [], 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, {}, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, ( 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 x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, '10' ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, true ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, false ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, null ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, undefined ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, [] ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, {} ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Float64Array( 10 ); + const A = new Float64Array( 20 ); + + dtrsv.ndarray(); // $ExpectError + dtrsv.ndarray( 'upper' ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose' ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit' ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1 ); // $ExpectError + dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 10, A, 10, 1, 0, x, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/examples/index.js b/lib/node_modules/@stdlib/blas/base/dtrsv/examples/index.js new file mode 100644 index 00000000000..c139af3b69b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var dtrsv = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; + +var N = 5; + +var A = discreteUniform( N*N, -10.0, 10.0, opts ); +var x = discreteUniform( N, -10.0, 10.0, opts ); + +dtrsv( 'column-major', 'upper', 'no-transpose', 'unit', N, A, N, x, 1 ); +console.log( x ); + +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', N, A, 1, N, 0, x, 1, 0 ); +console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/base.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/base.js new file mode 100644 index 00000000000..8f6322ef985 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/base.js @@ -0,0 +1,171 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); + + +// MAIN // + +/** +* Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. +* +* @private +* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix +* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} diag - specifies whether `A` has a unit diagonal +* @param {NonNegativeInteger} N - number of elements along each dimension of `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} x - input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @returns {Float64Array} `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtrsv( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); +* // x => [ 0.0, -4.0, 3.0 ] +*/ +function dtrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len + var nonunit; + var isrm; + var tmp; + var sa0; + var sa1; + var ix0; + var ix1; + var i0; + var i1; + var oa; + var ox; + + // Note on variable naming convention: sa#, ix#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + isrm = isRowMajor( [ strideA1, strideA2 ] ); + nonunit = ( diag === 'non-unit' ); + + if ( isrm ) { + // For row-major matrices, the last dimension has the fastest changing index... + sa0 = strideA2; // stride for innermost loop + sa1 = strideA1; // stride for outermost loop + } else { // isColMajor + // For column-major matrices, the first dimension has the fastest changing index... + sa0 = strideA1; // stride for innermost loop + sa1 = strideA2; // stride for outermost loop + } + ox = offsetX; + + if ( + ( !isrm && trans === 'no-transpose' && uplo === 'upper' ) || + ( isrm && trans !== 'no-transpose' && uplo === 'lower' ) + ) { + ix1 = ox + ( ( N - 1 ) * strideX ); + for ( i1 = N-1; i1 >= 0; i1-- ) { + if ( x[ ix1 ] !== 0.0 ) { + oa = offsetA + (sa1*i1); + if ( nonunit ) { + x[ ix1 ] /= A[ oa+(sa0*i1) ]; + } + tmp = x[ ix1 ]; + ix0 = ix1; + for ( i0 = i1-1; i0 >= 0; i0-- ) { + ix0 -= strideX; + x[ ix0 ] -= tmp * A[ oa+(sa0*i0) ]; + } + } + ix1 -= strideX; + } + return x; + } + if ( + ( !isrm && trans === 'no-transpose' && uplo === 'lower' ) || + ( isrm && trans !== 'no-transpose' && uplo === 'upper' ) + ) { + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( x[ ix1 ] !== 0.0 ) { + oa = offsetA + (sa1*i1); + if ( nonunit ) { + x[ ix1 ] /= A[ oa+(sa0*i1) ]; + } + tmp = x[ ix1 ]; + ix0 = ix1; + for ( i0 = i1+1; i0 < N; i0++ ) { + ix0 += strideX; + x[ ix0 ] -= tmp * A[ oa+(sa0*i0) ]; + } + } + ix1 += strideX; + } + return x; + } + if ( + ( !isrm && trans !== 'no-transpose' && uplo === 'upper' ) || + ( isrm && trans === 'no-transpose' && uplo === 'lower' ) + ) { + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + tmp = x[ ix1 ]; + oa = offsetA + (sa1*i1); + ix0 = ox; + for ( i0 = 0; i0 <= i1-1; i0++ ) { + tmp -= x[ ix0 ] * A[ oa+(sa0*i0) ]; + ix0 += strideX; + } + if ( nonunit ) { + tmp /= A[ oa+(sa0*i1) ]; + } + x[ ix1 ] = tmp; + ix1 += strideX; + } + return x; + } + // ( !isrm && trans !== 'no-transpose' && uplo === 'lower' ) || ( isrm && trans === 'no-transpose' && uplo === 'upper' ) + ox += ( N - 1 ) * strideX; + ix1 = ox; + for ( i1 = N-1; i1 >= 0; i1-- ) { + tmp = x[ ix1 ]; + oa = offsetA + (sa1*i1); + ix0 = ox; + for ( i0 = N-1; i0 > i1; i0-- ) { + tmp -= x[ ix0 ] * A[ oa+(sa0*i0) ]; + ix0 -= strideX; + } + if ( nonunit ) { + tmp /= A[ oa+(sa0*i1) ]; + } + x[ ix1 ] = tmp; + ix1 -= strideX; + } + return x; +} + + +// EXPORTS // + +module.exports = dtrsv; diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/dtrsv.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/dtrsv.js new file mode 100644 index 00000000000..c7032f454e6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/dtrsv.js @@ -0,0 +1,108 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var max = require( '@stdlib/math/base/special/fast/max' ); +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix +* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} diag - specifies whether `A` has a unit diagonal +* @param {NonNegativeInteger} N - number of elements along each dimension of `A` +* @param {Float64Array} A - input matrix +* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float64Array} x - input vector +* @param {integer} strideX - `x` stride length +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether a lower or upper triangular matrix is supplied +* @throws {TypeError} third argument must be a valid transpose operation +* @throws {TypeError} fourth argument must be a valid diagonal type +* @throws {RangeError} fifth argument must be a nonnegative integer +* @throws {RangeError} seventh argument must be greater than or equal to max(1,N) +* @throws {RangeError} ninth argument must be non-zero +* @returns {Float64Array} `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ] +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 ); +* // x => [ 0.0, -4.0, 3.0 ] +*/ +function dtrsv( order, uplo, trans, diag, N, A, LDA, x, strideX ) { + var sa1; + var sa2; + var ox; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( !isDiagonal( diag ) ) { + throw new TypeError( format( 'invalid argument. Fourth argument must be a valid diagonal type. Value: `%s`.', diag ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( N === 0 ) { + return x; + } + if ( order === 'column-major' ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + } + ox = stride2offset( N, strideX ); + return base( uplo, trans, diag, N, A, sa1, sa2, 0, x, strideX, ox ); +} + + +// EXPORTS // + +module.exports = dtrsv; diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/index.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/index.js new file mode 100644 index 00000000000..00d1192ecba --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/index.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 2 routine to solve one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. +* +* @module @stdlib/blas/base/dtrsv +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dtrsv = require( '@stdlib/blas/base/dtrsv' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 ); +* // x => [ 0.0, -4.0, 3.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dtrsv = require( '@stdlib/blas/base/dtrsv' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); +* // x => [ 0.0, -4.0, 3.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 dtrsv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dtrsv = main; +} else { + dtrsv = tmp; +} + + +// EXPORTS // + +module.exports = dtrsv; + +// exports: { "ndarray": "dtrsv.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/main.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/main.js new file mode 100644 index 00000000000..4780f59cf56 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dtrsv = require( './dtrsv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dtrsv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dtrsv; diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js new file mode 100644 index 00000000000..2b1632d1bcc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/lib/ndarray.js @@ -0,0 +1,87 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. +* +* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix +* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} diag - specifies whether `A` has a unit diagonal +* @param {NonNegativeInteger} N - number of elements along each dimension of `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} x - input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @throws {TypeError} first argument must specify whether a lower or upper triangular matrix is supplied +* @throws {TypeError} second argument must be a valid transpose operation +* @throws {TypeError} third argument must be a valid diagonal type +* @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} tenth argument must be non-zero +* @returns {Float64Array} `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtrsv( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); +* // x => [ 0.0, -4.0, 3.0 ] +*/ +function dtrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. First argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( !isDiagonal( diag ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid diagonal type. Value: `%s`.', diag ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Tenth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( N === 0 ) { + return x; + } + return base( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX, offsetX ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dtrsv; diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/package.json b/lib/node_modules/@stdlib/blas/base/dtrsv/package.json new file mode 100644 index 00000000000..b3c34038220 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/blas/base/dtrsv", + "version": "0.0.0", + "description": "Solve one of the systems of equations `A*x = b` or `A^T*x = 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", + "blas", + "level 2", + "dtrsv", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float32", + "float", + "float32array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 00000000000..ab90d2b850d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -2, + "strideA2": -5, + "offsetA": 14, + "strideX": -1, + "offsetX": 2, + "N": 3, + "A": [ 6, 999, 0, 999, 0, 5, 999, 4, 999, 0, 3, 999, 2, 999, 1 ], + "x": [ 3.0, 2.0, 1.0 ], + "x_out": [ 0.0, 0.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_nu.json new file mode 100644 index 00000000000..655317f063f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_nu.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_u.json new file mode 100644 index 00000000000..77222a17269 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_nt_u.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 2.0, 2.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_nu.json new file mode 100644 index 00000000000..c25cbe24e9e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_nu.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ -0.25, -0.125, 0.5 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_u.json new file mode 100644 index 00000000000..a9d7c1bf83c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_l_t_u.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, -4.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_oa.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_oa.json new file mode 100644 index 00000000000..874b3d0ee0b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_oa.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 2, + "strideA2": 6, + "offsetA": 7, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 999, 999, 999, 999, 999, 999, 999, 1, 999, 2, 999, 3, 999, 0, 999, 4, 999, 5, 999, 0, 999, 0, 999, 6, 999, 999, 999, 999, 999, 999 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2.json new file mode 100644 index 00000000000..a9c7b31911a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 2, + "strideA2": 5, + "offsetA": 0, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 1, 999, 2, 999, 3, 0, 999, 4, 999, 5, 0, 999, 0, 999, 6 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2n.json new file mode 100644 index 00000000000..648fc34061b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1_sa2n.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 2, + "strideA2": -5, + "offsetA": 10, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 0, 999, 0, 999, 6, 0, 999, 4, 999, 5, 1, 999, 2, 999, 3 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2.json new file mode 100644 index 00000000000..8eb3d5f5378 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -2, + "strideA2": 5, + "offsetA": 4, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 3, 999, 2, 999, 1, 5, 999, 4, 999, 0, 6, 999, 0, 999, 0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2n.json new file mode 100644 index 00000000000..b1107bb7379 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_sa1n_sa2n.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -2, + "strideA2": -5, + "offsetA": 14, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 6, 999, 0, 999, 0, 5, 999, 4, 999, 0, 3, 999, 2, 999, 1 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_nu.json new file mode 100644 index 00000000000..46c0cd13c13 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_nu.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ -0.25, -0.125, 0.5 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_u.json new file mode 100644 index 00000000000..1ada8406173 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_nt_u.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, -4.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_nu.json new file mode 100644 index 00000000000..a814a94ffb9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_nu.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_u.json new file mode 100644 index 00000000000..5e316b92440 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_u_t_u.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xn.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xn.json new file mode 100644 index 00000000000..69f94e23d9b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xn.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetA": 0, + "offsetX": 2, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ], + "x": [ 3.0, 2.0, 1.0 ], + "x_out": [ 0.0, 0.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xt.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xt.json new file mode 100644 index 00000000000..96d5e5be571 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/column_major_xt.json @@ -0,0 +1,16 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ], + "x_out": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 00000000000..4398f6118fb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -6, + "strideA2": -1, + "offsetA": 14, + "strideX": -1, + "offsetX": 2, + "N": 3, + "A": [ 6, 5, 3, 999, 999, 999, 0, 4, 2, 999, 999, 999, 0, 0, 1 ], + "x": [ 3.0, 2.0, 1.0 ], + "x_out": [ 0.0, 0.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_nu.json new file mode 100644 index 00000000000..f173b70235d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_nu.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ], + "x": [ 0.0, 0.0, 0.0 ], + "x_out": [ 0.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_u.json new file mode 100644 index 00000000000..532b1e7a581 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_nt_u.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 2.0, 1.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_nu.json new file mode 100644 index 00000000000..0abf8d76a5d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_nu.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ], + "x": [ 10.0, 10.0, 3.0 ], + "x_out": [ 3.0, 2.5, 0.5 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_u.json new file mode 100644 index 00000000000..63f5ba53a83 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_l_t_u.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 0.0, 0.0, 2.0, 1.0, 0.0, 3.0, 4.0, 1.0 ], + "x": [ 5.0, 5.0, 5.0 ], + "x_out": [ 20.0, -15.0, 5.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_oa.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_oa.json new file mode 100644 index 00000000000..e101df12790 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_oa.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 10, + "strideA2": 1, + "offsetA": 6, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 999, 999, 999, 999, 999, 999, 1, 0, 0, 999, 999, 999, 999, 999, 999, 999, 2, 4, 0, 999, 999, 999, 999, 999, 999, 999, 3, 5, 6, 999 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2.json new file mode 100644 index 00000000000..71dfb83ae60 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 6, + "strideA2": 1, + "offsetA": 0, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 1, 0, 0, 999, 999, 999, 2, 4, 0, 999, 999, 999, 3, 5, 6 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2n.json new file mode 100644 index 00000000000..50f356cd610 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1_sa2n.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": 6, + "strideA2": -1, + "offsetA": 2, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 0, 0, 1, 999, 999, 999, 0, 4, 2, 999, 999, 999, 6, 5, 3 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2.json new file mode 100644 index 00000000000..ee625273cc3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -6, + "strideA2": 1, + "offsetA": 12, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 3, 5, 6, 999, 999, 999, 2, 4, 0, 999, 999, 999, 1, 0, 0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2n.json new file mode 100644 index 00000000000..9f393c36350 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_sa1n_sa2n.json @@ -0,0 +1,14 @@ +{ + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideA1": -6, + "strideA2": -1, + "offsetA": 14, + "strideX": 1, + "offsetX": 0, + "N": 3, + "A": [ 6, 5, 3, 999, 999, 999, 0, 4, 2, 999, 999, 999, 0, 0, 1 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_nu.json new file mode 100644 index 00000000000..68eba4076a9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_nu.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ -0.25, -0.125, 0.5 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_u.json new file mode 100644 index 00000000000..63e7b56038d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_nt_u.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, -4.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_nu.json new file mode 100644 index 00000000000..01da7cbee39 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_nu.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "x": [ 10.0, 10.0, 10.0 ], + "x_out": [ 10.0, -2.5, -1.25 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_u.json new file mode 100644 index 00000000000..f6ec7c9fabc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_u_t_u.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 1.0, 1.0 ], + "x_out": [ 1.0, -1.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xn.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xn.json new file mode 100644 index 00000000000..3aa96677aad --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xn.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetA": 0, + "offsetX": 2, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, -4.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xt.json b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xt.json new file mode 100644 index 00000000000..0e86a8177e6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/fixtures/row_major_xt.json @@ -0,0 +1,16 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetA": 0, + "offsetX": 0, + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "N": 3, + "A": [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ], + "x": [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ], + "x_out": [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.dtrsv.js b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.dtrsv.js new file mode 100644 index 00000000000..2ce9236c470 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.dtrsv.js @@ -0,0 +1,756 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dtrsv = require( './../lib/dtrsv.js' ); + + +// FIXTURES // + +var rlntnu = require( './fixtures/row_major_l_nt_nu.json' ); +var rltnu = require( './fixtures/row_major_l_t_nu.json' ); +var rlntu = require( './fixtures/row_major_l_nt_u.json' ); +var rltu = require( './fixtures/row_major_l_t_u.json' ); +var runtnu = require( './fixtures/row_major_u_nt_nu.json' ); +var runtu = require( './fixtures/row_major_u_nt_u.json' ); +var rutnu = require( './fixtures/row_major_u_t_nu.json' ); +var rutu = require( './fixtures/row_major_u_t_u.json' ); +var rxt = require( './fixtures/row_major_xt.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); + +var clntnu = require( './fixtures/column_major_l_nt_nu.json' ); +var cltnu = require( './fixtures/column_major_l_t_nu.json' ); +var clntu = require( './fixtures/column_major_l_nt_u.json' ); +var cltu = require( './fixtures/column_major_l_t_u.json' ); +var cuntnu = require( './fixtures/column_major_u_nt_nu.json' ); +var cuntu = require( './fixtures/column_major_u_nt_u.json' ); +var cutnu = require( './fixtures/column_major_u_t_nu.json' ); +var cutu = require( './fixtures/column_major_u_t_u.json' ); +var cxt = require( './fixtures/column_major_xt.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dtrsv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 9', function test( t ) { + t.strictEqual( dtrsv.length, 9, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( value, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, value, data.trans, data.diag, data.N, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, data.uplo, value, data.diag, data.N, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, data.uplo, data.trans, value, data.N, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, data.uplo, data.trans, data.diag, value, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventh argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 2, + 1, + 0, + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), value, new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.LDA, new Float64Array( data.x ), value ); + }; + } +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rlntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 50.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = clntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rltnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cltnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rlntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = clntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rltu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cltu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = runtnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cuntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = runtu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cuntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxt; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxt; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, 0, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, 0, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxn; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxn; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.order, data.uplo, data.trans, data.diag, data.N, a, data.LDA, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.js b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.js new file mode 100644 index 00000000000..68032cb6452 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dtrsv = 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 dtrsv, '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 dtrsv.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 dtrsv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dtrsv, 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 dtrsv; + var main; + + main = require( './../lib/dtrsv.js' ); + + dtrsv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dtrsv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js new file mode 100644 index 00000000000..da2d3fca2bb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtrsv/test/test.ndarray.js @@ -0,0 +1,966 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dtrsv = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var rlntnu = require( './fixtures/row_major_l_nt_nu.json' ); +var rltnu = require( './fixtures/row_major_l_t_nu.json' ); +var rlntu = require( './fixtures/row_major_l_nt_u.json' ); +var rltu = require( './fixtures/row_major_l_t_u.json' ); +var runtnu = require( './fixtures/row_major_u_nt_nu.json' ); +var runtu = require( './fixtures/row_major_u_nt_u.json' ); +var rutnu = require( './fixtures/row_major_u_t_nu.json' ); +var rutu = require( './fixtures/row_major_u_t_u.json' ); +var rxt = require( './fixtures/row_major_xt.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); +var roa = require( './fixtures/row_major_oa.json' ); +var rsa1sa2 = require( './fixtures/row_major_sa1_sa2.json' ); +var rsa1nsa2 = require( './fixtures/row_major_sa1n_sa2.json' ); +var rsa1sa2n = require( './fixtures/row_major_sa1_sa2n.json' ); +var rsa1nsa2n = require( './fixtures/row_major_sa1n_sa2n.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); + +var clntnu = require( './fixtures/column_major_l_nt_nu.json' ); +var cltnu = require( './fixtures/column_major_l_t_nu.json' ); +var clntu = require( './fixtures/column_major_l_nt_u.json' ); +var cltu = require( './fixtures/column_major_l_t_u.json' ); +var cuntnu = require( './fixtures/column_major_u_nt_nu.json' ); +var cuntu = require( './fixtures/column_major_u_nt_u.json' ); +var cutnu = require( './fixtures/column_major_u_t_nu.json' ); +var cutu = require( './fixtures/column_major_u_t_u.json' ); +var cxt = require( './fixtures/column_major_xt.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); +var coa = require( './fixtures/column_major_oa.json' ); +var csa1sa2 = require( './fixtures/column_major_sa1_sa2.json' ); +var csa1nsa2 = require( './fixtures/column_major_sa1n_sa2.json' ); +var csa1sa2n = require( './fixtures/column_major_sa1_sa2n.json' ); +var csa1nsa2n = require( './fixtures/column_major_sa1_sa2n.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dtrsv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( dtrsv.length, 11, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( value, data.trans, data.diag, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.uplo, value, data.diag, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.uplo, data.trans, value, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.uplo, data.trans, data.diag, value, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), data.strideX, data.offsetX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid tenth argument', function test( t ) { + var values; + var data; + var i; + + data = rutu; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dtrsv( data.uplo, data.trans, data.diag, data.N, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.x ), value, data.offsetX ); + }; + } +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rlntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = clntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rltnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cltnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rlntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = clntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rltu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cltu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = runtnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cuntnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = runtu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cuntu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutnu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function solves one of the systems of equations `A*x = b` or `A^T*x = b` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxt; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxt; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtrsv( data.uplo, data.trans, data.diag, 0, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero, the function returns the input vector unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cutu; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtrsv( data.uplo, data.trans, data.diag, 0, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1sa2; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1sa2; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1nsa2; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1nsa2; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1sa2n; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1sa2n; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports negative strides for `A` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rsa1nsa2n; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports negative strides for `A` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = csa1nsa2n; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports an `A` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = roa; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports an `A` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = coa; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rxn; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = cxn; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = rcap; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var x; + + data = ccap; + + a = new Float64Array( data.A ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtrsv( data.uplo, data.trans, data.diag, data.N, a, data.strideA1, data.strideA2, data.offsetA, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + isApprox( t, x, expected, 2.0 ); + + t.end(); +});