From 89b6e5e2578ad6c5462a2874d4d6278e9a309acd Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 24 Aug 2024 09:06:10 +0530 Subject: [PATCH] feat: add BLAS Level 2 routine for dtpmv --- .../@stdlib/blas/base/dtpmv/README.md | 256 +++++ .../blas/base/dtpmv/benchmark/benchmark.js | 104 ++ .../base/dtpmv/benchmark/benchmark.ndarray.js | 104 ++ .../@stdlib/blas/base/dtpmv/docs/repl.txt | 116 +++ .../blas/base/dtpmv/docs/types/index.d.ts | 116 +++ .../blas/base/dtpmv/docs/types/test.ts | 357 +++++++ .../@stdlib/blas/base/dtpmv/examples/index.js | 37 + .../@stdlib/blas/base/dtpmv/lib/base.js | 163 +++ .../@stdlib/blas/base/dtpmv/lib/dtpmv.js | 93 ++ .../@stdlib/blas/base/dtpmv/lib/index.js | 70 ++ .../@stdlib/blas/base/dtpmv/lib/main.js | 35 + .../@stdlib/blas/base/dtpmv/lib/ndarray.js | 96 ++ .../@stdlib/blas/base/dtpmv/package.json | 68 ++ .../column_major_complex_access_pattern.json | 14 + .../test/fixtures/column_major_l_nt_nu.json | 14 + .../test/fixtures/column_major_l_nt_u.json | 14 + .../test/fixtures/column_major_l_t_nu.json | 14 + .../test/fixtures/column_major_l_t_u.json | 14 + .../dtpmv/test/fixtures/column_major_oap.json | 14 + .../dtpmv/test/fixtures/column_major_ox.json | 14 + .../dtpmv/test/fixtures/column_major_sap.json | 14 + .../test/fixtures/column_major_sapn.json | 14 + .../test/fixtures/column_major_u_nt_nu.json | 14 + .../test/fixtures/column_major_u_nt_u.json | 14 + .../test/fixtures/column_major_u_t_nu.json | 14 + .../test/fixtures/column_major_u_t_u.json | 14 + .../dtpmv/test/fixtures/column_major_xn.json | 14 + .../dtpmv/test/fixtures/column_major_xp.json | 14 + .../row_major_complex_access_pattern.json | 14 + .../test/fixtures/row_major_l_nt_nu.json | 14 + .../dtpmv/test/fixtures/row_major_l_nt_u.json | 14 + .../dtpmv/test/fixtures/row_major_l_t_nu.json | 14 + .../dtpmv/test/fixtures/row_major_l_t_u.json | 14 + .../dtpmv/test/fixtures/row_major_oap.json | 14 + .../dtpmv/test/fixtures/row_major_ox.json | 14 + .../dtpmv/test/fixtures/row_major_sap.json | 14 + .../dtpmv/test/fixtures/row_major_sapn.json | 14 + .../test/fixtures/row_major_u_nt_nu.json | 14 + .../dtpmv/test/fixtures/row_major_u_nt_u.json | 14 + .../dtpmv/test/fixtures/row_major_u_t_nu.json | 14 + .../dtpmv/test/fixtures/row_major_u_t_u.json | 14 + .../dtpmv/test/fixtures/row_major_xn.json | 14 + .../dtpmv/test/fixtures/row_major_xp.json | 14 + .../blas/base/dtpmv/test/test.dtpmv.js | 697 +++++++++++++ .../@stdlib/blas/base/dtpmv/test/test.js | 82 ++ .../blas/base/dtpmv/test/test.ndarray.js | 940 ++++++++++++++++++ 46 files changed, 3754 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/lib/base.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/lib/dtpmv.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_complex_access_pattern.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_oap.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_ox.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sap.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sapn.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xn.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xp.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_complex_access_pattern.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_oap.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_ox.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sap.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sapn.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_nu.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_u.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xn.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xp.json create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/test.dtpmv.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/dtpmv/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/README.md b/lib/node_modules/@stdlib/blas/base/dtpmv/README.md new file mode 100644 index 00000000000..3e26d981bed --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/README.md @@ -0,0 +1,256 @@ + + +# dtpmv + +> Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`. + +
+ +## Usage + +```javascript +var dtpmv = require( '@stdlib/blas/base/dtpmv' ); +``` + +#### dtpmv( order, uplo, trans, diag, N, AP, x, sx ) + +Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, x, 1 ); +// x => [ 14.0, 8.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`. +- **AP**: packed form of matrix `A` stored in linear memory as a [`Float64Array`][mdn-float64array]. +- **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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, x, -1 ); +// x => [ 1.0, 4.0, 10.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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); + +// Create offset views... +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, x1, 1 ); +// x0 => [ 1.0, 6.0, 3.0, 1.0 ] +``` + +#### dtpmv.ndarray( order, uplo, trans, diag, N, AP, sap, oap, x, sx, ox ) + +Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, using alternative indexing semantics and where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, 1, 0, x, 1, 0 ); +// x => [ 14.0, 8.0, 3.0 ] +``` + +The function has the following additional parameters: + +- **sap**: `AP` stride length +- **oap**: starting index for `AP`. +- **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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + +dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, 1, 0, x, -1, 2 ); +// x => [ 1.0, 4.0, 10.0 ] +``` + +
+ + + +
+ +## Notes + +- `dtpmv()` corresponds to the [BLAS][blas] level 2 function [`dtpmv`][blas-dtpmv]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var dtpmv = require( '@stdlib/blas/base/dtpmv' ); + +var opts = { + 'dtype': 'float64' +}; + +var N = 5; + +var AP = discreteUniform( N*(N+1)/2, -10.0, 10.0, opts ); +var x = discreteUniform( N, -10.0, 10.0, opts ); + +dtpmv( 'column-major', 'upper', 'no-transpose', 'non-unit', N, AP, x, 1 ); +console.log( x ); + +dtpmv.ndarray( 'column-major', 'upper', 'no-transpose', 'non-unit', N, AP, 1, 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/dtpmv/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.js new file mode 100644 index 00000000000..d2c48d0e19a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.js @@ -0,0 +1,104 @@ +/** +* @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 ones = require( '@stdlib/array/ones' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dtpmv = require( './../lib/dtpmv.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 AP = ones( N*(N+1)/2, options.dtype ); + var x = ones( 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 = dtpmv( 'row-major', 'upper', 'transpose', 'non-unit', N, AP, 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/dtpmv/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.ndarray.js new file mode 100644 index 00000000000..73a366bcd9a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/benchmark/benchmark.ndarray.js @@ -0,0 +1,104 @@ +/** +* @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 ones = require( '@stdlib/array/ones' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dtpmv = 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 AP = ones( N*(N+1)/2, options.dtype ); + var x = ones( 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 = dtpmv( 'row-major', 'upper', 'transpose', 'non-unit', N, AP, 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/dtpmv/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/repl.txt new file mode 100644 index 00000000000..3378c86254c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/repl.txt @@ -0,0 +1,116 @@ + +{{alias}}( order, uplo, trans, diag, N, AP, x, sx ) + Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`, + where `x` is an `N` element vector and `A` is an `N` by `N` unit, or + non-unit, upper or lower triangular matrix, supplied in packed form. + + 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 + ---------- + order: 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`. + + AP: Float64Array + Matrix in packed form. + + 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 AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 1.0 ] ); + > {{alias}}( 'row-major', 'upper', 'no-transpose', 'unit', 2, AP, x, 1 ) + [ 3.0, 1.0 ] + + +{{alias}}.ndarray( order, uplo, trans, diag, N, AP, sap, oap, x, sx, ox ) + Performs one of the matrix-vector operations `x = A*x` or `x = A**T*x`, + using alternative indexing semantics and where `x` is an `N` element vector + and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular + matrix, supplied in packed form. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether `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`. + + AP: Float64Array + Matrix in packed form. + + sap: integer + Index increment for `AP`. + + oap: integer + Starting index for `AP`. + + 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 AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 1.0 ] ); + > var order = 'row-major'; + > var uplo = 'upper'; + > var trans = 'no-transpose'; + > {{alias}}.ndarray( order, uplo, trans, 'unit', 2, AP, 1, 0, x, 1, 0 ) + [ 3.0, 1.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/index.d.ts new file mode 100644 index 00000000000..ff7a5eb3123 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/index.d.ts @@ -0,0 +1,116 @@ +/* +* @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 `dtpmv`. +*/ +interface Routine { + /** + * Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. + * + * @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 AP - packed form of a symmetric matrix `A` + * @param x - input vector + * @param strideX - `x` stride length + * @returns `x` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * dtpmv( 'row-major', 'upper', 'no-transpose', 'non-unit', 3, AP, x, 1 ); + * // x => [ 14.0, 8.0, 3.0 ] + */ + ( order: Layout, uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, AP: Float64Array, x: Float64Array, strideX: number ): Float64Array; + + /** + * Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, using alternative indexing semantics and where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. + * + * @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 AP - packed form of a symmetric matrix `A` + * @param strideAP - `AP` stride length + * @param offsetAP - starting index for `AP` + * @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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); + * var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * + * dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'non-unit', 3, AP, 1, 0, x, 1, 0 ); + * // x => [ 14.0, 8.0, 3.0 ] + */ + ndarray( uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, N: number, AP: Float64Array, strideAP: number, offsetAP: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; +} + +/** +* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. +* +* @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 AP - packed form of a symmetric matrix `A` +* @param x - input vector +* @param strideX - `x` stride length +* @returns `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* dtpmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, x, 1 ); +* // x => [ 1.0, 5.0, 15.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var x = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* dtpmv.ndarray( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, 1, 0, x, 1, 0 ); +* // x => [ 1.0, 5.0, 15.0 ] +*/ +declare var dtpmv: Routine; + + +// EXPORTS // + +export = dtpmv; diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/test.ts new file mode 100644 index 00000000000..3bdd37649bd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/docs/types/test.ts @@ -0,0 +1,357 @@ +/* +* @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 dtpmv = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 10, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( true, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( false, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( null, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( undefined, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( [], 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( {}, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( ( x: number ): number => x, 'upper', 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 10, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', true, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', false, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', null, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', undefined, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', [], 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', {}, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', ( x: number ): number => x, 'no-transpose', 'unit', 10, AP, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 'upper', 10, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', true, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', false, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', null, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', undefined, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', [], 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', {}, 'unit', 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', ( x: number ): number => x, 'unit', 10, AP, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a string... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 10, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', true, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', false, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', null, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', undefined, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', [], 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', {}, 10, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', ( x: number ): number => x, 10, AP, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', '10', AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', true, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', false, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', null, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', undefined, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', [], AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', {}, AP, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', ( x: number ): number => x, AP, 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 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, 10, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, '10', x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, true, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, false, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, null, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, undefined, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, [ '1' ], x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, {}, x, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, ( x: number ): number => x, x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const AP = new Float64Array( 55 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 10, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, '10', 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, true, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, false, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, null, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, undefined, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, [ '1' ], 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, {}, 1 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, '10' ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, true ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, false ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, null ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, undefined ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, [] ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, {} ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv(); // $ExpectError + dtpmv( 'row-major' ); // $ExpectError + dtpmv( 'row-major', 'upper' ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose' ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit' ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10 ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x ); // $ExpectError + dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, x, 1, 1 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 10, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( true, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( false, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( null, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( undefined, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( [], 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( {}, 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( ( x: number ): number => x, 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 10, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', true, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', false, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', null, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', undefined, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', [], 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', {}, 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', ( x: number ): number => x, 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 10, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', true, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', false, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', null, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', undefined, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', [], 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', {}, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', ( x: number ): number => x, 'unit', 10, AP, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a string... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 10, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', true, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', false, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', null, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', undefined, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', [], 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', {}, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', ( x: number ): number => x, 10, AP, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', '10', AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', true, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', false, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', null, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', undefined, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', [], AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', {}, AP, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', ( x: number ): number => x, AP, 1, 0, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, 10, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, '10', 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, true, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, false, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, null, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, undefined, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, [ '1' ], 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, {}, 1, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, ( 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, '10', 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, true, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, false, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, null, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, undefined, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, [], 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, {}, 0, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, ( 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, '10', x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, true, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, false, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, null, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, undefined, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, [], x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, {}, x, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, 10, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, '10', 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, true, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, false, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, null, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, undefined, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, [ '1' ], 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, {}, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, '10', 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, true, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, false, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, null, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, undefined, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, [], 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, {}, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, '10' ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, true ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, false ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, null ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, undefined ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, [] ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, {} ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 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 AP = new Float64Array( 55 ); + const x = new Float64Array( 10 ); + + dtpmv.ndarray(); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper' ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose' ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit' ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1 ); // $ExpectError + dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 10, AP, 1, 0, x, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/examples/index.js b/lib/node_modules/@stdlib/blas/base/dtpmv/examples/index.js new file mode 100644 index 00000000000..2fdaa876ebb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/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 dtpmv = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; + +var N = 5; + +var AP = discreteUniform( N*(N+1)/2, -10.0, 10.0, opts ); +var x = discreteUniform( N, -10.0, 10.0, opts ); + +dtpmv( 'column-major', 'upper', 'no-transpose', 'non-unit', N, AP, x, 1 ); +console.log( x ); + +dtpmv.ndarray( 'column-major', 'upper', 'no-transpose', 'non-unit', N, AP, 1, 0, x, 1, 0 ); +console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/lib/base.js b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/base.js new file mode 100644 index 00000000000..871a5eacf6a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/base.js @@ -0,0 +1,163 @@ +/** +* @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'; + +// MAIN // + +/** +* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. +* +* @private +* @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} AP - packed form of a symmetric matrix `A` +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.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 ] ); +* +* dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, 1, 0, x, 1, 0 ); +* // x => [ 14.0, 8.0, 3.0 ] +*/ +function dtpmv( order, uplo, trans, diag, N, AP, strideAP, offsetAP, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len + var nonunit; + var isrm; + var tmp; + var iap; + var ix0; + var ix1; + var i0; + var i1; + var kk; + var ox; + + isrm = ( order === 'row-major' ); + nonunit = ( diag === 'non-unit' ); + kk = offsetAP; + ox = offsetX; + if ( + ( !isrm && uplo === 'upper' && trans === 'no-transpose' ) || + ( isrm && uplo === 'lower' && trans !== 'no-transpose' ) + ) { + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( x[ ix1 ] !== 0.0 ) { + tmp = x[ ix1 ]; + iap = kk; + ix0 = ox; + for ( i0 = 0; i0 < i1; i0++ ) { + x[ ix0 ] += AP[ iap ] * tmp; + iap += strideAP; + ix0 += strideX; + } + if ( nonunit ) { + x[ix0] *= AP[ iap ]; + } + } + ix1 += strideX; + kk += ( i1 + 1 ) * strideAP; + } + return x; + } + if ( + ( !isrm && uplo === 'lower' && trans === 'no-transpose' ) || + ( isrm && uplo === 'upper' && trans !== 'no-transpose' ) + ) { + kk += ( ( N * ( N + 1 ) / 2 ) - 1 ) * strideAP; + ox += ( N - 1 ) * strideX; + ix1 = ox; + for ( i1 = N-1; i1 >=0; i1-- ) { + if ( x[ ix1 ] !== 0.0 ) { + tmp = x[ ix1 ]; + iap = kk; + ix0 = ox; + for ( i0 = N-1; i0 > i1; i0-- ) { + x[ ix0 ] += AP[ iap ] * tmp; + iap -= strideAP; + ix0 -= strideX; + } + if ( nonunit ) { + x[ ix0 ] *= AP[ iap ]; + } + } + ix1 -= strideX; + kk -= ( N - i1 ) * strideAP; + } + return x; + } + if ( + ( !isrm && uplo === 'upper' && trans !== 'no-transpose' ) || + ( isrm && uplo === 'lower' && trans === 'no-transpose' ) + ) { + kk += ( ( N * ( N + 1 ) / 2 ) - 1 ) * strideAP; + ix1 = ox + ( ( N - 1 ) * strideX ); + for ( i1 = N-1; i1 >= 0; i1-- ) { + tmp = x[ ix1 ]; + iap = kk; + ix0 = ix1; + if ( nonunit ) { + tmp *= AP[ iap ]; + } + for ( i0 = i1-1; i0 >= 0; i0-- ) { + ix0 -= strideX; + iap -= strideAP; + tmp += AP[ iap ] * x[ ix0 ]; + } + x[ ix1 ] = tmp; + ix1 -= strideX; + kk -= ( i1 + 1 ) * strideAP; + } + return x; + } + // ( !isrm && uplo === 'lower' && trans !== 'no-transpose' ) || ( isrm && uplo === 'upper' && trans === 'no-transpose' ) + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + tmp = x[ ix1 ]; + iap = kk; + ix0 = ix1; + if ( nonunit ) { + tmp *= AP[ iap ]; + } + for ( i0 = i1+1; i0 < N; i0++ ) { + ix0 += strideX; + iap += strideAP; + tmp += AP[ iap ] * x[ ix0 ]; + } + x[ ix1 ] = tmp; + ix1 += strideX; + kk += ( N - i1 ) * strideAP; + } + return x; +} + + +// EXPORTS // + +module.exports = dtpmv; diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/lib/dtpmv.js b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/dtpmv.js new file mode 100644 index 00000000000..ebe1f208125 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/dtpmv.js @@ -0,0 +1,93 @@ +/** +* @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 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 // + +/** +* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. +* +* @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} AP - packed form of a symmetric 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} eighth argument must be non-zero +* @returns {Float64Array} `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.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 ] ); +* +* dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, x, 1 ); +* // x => [ 14.0, 8.0, 3.0 ] +*/ +function dtpmv( order, uplo, trans, diag, N, AP, x, strideX ) { + 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 ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( N === 0 ) { + return x; + } + ox = stride2offset( N, strideX ); + return base( order, uplo, trans, diag, N, AP, 1, 0, x, strideX, ox ); +} + + +// EXPORTS // + +module.exports = dtpmv; diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/lib/index.js b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/index.js new file mode 100644 index 00000000000..b8913b7b8b8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/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 perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. +* +* @module @stdlib/blas/base/dtpmv +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dtpmv = require( '@stdlib/blas/base/dtpmv' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, x, 1 ); +* // x => [ 14.0, 8.0, 3.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dtpmv = require( '@stdlib/blas/base/dtpmv' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dtpmv.ndarray( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, 1, 0, x, 1, 0 ); +* // x => [ 14.0, 8.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 dtpmv; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dtpmv = main; +} else { + dtpmv = tmp; +} + + +// EXPORTS // + +module.exports = dtpmv; + +// exports: { "ndarray": "dtpmv.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/lib/main.js b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/main.js new file mode 100644 index 00000000000..8d60caf2450 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/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 dtpmv = require( './dtpmv.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dtpmv, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dtpmv; diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/ndarray.js new file mode 100644 index 00000000000..9aaaa95806f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/lib/ndarray.js @@ -0,0 +1,96 @@ +/** +* @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 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 format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs one of the matrix-vector operations `x = A*x` or `x = A^T*x`, where `x` is an `N` element vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix, supplied in packed form. +* +* @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} AP - packed form of a symmetric matrix `A` +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @param {Float64Array} x - input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @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 non-zero +* @throws {RangeError} tenth argument must be non-zero +* @returns {Float64Array} `x` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.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 ] ); +* +* dtpmv( 'row-major', 'upper', 'no-transpose', 'unit', 3, AP, 1, 0, x, 1, 0 ); +* // x => [ 14.0, 8.0, 3.0 ] +*/ +function dtpmv( order, uplo, trans, diag, N, AP, strideAP, offsetAP, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len + 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 ( strideAP === 0 ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be non-zero. Value: `%d`.', strideAP ) ); + } + 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( order, uplo, trans, diag, N, AP, strideAP, offsetAP, x, strideX, offsetX ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dtpmv; diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/package.json b/lib/node_modules/@stdlib/blas/base/dtpmv/package.json new file mode 100644 index 00000000000..1f24e4f08b9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/blas/base/dtpmv", + "version": "0.0.0", + "description": "Perform one of the matrix-vector operations `x = A*x` or `x = A^T*x`.", + "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", + "dtpmv", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_complex_access_pattern.json new file mode 100644 index 00000000000..01cc55ae264 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": -2, + "offsetX": 5, + "strideAP": -2, + "offsetAP": 11, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x_out": [ 0.0, 3.0, 0.0, 8.0, 0.0, 14.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_nu.json new file mode 100644 index 00000000000..e35f3375eb0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_u.json new file mode 100644 index 00000000000..7b29a3371e3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 2.0, 1.0, 1.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_nu.json new file mode 100644 index 00000000000..f6c7efdc047 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_u.json new file mode 100644 index 00000000000..7f571c393b2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_l_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_oap.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_oap.json new file mode 100644 index 00000000000..82c23f3d92b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_oap.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideAP": 2, + "offsetAP": 7, + "strideX": 1, + "offsetX": 0, + "N": 3, + "AP": [ 999, 999, 999, 999, 999, 999, 999, 1, 999, 2, 999, 3, 999, 4, 999, 5, 999, 6 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_ox.json new file mode 100644 index 00000000000..14ccaec2ee5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_ox.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sap.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sap.json new file mode 100644 index 00000000000..1bb840281a5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sap.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 2, + "offsetAP": 1, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sapn.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sapn.json new file mode 100644 index 00000000000..f6f810e4c1d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_sapn.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": -2, + "offsetAP": 11, + "N": 3, + "AP": [ 0.0, 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_nu.json new file mode 100644 index 00000000000..c621fb61f1b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 4.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_u.json new file mode 100644 index 00000000000..ffacc5aef02 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_nu.json new file mode 100644 index 00000000000..777eafea429 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 4.0, 3.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_u.json new file mode 100644 index 00000000000..056272e6b7d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_u_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xn.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xn.json new file mode 100644 index 00000000000..73cb7c4e803 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xn.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 2.0, 1.0 ], + "x": [ 3.0, 2.0, 1.0 ], + "x_out": [ 10.0, 4.0, 1.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xp.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xp.json new file mode 100644 index 00000000000..19bf4a38f00 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/column_major_xp.json @@ -0,0 +1,14 @@ +{ + "order": "column-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.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, 4.0, 0.0, 10.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_complex_access_pattern.json new file mode 100644 index 00000000000..e338e7f340b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_complex_access_pattern.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 2, + "offsetX": 1, + "strideAP": -2, + "offsetAP": 10, + "N": 3, + "AP": [ 1.0, 0.0, 4.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0 ], + "x_out": [ 0.0, 14.0, 0.0, 14.0, 0.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_nu.json new file mode 100644 index 00000000000..df5e2230a8f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 8.0, 32.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_u.json new file mode 100644 index 00000000000..4ed4aa133fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 2.0, 1.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 7.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_nu.json new file mode 100644 index 00000000000..24e005f3a23 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 17.0, 21.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_u.json new file mode 100644 index 00000000000..90af9a19d70 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_l_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 4.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_oap.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_oap.json new file mode 100644 index 00000000000..5680582d918 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_oap.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "lower", + "strideAP": 2, + "offsetAP": 6, + "strideX": 1, + "offsetX": 0, + "N": 3, + "AP": [ 999, 999, 999, 999, 999, 999, 1, 999, 2, 999, 4, 999, 3, 999, 5, 999, 6, 999 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_ox.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_ox.json new file mode 100644 index 00000000000..64e8de1ab2e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_ox.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 1.0, 3.0, 4.0, 1.0 ], + "x": [ 0.0, 0.0, 1.0, 2.0, 3.0 ], + "x_out": [ 0.0, 0.0, 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sap.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sap.json new file mode 100644 index 00000000000..444a19fb7d1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sap.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": 2, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 4.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sapn.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sapn.json new file mode 100644 index 00000000000..b27f3bad342 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_sapn.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "lower", + "strideX": 1, + "offsetX": 0, + "strideAP": -2, + "offsetAP": 10, + "N": 3, + "AP": [ 1.0, 0.0, 4.0, 0.0, 3.0, 0.0, 1.0, 0.0, 2.0, 0.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 14.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_nu.json new file mode 100644 index 00000000000..2b3d75672bb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 23.0, 18.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_u.json new file mode 100644 index 00000000000..a91c7d3b78c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_nt_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "no-transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_nu.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_nu.json new file mode 100644 index 00000000000..18f81f46fa6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_nu.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "non-unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 10.0, 31.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_u.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_u.json new file mode 100644 index 00000000000..052268b1780 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_u_t_u.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 1, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 1.0, 4.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xn.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xn.json new file mode 100644 index 00000000000..5d59b8a7503 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xn.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": -1, + "offsetX": 2, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 2.0, 3.0 ], + "x_out": [ 14.0, 8.0, 3.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xp.json b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xp.json new file mode 100644 index 00000000000..34345f902ef --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/fixtures/row_major_xp.json @@ -0,0 +1,14 @@ +{ + "order": "row-major", + "trans": "transpose", + "diag": "unit", + "uplo": "upper", + "strideX": 2, + "offsetX": 0, + "strideAP": 1, + "offsetAP": 0, + "N": 3, + "AP": [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ], + "x": [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ], + "x_out": [ 1.0, 0.0, 4.0, 0.0, 10.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.dtpmv.js b/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.dtpmv.js new file mode 100644 index 00000000000..dd0ed5b75ce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.dtpmv.js @@ -0,0 +1,697 @@ +/** +* @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 dtpmv = require( './../lib/dtpmv.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 rxp = require( './fixtures/row_major_xp.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 cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dtpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( dtpmv.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var 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() { + dtpmv( value, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.AP ), 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() { + dtpmv( data.order, value, data.trans, data.diag, data.N, new Float64Array( data.AP ), 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() { + dtpmv( data.order, data.uplo, value, data.diag, data.N, new Float64Array( data.AP ), 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() { + dtpmv( data.order, data.uplo, data.trans, value, data.N, new Float64Array( data.AP ), 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() { + dtpmv( data.order, data.uplo, data.trans, data.diag, value, new Float64Array( data.AP ), new Float64Array( data.x ), data.strideX ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighth 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() { + dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.AP ), new Float64Array( data.x ), value ); + }; + } +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, 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 ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, 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 ap; + var x; + + data = cutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, 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 ap; + var x; + + data = rxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, x, data.strideX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.js b/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.js new file mode 100644 index 00000000000..431e2e4d701 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/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 dtpmv = 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 dtpmv, '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 dtpmv.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 dtpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dtpmv, 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 dtpmv; + var main; + + main = require( './../lib/dtpmv.js' ); + + dtpmv = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dtpmv, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.ndarray.js new file mode 100644 index 00000000000..f9f1bcd1285 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dtpmv/test/test.ndarray.js @@ -0,0 +1,940 @@ +/** +* @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 dtpmv = 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 rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var rsap = require( './fixtures/row_major_sap.json' ); +var rsapn = require( './fixtures/row_major_sapn.json' ); +var roap = require( './fixtures/row_major_oap.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 cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var csap = require( './fixtures/column_major_sap.json' ); +var csapn = require( './fixtures/column_major_sapn.json' ); +var coap = require( './fixtures/column_major_oap.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dtpmv, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( dtpmv.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() { + dtpmv( value, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.AP ), data.strideAP, data.offsetAP, 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() { + dtpmv( data.order, value, data.trans, data.diag, data.N, new Float64Array( data.AP ), data.strideAP, data.offsetAP, 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() { + dtpmv( data.order, data.uplo, value, data.diag, data.N, new Float64Array( data.AP ), data.strideAP, data.offsetAP, 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() { + dtpmv( data.order, data.uplo, data.trans, value, data.N, new Float64Array( data.AP ), data.strideAP, data.offsetAP, 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() { + dtpmv( data.order, data.uplo, data.trans, data.diag, value, new Float64Array( data.AP ), data.strideAP, data.offsetAP, 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 = [ + 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() { + dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.AP ), value, data.offsetAP, 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() { + dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, new Float64Array( data.AP ), data.strideAP, data.offsetAP, new Float64Array( data.x ), value, data.offsetX ); + }; + } +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rlntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = clntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rltu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, lower, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cltu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = runtu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, no transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cuntu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, non-unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutnu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (row-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs one of the matrix-vector operations `x = A*x` or `x = A**T*x` (column-major, upper, transpose, unit)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the input vector', function test( t ) { + var data; + var out; + var ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, 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 ap; + var x; + + data = rutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, data.strideAP, data.offsetAP, 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 ap; + var x; + + data = cutu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, 0, ap, data.strideAP, data.offsetAP, 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 an `x` stride (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, 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 ap; + var x; + + data = rxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rox; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cox; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsapn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csapn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = roap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = coap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rcap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ccap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.x_out ); + + out = dtpmv( data.order, data.uplo, data.trans, data.diag, data.N, ap, data.strideAP, data.offsetAP, x, data.strideX, data.offsetX ); + t.strictEqual( out, x, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +});