Skip to content

Commit 791abf2

Browse files
committed
refactor: 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: passed - 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: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - 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: passed - task: lint_license_headers status: passed ---
1 parent efad4c2 commit 791abf2

13 files changed

Lines changed: 219 additions & 229 deletions

File tree

lib/node_modules/@stdlib/blas/ext/base/dvander/README.md

Lines changed: 30 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ limitations under the License.
2222

2323
> Generate a double-precision floating-point Vandermonde matrix.
2424
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
2531
<section class="usage">
2632

2733
## Usage
@@ -30,7 +36,7 @@ limitations under the License.
3036
var dvander = require( '@stdlib/blas/ext/base/dvander' );
3137
```
3238

33-
#### dvander( order, mode, M, N, x, strideX, out, LDO )
39+
#### dvander( order, mode, M, N, x, strideX, out, ldo )
3440

3541
Generates a double-precision floating-point Vandermonde matrix.
3642

@@ -46,45 +52,14 @@ dvander( 'row-major', -1, 3, 3, x, 1, out, 3 );
4652

4753
The function has the following parameters:
4854

49-
- **order**: storage layout.
50-
- **mode**: specifies whether columns should contain powers that are increasing (`1`) or decreasing (`-1`).
51-
- **M**: number of rows in `out`.
55+
- **order**: row-major (C-style) or column-major (Fortran-style) order.
56+
- **mode**: mode. If `mode < 0`, the function generates decreasing powers. If `mode > 0`, the function generates increasing powers.
57+
- **M**: number of rows in `out` and number of indexed elements in `x`.
5258
- **N**: number of columns in `out`.
5359
- **x**: input [`Float64Array`][@stdlib/array/float64].
5460
- **strideX**: stride length for `x`.
55-
- **out**: output [`Float64Array`][@stdlib/array/float64].
56-
- **LDO**: stride length for the leading dimension of `out`.
57-
58-
The stride parameter determines which elements in the input array are accessed at runtime. For example, to use every other element in `x`,
59-
60-
```javascript
61-
var Float64Array = require( '@stdlib/array/float64' );
62-
63-
var x = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] );
64-
var out = new Float64Array( 9 );
65-
66-
dvander( 'row-major', -1, 3, 3, x, 2, out, 3 );
67-
// out => <Float64Array>[ 1.0, 1.0, 1.0, 4.0, 2.0, 1.0, 9.0, 3.0, 1.0 ]
68-
```
69-
70-
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
71-
72-
<!-- eslint-disable stdlib/capitalized-comments -->
73-
74-
```javascript
75-
var Float64Array = require( '@stdlib/array/float64' );
76-
77-
// Initial array...
78-
var x0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
79-
80-
// Create an offset view...
81-
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
82-
83-
var out = new Float64Array( 9 );
84-
85-
dvander( 'row-major', -1, 3, 3, x1, 1, out, 3 );
86-
// out => <Float64Array>[ 1.0, 1.0, 1.0, 4.0, 2.0, 1.0, 9.0, 3.0, 1.0 ]
87-
```
61+
- **out**: output matrix stored in linear memory as a [`Float64Array`][@stdlib/array/float64].
62+
- **ldo**: stride of the first dimension of `out` (a.k.a., leading dimension of the matrix `out`).
8863

8964
<!-- lint disable maximum-heading-length -->
9065

@@ -107,22 +82,10 @@ dvander.ndarray( -1, 3, 3, x, 1, 0, out, 3, 1, 0 );
10782
The function has the following additional parameters:
10883

10984
- **offsetX**: starting index for `x`.
110-
- **strideOut1**: stride of the first dimension of `out`.
111-
- **strideOut2**: stride of the second dimension of `out`.
85+
- **strideOut1**: stride length for the first dimension of `out`.
86+
- **strideOut2**: stride length for the second dimension of `out`.
11287
- **offsetOut**: starting index for `out`.
11388

114-
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,
115-
116-
```javascript
117-
var Float64Array = require( '@stdlib/array/float64' );
118-
119-
var x = new Float64Array( [ 0.0, 1.0, 2.0, 3.0 ] );
120-
var out = new Float64Array( 9 );
121-
122-
dvander.ndarray( -1, 3, 3, x, 1, 1, out, 3, 1, 0 );
123-
// out => <Float64Array>[ 1.0, 1.0, 1.0, 4.0, 2.0, 1.0, 9.0, 3.0, 1.0 ]
124-
```
125-
12689
</section>
12790

12891
<!-- /.usage -->
@@ -131,7 +94,7 @@ dvander.ndarray( -1, 3, 3, x, 1, 1, out, 3, 1, 0 );
13194

13295
## Notes
13396

134-
- If `M` or `N` is equal to `0`, both functions return `out` unchanged.
97+
- If `M <= 0` or `N <= 0`, both functions return the output matrix unchanged.
13598

13699
</section>
137100

@@ -206,13 +169,13 @@ stdlib_strided_dvander( CblasRowMajor, -1.0, 3, 3, x, 1, Out, 3 );
206169
The function accepts the following arguments:
207170
208171
- **order**: `[in] CBLAS_LAYOUT` storage layout.
209-
- **mode**: `[in] double` specifies whether powers are increasing (`1`) or decreasing (`-1`).
210-
- **M**: `[in] CBLAS_INT` number of rows in `Out`.
172+
- **mode**: `[in] double` mode. If `mode < 0`, the function generates decreasing powers. If `mode > 0`, the function generates increasing powers.
173+
- **M**: `[in] CBLAS_INT` number of rows in `Out` and number of indexed elements in `X`.
211174
- **N**: `[in] CBLAS_INT` number of columns in `Out`.
212175
- **X**: `[in] double*` input array.
213176
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
214-
- **Out**: `[out] double*` output array.
215-
- **LDO**: `[in] CBLAS_INT` stride length for the leading dimension of `out`.
177+
- **Out**: `[out] double*` output matrix.
178+
- **LDO**: `[in] CBLAS_INT` stride of the first dimension of `Out` (a.k.a., leading dimension of the matrix `Out`).
216179
217180
```c
218181
void API_SUFFIX(stdlib_strided_dvander)( const CBLAS_LAYOUT order, const double mode, const CBLAS_INT M, const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Out, const CBLAS_INT LDO );
@@ -237,15 +200,15 @@ stdlib_strided_dvander_ndarray( -1.0, 3, 3, x, 1, 0, Out, 3, 1, 0 );
237200
238201
The function accepts the following arguments:
239202
240-
- **mode**: `[in] double` specifies whether powers are increasing (`1`) or decreasing (`-1`).
241-
- **M**: `[in] CBLAS_INT` number of rows in `Out`.
203+
- **mode**: `[in] double` mode. If `mode < 0`, the function generates decreasing powers. If `mode > 0`, the function generates increasing powers.
204+
- **M**: `[in] CBLAS_INT` number of rows in `Out` and number of indexed elements in `X`.
242205
- **N**: `[in] CBLAS_INT` number of columns in `Out`.
243206
- **X**: `[in] double*` input array.
244207
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
245208
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
246-
- **Out**: `[out] double*` output array.
247-
- **strideOut1**: `[in] CBLAS_INT` stride of the first dimension of `Out`.
248-
- **strideOut2**: `[in] CBLAS_INT` stride of the second dimension of `Out`.
209+
- **Out**: `[out] double*` output matrix.
210+
- **strideOut1**: `[in] CBLAS_INT` stride length for the first dimension of `Out`.
211+
- **strideOut2**: `[in] CBLAS_INT` stride length for the second dimension of `Out`.
249212
- **offsetOut**: `[in] CBLAS_INT` starting index for `Out`.
250213
251214
```c
@@ -306,6 +269,12 @@ int main( void ) {
306269
307270
<!-- /.c -->
308271
272+
<section class="references">
273+
274+
</section>
275+
276+
<!-- /.references -->
277+
309278
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
310279
311280
<section class="related">
@@ -320,8 +289,6 @@ int main( void ) {
320289
321290
[@stdlib/array/float64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/float64
322291
323-
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
324-
325292
</section>
326293
327294
<!-- /.links -->

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

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11

2-
{{alias}}( order, mode, M, N, x, strideX, out, LDO )
2+
{{alias}}( order, mode, M, N, x, strideX, out, ldo )
33
Generates a double-precision floating-point Vandermonde matrix.
44

5-
Indexing is relative to the first index. To introduce an offset, use typed
6-
array views.
5+
When the mode is positive, the matrix is generated such that
76

8-
If `M` or `N` is equal to `0`, the function returns `out` unchanged.
7+
[
8+
1 x_0^1 x_0^2 ... x_0^N
9+
1 x_1^1 x_1^2 ... x_1^N
10+
...
11+
]
12+
13+
with increasing powers along the rows.
14+
15+
When the mode is negative, the matrix is generated such that
16+
17+
[
18+
x_0^N ... x_0^2 x_0^1 1
19+
x_1^N ... x_1^2 x_1^1 1
20+
...
21+
]
22+
23+
with decreasing powers along the rows.
24+
25+
If `M <= 0` or `N <= 0`, the function returns the output matrix
26+
unchanged.
927

1028
Parameters
1129
----------
1230
order: string
1331
Row-major (C-style) or column-major (Fortran-style) order.
1432

1533
mode: number
16-
Specifies whether columns should contain powers that are increasing
17-
(`1`) or decreasing (`-1`).
34+
Mode. If `mode < 0`, the function generates decreasing powers. If
35+
`mode > 0`, the function generates increasing powers.
1836

1937
M: integer
20-
Number of rows in `out`.
38+
Number of rows in `out` and number of indexed elements in `x`.
2139

2240
N: integer
2341
Number of columns in `out`.
@@ -29,15 +47,16 @@
2947
Stride length for `x`.
3048

3149
out: Float64Array
32-
Output array.
50+
Output matrix.
3351

34-
LDO: integer
35-
Stride length for the leading dimension of `out`.
52+
ldo: integer
53+
Stride of the first dimension of `out` (a.k.a., leading dimension
54+
of the matrix `out`).
3655

3756
Returns
3857
-------
3958
out: Float64Array
40-
Output array.
59+
Output matrix.
4160

4261
Examples
4362
--------
@@ -52,18 +71,14 @@
5271
Generates a double-precision floating-point Vandermonde matrix using
5372
alternative indexing semantics.
5473

55-
While typed array views mandate a view offset based on the underlying
56-
buffer, the offset parameters support indexing semantics based on starting
57-
indices.
58-
5974
Parameters
6075
----------
6176
mode: number
62-
Specifies whether columns should contain powers that are increasing
63-
(`1`) or decreasing (`-1`).
77+
Mode. If `mode < 0`, the function generates decreasing powers. If
78+
`mode > 0`, the function generates increasing powers.
6479

6580
M: integer
66-
Number of rows in `out`.
81+
Number of rows in `out` and number of indexed elements in `x`.
6782

6883
N: integer
6984
Number of columns in `out`.
@@ -78,21 +93,21 @@
7893
Starting index for `x`.
7994

8095
out: Float64Array
81-
Output array.
96+
Output matrix.
8297

8398
so1: integer
84-
Stride of the first dimension of `out`.
99+
Stride length for the first dimension of `out`.
85100

86101
so2: integer
87-
Stride of the second dimension of `out`.
102+
Stride length for the second dimension of `out`.
88103

89104
oo: integer
90105
Starting index for `out`.
91106

92107
Returns
93108
-------
94109
out: Float64Array
95-
Output array.
110+
Output matrix.
96111

97112
Examples
98113
--------

lib/node_modules/@stdlib/blas/ext/base/dvander/docs/types/index.d.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ interface Routine {
3030
* Generates a double-precision floating-point Vandermonde matrix.
3131
*
3232
* @param order - storage layout
33-
* @param mode - specifies whether columns should contain powers that are increasing or decreasing
34-
* @param M - number of rows in `out`
33+
* @param mode - mode indicating whether to generate increasing or decreasing powers
34+
* @param M - number of rows in `out` and number of indexed elements in `x`
3535
* @param N - number of columns in `out`
3636
* @param x - input array
3737
* @param strideX - stride length for `x`
38-
* @param out - output array
39-
* @param LDO - stride length for the leading dimension of `Out`
40-
* @returns output array
38+
* @param out - output matrix
39+
* @param ldo - stride of the first dimension of `out` (a.k.a., leading dimension of the matrix `out`)
40+
* @returns output matrix
4141
*
4242
* @example
4343
* var Float64Array = require( '@stdlib/array/float64' );
@@ -48,22 +48,22 @@ interface Routine {
4848
* dvander( 'row-major', -1, 3, 3, x, 1, out, 3 );
4949
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 4.0, 2.0, 1.0, 9.0, 3.0, 1.0 ]
5050
*/
51-
( order: Layout, mode: number, M: number, N: number, x: Float64Array, strideX: number, out: Float64Array, LDO: number ): Float64Array;
51+
( order: Layout, mode: number, M: number, N: number, x: Float64Array, strideX: number, out: Float64Array, ldo: number ): Float64Array;
5252

5353
/**
5454
* Generates a double-precision floating-point Vandermonde matrix using alternative indexing semantics.
5555
*
56-
* @param mode - specifies whether columns should contain powers that are increasing or decreasing
57-
* @param M - number of rows in `out`
56+
* @param mode - mode indicating whether to generate increasing or decreasing powers
57+
* @param M - number of rows in `out` and number of indexed elements in `x`
5858
* @param N - number of columns in `out`
5959
* @param x - input array
6060
* @param strideX - stride length for `x`
6161
* @param offsetX - starting index for `x`
62-
* @param out - output array
63-
* @param strideOut1 - stride of the first dimension of `Out`
64-
* @param strideOut2 - stride of the second dimension of `Out`
65-
* @param offsetOut - starting index for `Out`
66-
* @returns output array
62+
* @param out - output matrix
63+
* @param strideOut1 - stride length for the first dimension of `out`
64+
* @param strideOut2 - stride length for the second dimension of `out`
65+
* @param offsetOut - starting index for `out`
66+
* @returns output matrix
6767
*
6868
* @example
6969
* var Float64Array = require( '@stdlib/array/float64' );
@@ -81,14 +81,14 @@ interface Routine {
8181
* Generates a double-precision floating-point Vandermonde matrix.
8282
*
8383
* @param order - storage layout
84-
* @param mode - specifies whether columns should contain powers that are increasing or decreasing
85-
* @param M - number of rows in `out`
84+
* @param mode - mode indicating whether to generate increasing or decreasing powers
85+
* @param M - number of rows in `out` and number of indexed elements in `x`
8686
* @param N - number of columns in `out`
8787
* @param x - input array
8888
* @param strideX - stride length for `x`
89-
* @param out - output array
90-
* @param LDO - stride length for the leading dimension of `Out`
91-
* @returns output array
89+
* @param out - output matrix
90+
* @param ldo - stride of the first dimension of `out` (a.k.a., leading dimension of the matrix `out`)
91+
* @returns output matrix
9292
*
9393
* @example
9494
* var Float64Array = require( '@stdlib/array/float64' );

0 commit comments

Comments
 (0)