You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,12 +20,10 @@ limitations under the License.
20
20
21
21
# dger
22
22
23
-
> TODO.
23
+
> Perform the rank 1 operation `A = α*x*y^T + A`.
24
24
25
25
<sectionclass="intro">
26
26
27
-
TODO
28
-
29
27
</section>
30
28
31
29
<!-- /.intro -->
@@ -38,15 +36,102 @@ TODO
38
36
var dger =require( '@stdlib/blas/base/dger' );
39
37
```
40
38
41
-
#### TODO
39
+
#### dger( ord, M, N, α, x, sx, y, sy, A, lda )
40
+
41
+
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.
-**A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
65
+
-**lda**: stride of the first dimension of `A` (leading dimension of `A`).
66
+
67
+
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`,
#### dger.ndarray( M, N, α, x, sx, ox, y, sy, oy, A, sa1, sa2, oa )
101
+
102
+
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.
The function has the following additional parameters:
116
+
117
+
-**sa1**: stride of the first dimension of `A`.
118
+
-**sa2**: stride of the second dimension of `A`.
119
+
-**oa**: starting index for `A`.
120
+
-**ox**: starting index for `x`.
121
+
-**oy**: starting index for `y`.
122
+
123
+
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,
-`dger()` corresponds to the [BLAS][blas] level 2 function [`dger`][dger].
144
+
-`dger()` corresponds to the [BLAS][blas] level 2 function [`dger`][blas-dger].
60
145
61
146
</section>
62
147
@@ -69,7 +154,26 @@ TODO
69
154
<!-- eslint no-undef: "error" -->
70
155
71
156
```javascript
72
-
/* to-do */
157
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
158
+
var dger =require( '@stdlib/blas/base/dger' );
159
+
160
+
var opts = {
161
+
'dtype':'float64'
162
+
};
163
+
164
+
varM=3;
165
+
varN=5;
166
+
167
+
varA=discreteUniform( M*N, 0, 255, opts );
168
+
var x =discreteUniform( M, 0, 255, opts );
169
+
var y =discreteUniform( N, 0, 255, opts );
170
+
171
+
dger( 'row-major', M, N, 1.0, x, 1, y, 1, A, N );
172
+
console.log( A );
173
+
174
+
dger.ndarray( M, N, 1.0, x, 1, 0, y, 1, 0, A, 1, M, 0 );
175
+
console.log(A);
176
+
73
177
```
74
178
75
179
</section>
@@ -102,18 +206,80 @@ TODO
102
206
#include"stdlib/blas/base/dger.h"
103
207
```
104
208
105
-
#### TODO
209
+
#### c_dger( layout, M, N, alpha, \*X, strideX, \*Y, strideY, \*A, LDA )
106
210
107
-
TODO.
211
+
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.
108
212
109
213
```c
110
-
TODO
214
+
#include"stdlib/blas/base/shared.h"
215
+
216
+
double A[ 3*4 ] = {
217
+
0.0, 0.0, 0.0, 0.0,
218
+
0.0, 0.0, 0.0, 0.0,
219
+
0.0, 0.0, 0.0, 0.0
220
+
};
221
+
222
+
constdouble x[ 3 ] = { 1.0, 4.0, 0.0 };
223
+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 };
224
+
225
+
c_dger( CblasRowMajor, 3, 4, 1.0, x, 1, y, 1, A, 4 );
111
226
```
112
227
113
-
TODO
228
+
The function accepts the following arguments:
229
+
230
+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
231
+
- **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
232
+
- **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
233
+
- **alpha**: `[in] double` scalar constant.
234
+
- **X**: `[in] double*` an `M` element vector.
235
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
236
+
- **Y**: `[in] double*` an `N` element vector.
237
+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
238
+
- **A**: `[inout] double*` input matrix.
239
+
- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
#### c_dger_ndarray( M, N, alpha, \*X, sx, ox, \*Y, sy, oy, \*A, sa1, sa2, oa )
246
+
247
+
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.
248
+
249
+
```c
250
+
#include"stdlib/blas/base/shared.h"
251
+
252
+
double A[ 3*4 ] = {
253
+
0.0, 0.0, 0.0, 0.0,
254
+
0.0, 0.0, 0.0, 0.0,
255
+
0.0, 0.0, 0.0, 0.0
256
+
};
257
+
258
+
constdouble x[ 3 ] = { 1.0, 4.0, 0.0 };
259
+
const double y[ 4 ] = { 0.0, 1.0, 2.0, 3.0 };
260
+
261
+
c_dger_ndarray( 3, 4, 1.0, x, 1, 0, y, 1, 0, A, 4, 1, 0 );
262
+
```
263
+
264
+
The function accepts the following arguments:
265
+
266
+
- **layout**: `[in] CBLAS_LAYOUT` storage layout.
267
+
- **M**: `[in] CBLAS_INT` number of rows in the matrix `A`.
268
+
- **N**: `[in] CBLAS_INT` number of columns in the matrix `A`.
269
+
- **alpha**: `[in] double` scalar constant.
270
+
- **X**: `[in] double*` an `M` element vector.
271
+
- **sx**: `[in] CBLAS_INT` stride length for `X`.
272
+
- **ox**: `[in] CBLAS_INT` starting index for `X`.
273
+
- **Y**: `[in] double*` an `N` element vector.
274
+
- **sy**: `[in] CBLAS_INT` stride length for `Y`.
275
+
- **oy**: `[in] CBLAS_INT` starting index for `Y`.
276
+
- **A**: `[inout] double*` input matrix.
277
+
- **sa1**: `[in] CBLAS_INT` stride of the first dimension of `A`.
278
+
- **sa2**: `[in] CBLAS_INT` stride of the second dimension of `A`.
279
+
- **oa**: `[in] CBLAS_INT` starting index for `A`.
0 commit comments