Skip to content

Commit 1cf43b0

Browse files
committed
fix: apply suggestions from code review
--- 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: passed - 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 9d15ffa commit 1cf43b0

File tree

3 files changed

+35
-28
lines changed

3 files changed

+35
-28
lines changed

lib/node_modules/@stdlib/blas/ext/base/gvander/docs/repl.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
When the mode is positive, the matrix is generated such that
66

77
[
8-
1 x_0^1 x_0^2 ... x_0^N
9-
1 x_1^1 x_1^2 ... x_1^N
8+
1 x_0^1 x_0^2 ... x_0^(N-1)
9+
1 x_1^1 x_1^2 ... x_1^(N-1)
1010
...
1111
]
1212

@@ -15,8 +15,8 @@
1515
When the mode is negative, the matrix is generated such that
1616

1717
[
18-
x_0^N ... x_0^2 x_0^1 1
19-
x_1^N ... x_1^2 x_1^1 1
18+
x_0^(N-1) ... x_0^2 x_0^1 1
19+
x_1^(N-1) ... x_1^2 x_1^1 1
2020
...
2121
]
2222

lib/node_modules/@stdlib/blas/ext/base/gvander/lib/accessors.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ function gvander( mode, M, N, x, sx, ox, out, so1, so2, oo ) {
107107
S0 = N;
108108
S1 = M;
109109
do0 = so2;
110-
do1 = so1 + ( S0*so2 );
111-
io = oo + ( ( S0-1 ) * do0 );
112-
ix = ox;
113-
for ( i1 = 0; i1 < S1; i1++ ) {
110+
do1 = so1 - ( S0*so2 );
111+
io = oo + ( ( S1-1 ) * so1 ) + ( ( S0-1 ) * so2 );
112+
ix = ox + ( ( S1-1 ) * sx );
113+
for ( i1 = S1-1; i1 >= 0; i1-- ) {
114114
v = xget( xbuf, ix );
115115
oset( obuf, io, 1.0 );
116116
tmp = 1.0;
@@ -120,8 +120,8 @@ function gvander( mode, M, N, x, sx, ox, out, so1, so2, oo ) {
120120
oset( obuf, io, tmp );
121121
io -= do0;
122122
}
123-
ix += sx;
124-
io += do1;
123+
ix -= sx;
124+
io -= do1;
125125
}
126126
} else if ( mode > 0 ) {
127127
// Column-major, increasing: column j contains x^j
@@ -145,15 +145,18 @@ function gvander( mode, M, N, x, sx, ox, out, so1, so2, oo ) {
145145
// Column-major, decreasing: column 0 contains x^(N-1), last column all ones
146146
S0 = M;
147147
S1 = N;
148+
do0 = so1;
149+
do1 = so2 - ( S0*so1 );
148150
gfill( S0, 1.0, obuf, so1, oo + ( ( S1-1 ) * so2 ) );
149-
for ( i1 = S1 - 2; i1 >= 0; i1-- ) {
150-
io = oo + ( i1 * so2 );
151-
ix = ox;
152-
for ( i0 = 0; i0 < S0; i0++ ) {
151+
io = oo + ( ( S1-2 ) * so2 ) + ( ( S0-1 ) * so1 );
152+
for ( i1 = S1-2; i1 >= 0; i1-- ) {
153+
ix = ox + ( ( S0-1 ) * sx );
154+
for ( i0 = S0-1; i0 >= 0; i0-- ) {
153155
oset( obuf, io, oget( obuf, io + so2 ) * xget( xbuf, ix ) );
154-
ix += sx;
155-
io += so1;
156+
ix -= sx;
157+
io -= do0;
156158
}
159+
io -= do1;
157160
}
158161
}
159162
return obuf;

lib/node_modules/@stdlib/blas/ext/base/gvander/lib/base.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ function gvander( mode, M, N, x, strideX, offsetX, out, strideOut1, strideOut2,
8181
S0 = N;
8282
S1 = M;
8383
do0 = strideOut2;
84-
ix = offsetX;
8584

8685
// Increasing: x^0, x^1, ..., x^(N-1)
8786
if ( mode > 0 ) {
8887
do1 = strideOut1 - ( S0*strideOut2 );
8988
io = offsetOut;
89+
ix = offsetX;
9090
for ( i1 = 0; i1 < S1; i1++ ) {
9191
out[ io ] = 1.0;
9292
io += do0;
@@ -100,24 +100,25 @@ function gvander( mode, M, N, x, strideX, offsetX, out, strideOut1, strideOut2,
100100
return out;
101101
}
102102
// Decreasing: x^(N-1), x^(N-2), ..., x^0
103-
do1 = strideOut1 + ( S0*strideOut2 );
104-
io = offsetOut + ( ( S0-1 ) * strideOut2 );
105-
for ( i1 = 0; i1 < S1; i1++ ) {
103+
do1 = strideOut1 - ( S0*strideOut2 );
104+
io = offsetOut + ( ( S1-1 ) * strideOut1 ) + ( ( S0-1 ) * strideOut2 );
105+
ix = offsetX + ( ( S1-1 ) * sx );
106+
for ( i1 = S1-1; i1 >= 0; i1-- ) {
106107
out[ io ] = 1.0;
107108
io -= do0;
108109
for ( i0 = 1; i0 < S0; i0++ ) {
109110
out[ io ] = out[ io+do0 ] * x[ ix ];
110111
io -= do0;
111112
}
112-
ix += sx;
113-
io += do1;
113+
ix -= sx;
114+
io -= do1;
114115
}
115116
return out;
116117
}
117118
// Column-major...
118119
S0 = M;
119120
S1 = N;
120-
121+
121122
// Increasing: column j contains x^j
122123
if ( mode > 0 ) {
123124
gfill( S0, 1.0, out, strideOut1, offsetOut );
@@ -137,14 +138,17 @@ function gvander( mode, M, N, x, strideX, offsetX, out, strideOut1, strideOut2,
137138
}
138139
// Decreasing: column 0 contains x^(N-1), last column all ones
139140
gfill( S0, 1.0, out, strideOut1, offsetOut + ( ( S1-1 ) * strideOut2 ) );
141+
do0 = strideOut1;
142+
do1 = strideOut2 - ( S0*strideOut1 );
143+
io = offsetOut + ( ( S1-2 ) * strideOut2 ) + ( ( S0-1 ) * strideOut1 );
140144
for ( i1 = S1-2; i1 >= 0; i1-- ) {
141-
io = offsetOut + ( i1*strideOut2 );
142-
ix = offsetX;
143-
for ( i0 = 0; i0 < S0; i0++ ) {
145+
ix = offsetX + ( ( S0-1 ) * sx );
146+
for ( i0 = S0-1; i0 >= 0; i0-- ) {
144147
out[ io ] = out[ io+strideOut2 ] * x[ ix ];
145-
ix += sx;
146-
io += strideOut1;
148+
ix -= sx;
149+
io -= do0;
147150
}
151+
io -= do1;
148152
}
149153
return out;
150154
}

0 commit comments

Comments
 (0)