Skip to content

Commit 5f73e5b

Browse files
committed
feat: add main exports
--- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent bc30ed3 commit 5f73e5b

File tree

5 files changed

+286
-5
lines changed

5 files changed

+286
-5
lines changed

lib/node_modules/@stdlib/lapack/base/dlarf1f/lib/base.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, o
8181
} else {
8282
lastv = N;
8383
}
84-
if ( strideV > 0 ) {
85-
i = offsetV + ( ( lastv - 1 ) * strideV );
86-
} else {
87-
i = offsetV;
88-
}
84+
85+
// Determine the offset for V ----- can we set i = offsetV straight away????
86+
// i = offsetV + stride2offset( lastv, strideV );
87+
i = offsetV;
88+
8989
while ( lastv > 0 && V[ i ] === 0.0 ) {
9090
lastv -= 1;
9191
i -= strideV;
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' );
25+
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
26+
var max = require( '@stdlib/math/base/special/max' );
27+
var format = require( '@stdlib/string/format' );
28+
var stride2offset = require( '@stdlib/strided/base/stride2offset' );
29+
var base = require( './base.js' );
30+
31+
32+
// MAIN //
33+
34+
/**
35+
* Applies a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`.
36+
*
37+
* ## Notes
38+
*
39+
* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`.
40+
* - `V` should have `1 + (M-1) * abs(incv)` indexed elements if side = `left` and `1 + (N-1) * abs(incv)` indexed elements if side = `right`.
41+
* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`.
42+
*
43+
* @param {string} order - storage layout
44+
* @param {string} side - use `left` to form `H * C` and `right` to from `C * H`
45+
* @param {NonNegativeInteger} M - number of rows in `C`
46+
* @param {NonNegativeInteger} N - number of columns in `C`
47+
* @param {Float64Array} V - the vector `v` in the representation of `H`
48+
* @param {integer} incv - stride length for `V`
49+
* @param {number} tau - the value of `tau` in representation of `H`
50+
* @param {Float64Array} C - input matrix
51+
* @param {PositiveInteger} LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`)
52+
* @param {Float64Array} work - workspace array
53+
* @throws {TypeError} first argument must be a valid order
54+
* @throws {TypeError} second argument must be a valid side
55+
* @throws {RangeError} ninth argument must be greater than or equal to max(1,N)
56+
* @throws {RangeError} fifth argument must not be zero
57+
* @returns {Float64Array} `C * H` or `H * C`
58+
*
59+
* @example
60+
* var Float64Array = require( '@stdlib/array/float64' );
61+
*
62+
* var C = new Float64Array( [ 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12 ] );
63+
* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
64+
* var work = new Float64Array( 3 );
65+
*
66+
* var out = dlarf1f( 'row-major', 'left', 4, 3, V, 1, 1.0, C, 3, work );
67+
* // returns <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ]
68+
*/
69+
function dlarf1f( order, side, M, N, V, incv, tau, C, LDC, work ) {
70+
var sc1;
71+
var sc2;
72+
var ov;
73+
74+
if ( !isLayout( order ) ) {
75+
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
76+
}
77+
if ( isRowMajor( order ) && LDC < max( 1, N ) ) {
78+
throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) );
79+
}
80+
if ( side !== 'left' && side !== 'right' ) { // TODO - refactor this to make use of an array if needed
81+
throw new TypeError( format( 'invalid argument. Second argument must be a valid side (left or right). Value: `%s`.', side ) );
82+
}
83+
if ( incv === 0 ) {
84+
throw new RangeError( format( 'invalid argument. Fifth argument must not be zero' ) );
85+
}
86+
if ( isColumnMajor( order ) ) {
87+
sc1 = 1;
88+
sc2 = LDC;
89+
} else { // order === 'row-major'
90+
sc1 = LDC;
91+
sc2 = 1;
92+
}
93+
if ( side === 'left' ) {
94+
ov = stride2offset( M, incv );
95+
} else {
96+
ov = stride2offset( N, incv );
97+
}
98+
return base( side, M, N, V, incv, ov, tau, C, sc1, sc2, 0, work, 1, 0 );
99+
}
100+
101+
102+
// EXPORTS //
103+
104+
module.exports = dlarf1f;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
* LAPACK routine to apply a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`.
23+
*
24+
* ## Notes
25+
*
26+
* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`.
27+
* - `V` should have `1 + (M-1) * abs(incv)` indexed elements if side = `left` and `1 + (N-1) * abs(incv)` indexed elements if side = `right`.
28+
* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`.
29+
*
30+
* @module @stdlib/lapack/base/dlarf1f
31+
*
32+
* @example
33+
* var Float64Array = require( '@stdlib/array/float64' );
34+
* var dlarf1f = require( '@stdlib/lapack/base/dlarf1f' );
35+
*
36+
* var C = new Float64Array( [ 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12 ] );
37+
* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
38+
* var work = new Float64Array( 3 );
39+
*
40+
* var out = dlarf1f( 'left', 4, 3, V, 1, 1.0, C, 3, work );
41+
* // returns <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ]
42+
*/
43+
44+
// MODULES //
45+
46+
var join = require( 'path' ).join;
47+
var tryRequire = require( '@stdlib/utils/try-require' );
48+
var isError = require( '@stdlib/assert/is-error' );
49+
var main = require( './main.js' );
50+
51+
52+
// MAIN //
53+
54+
var dlarf1f;
55+
var tmp = tryRequire( join( __dirname, './native.js' ) );
56+
if ( isError( tmp ) ) {
57+
dlarf1f = main;
58+
} else {
59+
dlarf1f = tmp;
60+
}
61+
62+
63+
// EXPORTS //
64+
65+
module.exports = dlarf1f;
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) 2025 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 dlarf1f = require( './dlarf1f.js' );
25+
var ndarray = require( './ndarray.js' );
26+
27+
28+
// MAIN //
29+
30+
setReadOnly( dlarf1f, 'ndarray', ndarray );
31+
32+
33+
// EXPORTS //
34+
35+
module.exports = dlarf1f;
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
/* eslint-disable max-len */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var format = require( '@stdlib/string/format' );
26+
var base = require( './base.js' );
27+
28+
29+
// MAIN //
30+
31+
/**
32+
* Applies a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`.
33+
*
34+
* ## Notes
35+
*
36+
* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`.
37+
* - `V` should have `1 + (M-1) * abs(strideV)` indexed elements if side = `left` and `1 + (N-1) * abs(strideV)` indexed elements if side = `right`.
38+
* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`.
39+
*
40+
* @param {string} side - use `left` to form `H * C` and `right` to from `C * H`
41+
* @param {NonNegativeInteger} M - number of rows in `C`
42+
* @param {NonNegativeInteger} N - number of columns in `C`
43+
* @param {Float64Array} V - the vector `v` in the representation of `H`
44+
* @param {integer} strideV - stride length for `V`
45+
* @param {NonNegativeInteger} offsetV - starting index for `V`
46+
* @param {number} tau - the value of `tau` in representation of `H`
47+
* @param {Float64Array} C - input matrix
48+
* @param {integer} strideC1 - stride of the first dimension of `C`
49+
* @param {integer} strideC2 - stride of the second dimension of `C`
50+
* @param {NonNegativeInteger} offsetC - starting index for `C`
51+
* @param {Float64Array} work - workspace array
52+
* @param {integer} strideWork - stride length for `work`
53+
* @param {NonNegativeInteger} offsetWork - starting index for `work`
54+
* @throws {TypeError} first argument must be a valid side
55+
* @returns {Float64Array} `C * H` or `H * C`
56+
*
57+
* @example
58+
* var Float64Array = require( '@stdlib/array/float64' );
59+
*
60+
* var C = new Float64Array( [ 1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12 ] );
61+
* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] );
62+
* var work = new Float64Array( 3 );
63+
*
64+
* var out = dlarf1f( 'left', 4, 3, V, 1, 0, 1.0, C, 3, 1, 0, work, 1, 0 );
65+
* // returns <Float64Array>[ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ]
66+
*/
67+
function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params
68+
if ( side !== 'left' && side !== 'right' ) { // TODO - refactor this to make use of an array if needed
69+
throw new TypeError( format( 'invalid argument. First argument must be a valid side (left or right). Value: `%s`.', side ) );
70+
}
71+
return base( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork );
72+
}
73+
74+
75+
// EXPORTS //
76+
77+
module.exports = dlarf1f;

0 commit comments

Comments
 (0)