Skip to content

Commit 029620e

Browse files
committed
feat: add wappers and entry point
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent cc7283a commit 029620e

5 files changed

Lines changed: 295 additions & 1 deletion

File tree

lib/node_modules/@stdlib/blas/base/ctpmv/lib/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var muladd = require( '@stdlib/complex/float32/base/mul-add' ).assign;
2929
// MAIN //
3030

3131
/**
32-
* Performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, or `x = A**H*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.
32+
* Performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, or `x = A**H*x`, where `x` is an `N` element complex vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix, supplied in packed form.
3333
*
3434
* @private
3535
* @param {string} order - storage layout
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
24+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
25+
var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' );
26+
var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' );
27+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
28+
var format = require( '@stdlib/string/format' );
29+
var base = require( './base.js' );
30+
31+
32+
// MAIN //
33+
34+
/**
35+
* Performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, or `x = A**H*x`, where `x` is an `N` element complex vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix, supplied in packed form.
36+
*
37+
* @param {string} order - storage layout
38+
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
39+
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
40+
* @param {string} diag - specifies whether `A` has a unit diagonal
41+
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
42+
* @param {Complex64Array} AP - packed form of a symmetric matrix `A`
43+
* @param {Complex64Array} x - input vector
44+
* @param {integer} strideX - `x` stride length
45+
* @throws {TypeError} first argument must be a valid order
46+
* @throws {TypeError} second argument must specify whether a lower or upper triangular matrix is supplied
47+
* @throws {TypeError} third argument must be a valid transpose operation
48+
* @throws {TypeError} fourth argument must be a valid diagonal type
49+
* @throws {RangeError} fifth argument must be a nonnegative integer
50+
* @throws {RangeError} eighth argument must be non-zero
51+
* @returns {Complex64Array} `x`
52+
*
53+
* @example
54+
* var Complex64Array = require( '@stdlib/array/complex64' );
55+
*
56+
* var AP = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0, 3.0, 3.0, 5.0, 5.0, 6.0, 6.0 ] );
57+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
58+
*
59+
* ctpmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, x, 1 );
60+
* // x => <Complex64Array>[ 0.0, 2.0, 0.0, 20.0, 0.0, 62.0 ]
61+
*/
62+
function ctpmv( order, uplo, trans, diag, N, AP, x, strideX ) {
63+
var ox;
64+
65+
if ( !isLayout( order ) ) {
66+
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
67+
}
68+
if ( !isMatrixTriangle( uplo ) ) {
69+
throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
70+
}
71+
if ( !isTransposeOperation( trans ) ) {
72+
throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) );
73+
}
74+
if ( !isDiagonal( diag ) ) {
75+
throw new TypeError( format( 'invalid argument. Fourth argument must be a valid diagonal type. Value: `%s`.', diag ) );
76+
}
77+
if ( N < 0 ) {
78+
throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', N ) );
79+
}
80+
if ( strideX === 0 ) {
81+
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideX ) );
82+
}
83+
if ( N === 0 ) {
84+
return x;
85+
}
86+
ox = stride2offset( N, strideX );
87+
return base( order, uplo, trans, diag, N, AP, 1, 0, x, strideX, ox );
88+
}
89+
90+
91+
// EXPORTS //
92+
93+
module.exports = ctpmv;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* BLAS level 2 routine to performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, or `x = A**H*x`, where `x` is an `N` element complex vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix, supplied in packed form.
23+
*
24+
* @module @stdlib/blas/base/ctpmv
25+
*
26+
* @example
27+
* var Complex64Array = require( '@stdlib/array/complex64' );
28+
* var ctpmv = require( '@stdlib/blas/base/ctpmv' );
29+
*
30+
* var AP = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0, 3.0, 3.0, 5.0, 5.0, 6.0, 6.0 ] );
31+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
32+
*
33+
* ctpmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, x, 1 );
34+
* // x => <Complex64Array>[ 0.0, 2.0, 0.0, 20.0, 0.0, 62.0 ]
35+
*
36+
* @example
37+
* var Complex64Array = require( '@stdlib/array/complex64' );
38+
* var ctpmv = require( '@stdlib/blas/base/ctpmv' );
39+
*
40+
* var AP = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0, 3.0, 3.0, 5.0, 5.0, 6.0, 6.0 ] );
41+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
42+
*
43+
* ctpmv.ndarray( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, 1, 0, x, 1, 0 );
44+
* // x => <Complex64Array>[ 0.0, 2.0, 0.0, 20.0, 0.0, 62.0 ]
45+
*/
46+
47+
// MODULES //
48+
49+
var join = require( 'path' ).join;
50+
var tryRequire = require( '@stdlib/utils/try-require' );
51+
var isError = require( '@stdlib/assert/is-error' );
52+
var main = require( './main.js' );
53+
54+
55+
// MAIN //
56+
57+
var ctpmv;
58+
var tmp = tryRequire( join( __dirname, './native.js' ) );
59+
if ( isError( tmp ) ) {
60+
ctpmv = main;
61+
} else {
62+
ctpmv = tmp;
63+
}
64+
65+
66+
// EXPORTS //
67+
68+
module.exports = ctpmv;
69+
70+
// exports: { "ndarray": "ctpmv.ndarray" }
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
24+
var ctpmv = require( './ctpmv.js' );
25+
var ndarray = require( './ndarray.js' );
26+
27+
28+
// MAIN //
29+
30+
setReadOnly( ctpmv, 'ndarray', ndarray );
31+
32+
33+
// EXPORTS //
34+
35+
module.exports = ctpmv;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var isLayout = require( '@stdlib/blas/base/assert/is-layout' );
24+
var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' );
25+
var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' );
26+
var isDiagonal = require( '@stdlib/blas/base/assert/is-diagonal-type' );
27+
var format = require( '@stdlib/string/format' );
28+
var base = require( './base.js' );
29+
30+
31+
// MAIN //
32+
33+
/**
34+
* Performs one of the matrix-vector operations `x = A*x`, or `x = A**T*x`, or `x = A**H*x`, where `x` is an `N` element complex vector and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix, supplied in packed form.
35+
*
36+
* @param {string} order - storage layout
37+
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
38+
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
39+
* @param {string} diag - specifies whether `A` has a unit diagonal
40+
* @param {NonNegativeInteger} N - number of elements along each dimension of `A`
41+
* @param {Complex64Array} AP - packed form of a symmetric matrix `A`
42+
* @param {integer} strideAP - `AP` stride length
43+
* @param {NonNegativeInteger} offsetAP - starting index for `AP`
44+
* @param {Complex64Array} x - input vector
45+
* @param {integer} strideX - `x` stride length
46+
* @param {NonNegativeInteger} offsetX - starting index for `x`
47+
* @throws {TypeError} first argument must be a valid order
48+
* @throws {TypeError} second argument must specify whether a lower or upper triangular matrix is supplied
49+
* @throws {TypeError} third argument must be a valid transpose operation
50+
* @throws {TypeError} fourth argument must be a valid diagonal type
51+
* @throws {RangeError} fifth argument must be a nonnegative integer
52+
* @throws {RangeError} seventh argument must be non-zero
53+
* @throws {RangeError} tenth argument must be non-zero
54+
* @returns {Complex64Array} `x`
55+
*
56+
* @example
57+
* var Complex64Array = require( '@stdlib/array/complex64' );
58+
*
59+
* var AP = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0, 3.0, 3.0, 5.0, 5.0, 6.0, 6.0 ] );
60+
* var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
61+
*
62+
* ctpmv( 'row-major', 'lower', 'no-transpose', 'non-unit', 3, AP, 1, 0, x, 1, 0 );
63+
* // x => <Complex64Array>[ 0.0, 2.0, 0.0, 20.0, 0.0, 62.0 ]
64+
*/
65+
function ctpmv( order, uplo, trans, diag, N, AP, strideAP, offsetAP, x, strideX, offsetX ) { // eslint-disable-line max-params, max-len
66+
if ( !isLayout( order ) ) {
67+
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
68+
}
69+
if ( !isMatrixTriangle( uplo ) ) {
70+
throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) );
71+
}
72+
if ( !isTransposeOperation( trans ) ) {
73+
throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) );
74+
}
75+
if ( !isDiagonal( diag ) ) {
76+
throw new TypeError( format( 'invalid argument. Fourth argument must be a valid diagonal type. Value: `%s`.', diag ) );
77+
}
78+
if ( N < 0 ) {
79+
throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', N ) );
80+
}
81+
if ( strideAP === 0 ) {
82+
throw new RangeError( format( 'invalid argument. Seventh argument must be non-zero. Value: `%d`.', strideAP ) );
83+
}
84+
if ( strideX === 0 ) {
85+
throw new RangeError( format( 'invalid argument. Tenth argument must be non-zero. Value: `%d`.', strideX ) );
86+
}
87+
if ( N === 0 ) {
88+
return x;
89+
}
90+
return base( order, uplo, trans, diag, N, AP, strideAP, offsetAP, x, strideX, offsetX ); // eslint-disable-line max-len
91+
}
92+
93+
94+
// EXPORTS //
95+
96+
module.exports = ctpmv;

0 commit comments

Comments
 (0)