Skip to content

Commit 6ebd5ab

Browse files
authored
docs: add explainer and add example
Signed-off-by: Athan <kgryte@gmail.com>
1 parent 1792251 commit 6ebd5ab

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/blas/ext/base/gvander

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,49 @@ The function has the following parameters:
5959
- **out**: output matrix.
6060
- **ldo**: stride of the first dimension of `out` (a.k.a., leading dimension of the matrix `out`).
6161

62+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
63+
64+
<!-- eslint-disable stdlib/capitalized-comments -->
65+
66+
```javascript
67+
var Float64Array = require( '@stdlib/array/float64' );
68+
69+
// Initial arrays:
70+
var x0 = new Float64Array( [ 999.0, 1.0, 2.0, 3.0 ] );
71+
var out0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
72+
73+
// Create offset views:
74+
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
75+
var out1 = new Float64Array( out0.buffer, out0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
76+
77+
gvander( 'row-major', 1, 3, 3, x, 1, out, 3 );
78+
// out0 => <Float64Array>[ 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 4.0, 1.0, 3.0, 9.0 ]
79+
```
80+
81+
When the mode is positive, the matrix is generated such that
82+
83+
```text
84+
[
85+
1 x_0^1 x_0^2 ... x_0^(N-1)
86+
1 x_1^1 x_1^2 ... x_1^(N-1)
87+
...
88+
]
89+
```
90+
91+
with increasing powers along the rows.
92+
93+
When the mode is negative, the matrix is generated such that
94+
95+
```text
96+
[
97+
x_0^(N-1) ... x_0^2 x_0^1 1
98+
x_1^(N-1) ... x_1^2 x_1^1 1
99+
...
100+
]
101+
```
102+
103+
with decreasing powers along the rows.
104+
62105
<!-- lint disable maximum-heading-length -->
63106

64107
#### gvander.ndarray( mode, M, N, x, strideX, offsetX, out, strideOut1, strideOut2, offsetOut )

0 commit comments

Comments
 (0)