Skip to content

Commit 6e0cd15

Browse files
committed
chore: clean-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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - 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: passed - task: lint_c_examples status: passed - 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 2f588bc commit 6e0cd15

File tree

7 files changed

+181
-43
lines changed

7 files changed

+181
-43
lines changed

lib/node_modules/@stdlib/blas/base/dger/README.md

Lines changed: 110 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var dger = require( '@stdlib/blas/base/dger' );
3232

3333
#### dger( ord, M, N, α, x, sx, y, sy, A, lda )
3434

35-
Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
35+
Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3636

3737
```javascript
3838
var Float64Array = require( '@stdlib/array/float64' );
@@ -52,13 +52,13 @@ The function has the following parameters:
5252
- **N**: number of columns in the matrix `A`.
5353
- **α**: scalar constant.
5454
- **x**: input [`Float64Array`][mdn-float64array].
55-
- **sx**: index increment for `x`.
55+
- **sx**: stride length for `x`.
5656
- **y**: output [`Float64Array`][mdn-float64array].
57-
- **sy**: index increment for `y`.
57+
- **sy**: stride length for `y`.
5858
- **A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
5959
- **lda**: stride of the first dimension of `A` (leading dimension of `A`).
6060

61-
The stride parameters determine how operations are performed. For example, to iterate over every other element in `x` and `y`,
61+
The stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to iterate over every other element in `x` and `y`,
6262

6363
```javascript
6464
var Float64Array = require( '@stdlib/array/float64' );
@@ -93,7 +93,7 @@ dger( 'column-major', 2, 3, 1.0, x1, -1, y1, -1, A, 2 );
9393

9494
#### dger.ndarray( M, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa )
9595

96-
Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
96+
Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
9797

9898
```javascript
9999
var Float64Array = require( '@stdlib/array/float64' );
@@ -119,12 +119,12 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
119119
```javascript
120120
var Float64Array = require( '@stdlib/array/float64' );
121121

122-
var A = new Float64Array( [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ] );
123-
var x = new Float64Array( [ 1.0, 0.0, 1.0, 0.0 ] );
124-
var y = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] );
122+
var A = new Float64Array( [ 0.0, 0.0, 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ] );
123+
var x = new Float64Array( [ 0.0, 1.0, 0.0, 1.0, 0.0 ] );
124+
var y = new Float64Array( [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] );
125125

126-
dger.ndarray( 2, 3, 1.0, x, 2, 0, y, 2, 0, A, 1, 2, 0 );
127-
// A => <Float64Array>[ 2.0, 5.0, 3.0, 6.0, 4.0, 7.0 ]
126+
dger.ndarray( 2, 3, 1.0, x, 2, 1, y, 2, 1, A, 1, 2, 2 );
127+
// A => <Float64Array>[ 0.0, 0.0, 2.0, 5.0, 3.0, 6.0, 4.0, 7.0 ]
128128
```
129129

130130
</section>
@@ -200,18 +200,80 @@ console.log(A);
200200
#include "stdlib/blas/base/dger.h"
201201
```
202202

203-
#### TODO
203+
#### c_dger( layout, M, N, alpha, \*X, strideX, \*Y, strideY, \*A, LDA )
204204

