Skip to content

Commit 9ab8ce8

Browse files
committed
chore: cleaning up
--- 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: passed - 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 f3e10ec commit 9ab8ce8

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

lib/node_modules/@stdlib/lapack/base/dorg2r/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface Routine {
3535
* @param N - number of columns in `A`
3636
* @param K - number of elementary reflectors whose product defines the matrix `Q`
3737
* @param A - input matrix (overwritten with `Q` on output)
38-
* @param LDA - stride of the first dimension of `A` (leading dimension)
38+
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
3939
* @param tau - vector of `K` scalar factors of the elementary reflectors
4040
* @param work - workspace array
4141
* @returns matrix `A` overwritten with the orthogonal matrix `Q`
@@ -93,7 +93,7 @@ interface Routine {
9393
* @param N - number of columns in `A`
9494
* @param K - number of elementary reflectors whose product defines the matrix `Q`
9595
* @param A - input matrix (overwritten with `Q` on output)
96-
* @param LDA - stride of the first dimension of `A` (leading dimension)
96+
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
9797
* @param tau - vector of `K` scalar factors of the elementary reflectors
9898
* @param work - workspace array
9999
* @returns matrix `A` overwritten with the orthogonal matrix `Q`

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

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var dlarf1f = require( './dlarf1f.js' );
3333
* @param {PositiveInteger} M - number of rows in matrix `A`
3434
* @param {PositiveInteger} N - number of columns in matrix `A`
3535
* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix Q
36-
* @param {Float64Array} A - input matrix (overwritten by Householder vectors from `dgeqrf`
36+
* @param {Float64Array} A - input matrix
3737
* @param {integer} strideA1 - stride of the first dimension of `A`
3838
* @param {integer} strideA2 - stride of the second dimension of `A`
3939
* @param {NonNegativeInteger} offsetA - index offset for `A`
@@ -56,6 +56,11 @@ var dlarf1f = require( './dlarf1f.js' );
5656
* // A => <Float64Array>[ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0 ]
5757
*/
5858
function dorg2r( M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, work, strideWork, offsetWork ) { // eslint-disable-line max-len, max-params
59+
var ia1;
60+
var ia3;
61+
var del;
62+
var ia2;
63+
var it;
5964
var i;
6065
var j;
6166
var l;
@@ -65,30 +70,49 @@ function dorg2r( M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offset
6570
}
6671

6772
// Initialize columns k+1:n to columns of the unit matrix
73+
ia1 = offsetA + (K*strideA1) + (K*strideA2);
74+
ia2 = offsetA + (K*strideA2);
75+
del = strideA1 + strideA2;
76+
6877
for ( j = K; j < N; j++ ) {
6978
for ( l = 0; l < M; l++ ) {
70-
A[ offsetA + (l*strideA1) + (j*strideA2) ] = 0.0;
79+
A[ ia2 ] = 0.0;
80+
ia2 += strideA1;
7181
}
72-
A[ offsetA + (j*strideA1) + (j*strideA2) ] = 1.0;
82+
A[ ia1 ] = 1.0;
83+
ia1 += del;
84+
ia2 += strideA2;
7385
}
7486

87+
it = offsetTau + ((K-1)*strideTau);
88+
ia1 = offsetA + ((K-1)*(strideA1+strideA2));
89+
ia2 = offsetA + ((K-1)*strideA2);
90+
7591
// Apply H(i) to A(i:m,i:n) from the left
7692
for ( i = K-1; i >= 0; i-- ) {
7793
if ( i < N ) {
7894
// Apply H(i) to A(i:m,i+1:n) from the left
79-
dlarf1f( 'left', M-i, N-i-1, A, strideA1, offsetA + (i*strideA1) + (i*strideA2), tau[ offsetTau + (i*strideTau) ], A, strideA1, strideA2, offsetA + (i*strideA1) + ((i+1)*strideA2), work, strideWork, offsetWork );
95+
dlarf1f( 'left', M-i, N-i-1, A, strideA1, ia1, tau[ it ], A, strideA1, strideA2, ia1 + strideA2, work, strideWork, offsetWork );
8096
}
8197
if ( i < M ) {
8298
// Scale A(i+1:m,i) by -tau(i)
83-
dscal( M-i-1, -tau[ offsetTau + (i*strideTau) ], A, strideA1, offsetA + ((i+1)*strideA1) + (i*strideA2) ); // eslint-disable-line max-len
99+
dscal( M-i-1, -tau[ it ], A, strideA1, ia1 + strideA1 );
84100
}
101+
85102
// Set A(i,i) = 1 - tau(i)
86-
A[ offsetA + (i*strideA1) + (i*strideA2) ] = 1.0 - tau[ offsetTau + (i*strideTau) ]; // eslint-disable-line max-len
103+
A[ ia1 ] = 1.0 - tau[ it ];
104+
105+
ia3 = 0;
87106

88107
// Set A(0:i-1,i) to zero
89108
for ( l = 0; l < i; l++ ) {
90-
A[ offsetA + (l*strideA1) + (i*strideA2) ] = 0.0;
109+
A[ ia2 + ia3 ] = 0.0;
110+
ia3 += strideA1;
91111
}
112+
it -= strideTau;
113+
114+
ia1 -= del;
115+
ia2 -= strideA2;
92116
}
93117

94118
return A;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var base = require( './base.js' );
3737
* @param {PositiveInteger} M - number of rows in matrix `A`
3838
* @param {PositiveInteger} N - number of columns in matrix `A`
3939
* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix Q
40-
* @param {Float64Array} A - input matrix (overwritten by Householder vectors from `dgeqrf`
40+
* @param {Float64Array} A - input matrix
4141
* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
4242
* @param {Float64Array} tau - vector of K scalar factors of the elementary reflectors
4343
* @param {Float64Array} work - workspace array

lib/node_modules/@stdlib/lapack/base/dorg2r/lib/ndarray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var base = require( './base.js' );
3131
* @param {PositiveInteger} M - number of rows in matrix `A`
3232
* @param {PositiveInteger} N - number of columns in matrix `A`
3333
* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix Q
34-
* @param {Float64Array} A - input matrix (overwritten by Householder vectors from `dgeqrf`
34+
* @param {Float64Array} A - input matrix
3535
* @param {integer} strideA1 - stride of the first dimension of `A`
3636
* @param {integer} strideA2 - stride of the second dimension of `A`
3737
* @param {NonNegativeInteger} offsetA - index offset for `A`

lib/node_modules/@stdlib/lapack/base/dorg2r/test/test.dorg2r.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var dorg2r = require( './../lib/dorg2r.js' );
2727

2828
// FIXTURES //
2929

30+
// Note: the outputs are tested against the outputs of the Fortran implementation.
31+
3032
var COL_MAJOR = require( './fixtures/column_major.json' );
3133
var ROW_MAJOR = require( './fixtures/row_major.json' );
3234
var COL_MAJOR_K_LT_N = require( './fixtures/column_major_k_lt_n.json' );

lib/node_modules/@stdlib/lapack/base/dorg2r/test/test.ndarray.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var dorg2r = require( './../lib/ndarray.js' );
2929

3030
// FIXTURES //
3131

32+
// Note: the outputs are tested against the outputs of the Fortran implementation.
33+
3234
var COL_MAJOR = require( './fixtures/column_major.json' );
3335
var ROW_MAJOR = require( './fixtures/row_major.json' );
3436
var COL_MAJOR_K_LT_N = require( './fixtures/column_major_k_lt_n.json' );

0 commit comments

Comments
 (0)