|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2025 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# dsyrk |
| 22 | + |
| 23 | +> Perform one of the symmetric rank `K` operations `C = α*A*A**T + β*C` or `C = α*A**T*A + β*C` where `α` and `β` are scalars, `C` is an `N` by `N` symmetric matrix and `A` is an `N` by `K` matrix in the first case and a `K` by `N` matrix in the second case. |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var dsyrk = require( '@stdlib/blas/base/dsyrk' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### dsyrk( ord, uplo, trans, N, K, α, A, lda, β, C, ldc ) |
| 34 | + |
| 35 | +Performs one of the symmetric rank `K` operations `C = α*A*A**T + β*C` or `C = α*A**T*A + β*C` where `α` and `β` are scalars, `C` is an `N` by `N` symmetric matrix and `A` is an `N` by `K` matrix in the first case and a `K` by `N` matrix in the second case. |
| 36 | + |
| 37 | +```javascript |
| 38 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 39 | + |
| 40 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 41 | +var C = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); |
| 42 | + |
| 43 | +dsyrk( 'row-major', 'upper', 'no-transpose', 3, 3, 1.0, A, 3, 1.0, C, 3 ); |
| 44 | +// C => <Float64Array>[ 15.0, 34.0, 53.0, 0.0, 81.0, 127.0, 0.0, 0.0, 200.0 ] |
| 45 | +``` |
| 46 | + |
| 47 | +The function has the following parameters: |
| 48 | + |
| 49 | +- **ord**: storage layout. |
| 50 | +- **uplo**: specifies whether the upper or lower triangular part of the symmetric matrix `C` is supplied. |
| 51 | +- **trans**: specifies whether `C` should be transposed, conjugate-transposed, or not transposed. |
| 52 | +- **N**: order of the matrix `C`. |
| 53 | +- **K**: number of columns or number of rows of the matrix `A`. |
| 54 | +- **α**: scalar constant. |
| 55 | +- **A**: first input matrix stored in linear memory as a [`Float64Array`][mdn-float64array]. |
| 56 | +- **lda**: stride of the first dimension of `A` (leading dimension of `A`). |
| 57 | +- **β**: scalar constant. |
| 58 | +- **C**: second input matrix stored in linear memory as a [`Float64Array`][mdn-float64array]. |
| 59 | +- **ldc**: stride of the first dimension of `C` (leading dimension of `C`). |
| 60 | + |
| 61 | +The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to perform matrix multiplication of two subarrays |
| 62 | + |
| 63 | +<!-- lint disable maximum-len --> |
| 64 | + |
| 65 | +```javascript |
| 66 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 67 | + |
| 68 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 0.0, 0.0, 4.0, 5.0, 6.0, 0.0, 0.0, 0.0, 7.0, 8.0, 9.0 ] ); |
| 69 | +var C = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); |
| 70 | + |
| 71 | +dsyrk( 'row-major', 'upper', 'no-transpose', 3, 3, 1.0, A, 6, 1.0, C, 3 ); |
| 72 | +// C => <Float64Array>[ 15.0, 34.0, 53.0, 0.0, 81.0, 127.0, 0.0, 0.0, 200.0 ] |
| 73 | +``` |
| 74 | + |
| 75 | +<!-- lint disable maximum-heading-length --> |
| 76 | + |
| 77 | +#### dsyrk.ndarray( uplo, trans, N, K, α, A, sa1, sa2, oa, β, C, sc1, sc2, oc ) |
| 78 | + |
| 79 | +Performs one of the symmetric rank `K` operations `C = α*A*A**T + β*C` or `C = α*A**T*A + β*C`, using alternative indexing semantics and where `α` and `β` are scalars, `C` is an `N` by `N` symmetric matrix and `A` is an `N` by `K` matrix in the first case and a `K` by `N` matrix in the second case. |
| 80 | + |
| 81 | +```javascript |
| 82 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 83 | + |
| 84 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 85 | +var C = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); |
| 86 | + |
| 87 | +dsyrk.ndarray( 'upper', 'no-transpose', 3, 3, 1.0, A, 3, 1, 0, 1.0, C, 3, 1, 0 ); |
| 88 | +// C => <Float64Array>[ 15.0, 34.0, 53.0, 0.0, 81.0, 127.0, 0.0, 0.0, 200.0 ] |
| 89 | +``` |
| 90 | + |
| 91 | +The function has the following additional parameters: |
| 92 | + |
| 93 | +- **sa1**: stride of the first dimension of `A`. |
| 94 | +- **sa2**: stride of the second dimension of `A`. |
| 95 | +- **oa**: starting index for `A`. |
| 96 | +- **sc1**: stride of the first dimension of `C`. |
| 97 | +- **sc2**: stride of the second dimension of `C`. |
| 98 | +- **oc**: starting index for `C`. |
| 99 | + |
| 100 | +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, |
| 101 | + |
| 102 | +```javascript |
| 103 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 104 | + |
| 105 | +var A = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 106 | +var C = new Float64Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ] ); |
| 107 | + |
| 108 | +dsyrk.ndarray( 'upper', 'no-transpose', 3, 3, 1.0, A, 3, 1, 1, 1.0, C, 3, 1, 2 ); |
| 109 | +// C => <Float64Array>[ 0.0, 0.0, 15.0, 34.0, 53.0, 0.0, 81.0, 127.0, 0.0, 0.0, 200.0 ] |
| 110 | +``` |
| 111 | + |
| 112 | +</section> |
| 113 | + |
| 114 | +<!-- /.usage --> |
| 115 | + |
| 116 | +<section class="notes"> |
| 117 | + |
| 118 | +## Notes |
| 119 | + |
| 120 | +- `dsyrk()` corresponds to the [BLAS][blas] level 3 function [`dsyrk`][blas-dsyrk]. |
| 121 | + |
| 122 | +</section> |
| 123 | + |
| 124 | +<!-- /.notes --> |
| 125 | + |
| 126 | +<section class="examples"> |
| 127 | + |
| 128 | +## Examples |
| 129 | + |
| 130 | +<!-- eslint no-undef: "error" --> |
| 131 | + |
| 132 | +```javascript |
| 133 | +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); |
| 134 | +var dsyrk = require( '@stdlib/blas/base/dsyrk' ); |
| 135 | + |
| 136 | +var opts = { |
| 137 | + 'dtype': 'float64' |
| 138 | +}; |
| 139 | + |
| 140 | +var N = 4; |
| 141 | +var K = 3; |
| 142 | + |
| 143 | +var A = discreteUniform( N*N, 0, 10, opts ); // 4x4 |
| 144 | +var C = discreteUniform( N*K, 0, 10, opts ); // 4x3 |
| 145 | + |
| 146 | +dsyrk( 'row-major', 'lower', 'no-transpose', N, K, 1.0, A, N, 1.0, C, N ); |
| 147 | +console.log( C ); |
| 148 | + |
| 149 | +dsyrk.ndarray( 'lower', 'no-transpose', N, K, 1.0, A, N, 1, 0, 1.0, C, N, 1, 0 ); |
| 150 | +console.log( C ); |
| 151 | +``` |
| 152 | + |
| 153 | +</section> |
| 154 | + |
| 155 | +<!-- /.examples --> |
| 156 | + |
| 157 | +<!-- C interface documentation. --> |
| 158 | + |
| 159 | +* * * |
| 160 | + |
| 161 | +<section class="c"> |
| 162 | + |
| 163 | +## C APIs |
| 164 | + |
| 165 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 166 | + |
| 167 | +<section class="intro"> |
| 168 | + |
| 169 | +</section> |
| 170 | + |
| 171 | +<!-- /.intro --> |
| 172 | + |
| 173 | +<!-- C usage documentation. --> |
| 174 | + |
| 175 | +<section class="usage"> |
| 176 | + |
| 177 | +### Usage |
| 178 | + |
| 179 | +```c |
| 180 | +#include "stdlib/blas/base/dsyrk.h" |
| 181 | +``` |
| 182 | + |
| 183 | +#### TODO |
| 184 | + |
| 185 | +TODO. |
| 186 | + |
| 187 | +```c |
| 188 | +TODO |
| 189 | +``` |
| 190 | + |
| 191 | +TODO |
| 192 | + |
| 193 | +```c |
| 194 | +TODO |
| 195 | +``` |
| 196 | + |
| 197 | +</section> |
| 198 | + |
| 199 | +<!-- /.usage --> |
| 200 | + |
| 201 | +<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 202 | + |
| 203 | +<section class="notes"> |
| 204 | + |
| 205 | +</section> |
| 206 | + |
| 207 | +<!-- /.notes --> |
| 208 | + |
| 209 | +<!-- C API usage examples. --> |
| 210 | + |
| 211 | +<section class="examples"> |
| 212 | + |
| 213 | +### Examples |
| 214 | + |
| 215 | +```c |
| 216 | +TODO |
| 217 | +``` |
| 218 | + |
| 219 | +</section> |
| 220 | + |
| 221 | +<!-- /.examples --> |
| 222 | + |
| 223 | +</section> |
| 224 | + |
| 225 | +<!-- /.c --> |
| 226 | + |
| 227 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 228 | + |
| 229 | +<section class="related"> |
| 230 | + |
| 231 | +</section> |
| 232 | + |
| 233 | +<!-- /.related --> |
| 234 | + |
| 235 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 236 | + |
| 237 | +<section class="links"> |
| 238 | + |
| 239 | +[blas]: http://www.netlib.org/blas |
| 240 | + |
| 241 | +[blas-dsyrk]: https://www.netlib.org/lapack/explore-html-3.6.1/d1/d54/group__double__blas__level3_gae0ba56279ae3fa27c75fefbc4cc73ddf.html |
| 242 | + |
| 243 | +[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array |
| 244 | + |
| 245 | +[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray |
| 246 | + |
| 247 | +</section> |
| 248 | + |
| 249 | +<!-- /.links --> |
0 commit comments