205-
TODO.
205+
Performs the rank 1 operation `A = alpha*x*y^T + A`, where `alpha` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M`-by-`N` matrix.
206206

207207
```c
208-
TODO
208+
#include "stdlib/blas/base/shared.h"
209+
210+
double A[ 3*4 ] = {
211+
0.0, 0.0, 0.0, 0.0,
212+
0.0, 0.0, 0.0, 0.0,
213+
0.0, 0.0, 0.0, 0.0
214+
};
215+
216+
const double x[ 3 ] = { 1.0, 4.0, 0.0 };
217+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 };
218+
219+
c_dger( CblasRowMajor, 3, 4, 1.0, x, 1, y, 1, A, 4 );
209220
```
210221
211-
TODO
222+
The function accepts the following arguments:
223+
224+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
225+
- **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
226+
- **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
227+
- **alpha**: `[in] double` scalar constant.
228+
- **X**: `[in] double*` an `M` element vector.
229+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
230+
- **Y**: `[in] double*` an `N` element vector.
231+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
232+
- **A**: `[inout] double*` input matrix.
233+
- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
212234
213235
```c
214-
TODO
236+
void c_dger( const CBLAS_LAYOUT layout, const CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *A, const CBLAS_INT LDA );
237+
```
238+
239+
#### c_dger_ndarray( M, N, alpha, \*X, sx, ox, \*Y, sy, oy, \*A, sa1, sa2, oa )
240+
241+
Performs the rank 1 operation `A = alpha*x*y^T + A`, using alternative indexing semantics and where `alpha` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M`-by-`N` matrix.
242+
243+
```c
244+
#include "stdlib/blas/base/shared.h"
245+
246+
double A[ 3*4 ] = {
247+
0.0, 0.0, 0.0, 0.0,
248+
0.0, 0.0, 0.0, 0.0,
249+
0.0, 0.0, 0.0, 0.0
250+
};
251+
252+
const double x[ 3 ] = { 1.0, 4.0, 0.0 };
253+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 };
254+
255+
c_dger_ndarray( 3, 4, 1.0, x, 1, 0, y, 1, 0, A, 4, 1, 0 );
256+
```
257+
258+
The function accepts the following arguments:
259+
260+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
261+
- **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
262+
- **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
263+
- **alpha**: `[in] double` scalar constant.
264+
- **X**: `[in] double*` an `M` element vector.
265+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
266+
- **ox**: `[in] CBLAS_INT` starting index for `X`.
267+
- **Y**: `[in] double*` an `N` element vector.
268+
- **sy**: `[in] CBLAS_INT` stride length for `Y`.
269+
- **oy**: `[in] CBLAS_INT` starting index for `Y`.
270+
- **A**: `[inout] double*` input matrix.
271+
- **sa1**: `[in] CBLAS_INT` stride of the first dimension of `A`.
272+
- **sa2**: `[in] CBLAS_INT` stride of the second dimension of `A`.
273+
- **oa**: `[in] CBLAS_INT` starting index for `A`.
274+
275+
```c
276+
void c_dger( onst CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA );
215277
```
216278

217279
</section>
@@ -233,7 +295,39 @@ TODO
233295
### Examples
234296

235297
```c
236-
TODO
298+
#include "stdlib/blas/base/dger.h"
299+
#include "stdlib/blas/base/shared.h"
300+
#include <stdio.h>
301+
302+
int main( void ) {
303+
// Define a 3x4 matrix stored in row-major order:
304+
double A[ 3*4 ] = {
305+
0.0, 0.0, 0.0, 0.0,
306+
0.0, 0.0, 0.0, 0.0,
307+
0.0, 0.0, 0.0, 0.0
308+
};
309+
// Define `x` and `y^T` vectors:
310+
const double x[ 3 ] = { 1.0, 4.0, 0.0 }; // M
311+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 }; // N
312+
313+
// Specify the number of rows and columns:
314+
const int M = 3;
315+
const int N = 4;
316+
317+
// Specify stride lengths:
318+
const int strideX = 1;
319+
const int strideY = 1;
320+
321+
// Perform operation:
322+
c_dger( CblasRowMajor, M, N, 1.0, x, strideX, y, strideY, A, N );
323+
324+
// Print the result:
325+
for ( int i = 0; i < M; i++ ) {
326+
for ( int j = 0; j < N; j++ ) {
327+
printf( "A[%i,%i] = %lf\n", i, j, A[ (i*N)+j ] );
328+
}
329+
}
330+
}
237331
```
238332
239333
</section>

