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