lib/node_modules/@stdlib/blas/base/dger/docs/repl.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
{{alias}}( ord, M, N, α, x, sx, y, sy, A, lda )
33
Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x`
4-
is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by
4+
is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by
55
`N` matrix.
66

77
Indexing is relative to the first index. To introduce an offset, use typed
88
array views.
99

10-
If `M` or `N` or `α` is equal to `0`, the function returns `A` unchanged.
10+
If `M`, `N`, or `α` is equal to `0`, the function returns `A` unchanged.
1111

1212
Parameters
1313
----------
@@ -27,13 +27,13 @@
2727
First input vector.
2828

2929
sx: integer
30-
Index increment for `x`.
30+
Stride length for `x`.
3131

3232
y: Float64Array
3333
Second input vector.
3434

3535
sy: integer
36-
Index increment for `y`.
36+
Stride length for `y`.
3737

3838
A: Float64Array
3939
Input Matrix.
@@ -68,7 +68,7 @@
6868
{{alias}}.ndarray( M, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa )
6969
Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing
7070
semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an
71-
`N` element vector and `A` is an `M` by `N` matrix.
71+
`N` element vector, and `A` is an `M` by `N` matrix.
7272

7373
While typed array views mandate a view offset based on the underlying
7474
buffer, the offset parameters support indexing semantics based on starting
@@ -89,7 +89,7 @@
8989
First input vector.
9090

9191
sx: integer
92-
Index increment for `x`.
92+
Stride length for `x`.
9393

9494
ox: integer
9595
Starting index for `x`.
@@ -98,7 +98,7 @@
9898
Second input vector.
9999

100100
sy: integer
101-
Index increment for `y`.
101+
Stride length for `y`.
102102

103103
oy: integer
104104
Starting index for `y`.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { Layout } from '@stdlib/types/blas';
2727
*/
2828
interface Routine {
2929
/**
30-
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
30+
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
3131
*
3232
* @param order - storage layout
3333
* @param M - number of rows in the matrix `A`
@@ -54,7 +54,7 @@ interface Routine {
5454
( order: Layout, M: number, N: number, alpha: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number, A: Float64Array, LDA: number ): Float64Array;
5555

5656
/**
57-
* Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
57+
* Performs the rank 1 operation `A = α*x*y^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
5858
*
5959
* @param M - number of rows in the matrix `A`
6060
* @param N - number of columns in the matrix `A`
@@ -85,7 +85,7 @@ interface Routine {
8585
}
8686

8787
/**
88-
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector and `A` is an `M` by `N` matrix.
88+
* Performs the rank 1 operation `A = α*x*y^T + A`, where `α` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M` by `N` matrix.
8989
*
9090
* @param order - storage layout
9191
* @param M - number of rows in the matrix `A`

lib/node_modules/@stdlib/blas/base/dger/examples/c/example.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,31 @@
2121
#include <stdio.h>
2222

2323
int main( void ) {
24-
// Define a 4x3 matrix `B` stored in row-major order (i.e., equivalent to the transpose `A^T` of a 3x4 matrix `A` stored in column-major order):
25-
double B[ 4*3 ] = {
24+
// Define a 3x4 matrix stored in row-major order:
25+
double A[ 3*4 ] = {
2626
0.0, 0.0, 0.0, 0.0,
2727
0.0, 0.0, 0.0, 0.0,
2828
0.0, 0.0, 0.0, 0.0
2929
};
30-
// Define `x^T` and `y` vectors:
31-
double x[ 4 ] = { 0.0, 1.0, 2.0, 3.0 }; // M
32-
double y[ 3 ] = { 1.0, 4.0, 0.0 }; // N
30+
// Define `x` and `y^T` vectors:
31+
const double x[ 3 ] = { 1.0, 4.0, 0.0 }; // M
32+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 }; // N
3333

3434
// Specify the number of rows and columns:
35-
const int M = 4;
36-
const int N = 3;
35+
const int M = 3;
36+
const int N = 4;
3737

3838
// Specify stride lengths:
3939
const int strideX = 1;
4040
const int strideY = 1;
4141

42-
// Specify the matrix layout:
43-
const CBLAS_LAYOUT layout = CblasRowMajor;
44-
45-
// Perform operation (note: arguments are reordered as: A_{M,N} = α⋅x_M⋅y^T_N + A_{M,N} => B = A^T = α⋅y⋅x^T + A^T = α⋅y⋅x^T + B):
46-
c_dger( layout, N, M, 1.0, y, strideY, x, strideX, B, M );
42+
// Perform operation:
43+
c_dger( CblasRowMajor, M, N, 1.0, x, strideX, y, strideY, A, N );
4744

4845
// Print the result:
49-
for ( int i = 0; i < N; i++ ) {
50-
for ( int j = 0; j < M; j++ ) {
51-
printf( "B[%i,%i] = %lf\n", i, j, B[ (i*M)+j ] );
46+
for ( int i = 0; i < M; i++ ) {
47+
for ( int j = 0; j < N; j++ ) {
48+
printf( "A[%i,%i] = %lf\n", i, j, A[ (i*N)+j ] );
5249
}
5350
}
5451
}

lib/node_modules/@stdlib/blas/base/dger/include/stdlib/blas/base/dger.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ extern "C" {
3636
*/
3737
void API_SUFFIX(c_dger)( const CBLAS_LAYOUT layout, const CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *A, const CBLAS_INT LDA );
3838

39+
/**
40+
* Performs the rank 1 operation `A = alpha*x*y^T + A`, using alternative indexing semantics and where `alpha` is a scalar, `x` is an `M` element vector, `y` is an `N` element vector, and `A` is an `M`-by-`N` matrix.
41+
*/
42+
void API_SUFFIX(c_dger_ndarray)( const CBLAS_INT M, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA );
43+
3944
#ifdef __cplusplus
4045
}
4146
#endif

lib/node_modules/@stdlib/blas/base/dger/manifest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@stdlib/napi/argv-int64",
5151
"@stdlib/napi/argv-int32",
5252
"@stdlib/napi/argv-strided-float64array",
53+
"@stdlib/napi/argv-strided-float64array2d",
5354
"@stdlib/napi/argv-double"
5455
]
5556
},
@@ -113,6 +114,7 @@
113114
"@stdlib/napi/argv-int64",
114115
"@stdlib/napi/argv-int32",
115116
"@stdlib/napi/argv-strided-float64array",
117+
"@stdlib/napi/argv-strided-float64array2d",
116118
"@stdlib/napi/argv-double"
117119
]
118120
},
@@ -179,6 +181,7 @@
179181
"@stdlib/napi/argv-int64",
180182
"@stdlib/napi/argv-int32",
181183
"@stdlib/napi/argv-strided-float64array",
184+
"@stdlib/napi/argv-strided-float64array2d",
182185
"@stdlib/napi/argv-double"
183186
]
184187
},
@@ -241,6 +244,7 @@
241244
"@stdlib/napi/argv-int64",
242245
"@stdlib/napi/argv-int32",
243246
"@stdlib/napi/argv-strided-float64array",
247+
"@stdlib/napi/argv-strided-float64array2d",
244248
"@stdlib/napi/argv-double"
245249
]
246250
},
@@ -306,6 +310,7 @@
306310
"@stdlib/napi/argv-int64",
307311
"@stdlib/napi/argv-int32",
308312
"@stdlib/napi/argv-strided-float64array",
313+
"@stdlib/napi/argv-strided-float64array2d",
309314
"@stdlib/napi/argv-double"
310315
]
311316
},
@@ -371,6 +376,7 @@
371376
"@stdlib/napi/argv-int64",
372377
"@stdlib/napi/argv-int32",
373378
"@stdlib/napi/argv-strided-float64array",
379+
"@stdlib/napi/argv-strided-float64array2d",
374380
"@stdlib/napi/argv-double"
375381
]
376382
},

0 commit comments

Comments
 (0)