|
| 1 | +/** |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2025 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +// TypeScript Version: 4.1 |
| 20 | + |
| 21 | +/// <reference types="@stdlib/types"/> |
| 22 | + |
| 23 | +import { Layout, OperationSide, TransposeOperation } from '@stdlib/types/blas'; |
| 24 | + |
| 25 | +/** |
| 26 | +* Interface describing `dorm2r`. |
| 27 | +*/ |
| 28 | +interface Routine { |
| 29 | + /** |
| 30 | + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. |
| 31 | + * |
| 32 | + * ## Notes |
| 33 | + * |
| 34 | + * `dorm2r` overwrites the general real M by N matrix C with |
| 35 | + * |
| 36 | + * - `Q * C` if side = 'left' and trans = 'no-transpose' |
| 37 | + * - `Q^T * C` if side = 'left' and trans = 'transpose' |
| 38 | + * - `C * Q` if side = 'right' and trans = 'no-transpose' |
| 39 | + * - `C * Q^T` if side = 'right' and trans = 'transpose' |
| 40 | + * |
| 41 | + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. |
| 42 | + * |
| 43 | + * @param order - storage layout |
| 44 | + * @param side - specifies the side of multiplication with `C` |
| 45 | + * @param trans - specifies the operation to be performed |
| 46 | + * @param M - number of rows in matrix `C` |
| 47 | + * @param N - number of columns in matrix `C` |
| 48 | + * @param K - number of elementary reflectors whose product defines the matrix `Q` |
| 49 | + * @param A - input matrix containing the elementary reflectors |
| 50 | + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) |
| 51 | + * @param tau - array containing the scalar factors of the elementary reflectors |
| 52 | + * @param C - input/output matrix to be multiplied |
| 53 | + * @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) |
| 54 | + * @param work - workspace array for intermediate calculations |
| 55 | + * @returns the modified matrix `C` |
| 56 | + * |
| 57 | + * @example |
| 58 | + * var Float64Array = require( '@stdlib/array/float64' ); |
| 59 | + * |
| 60 | + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); |
| 61 | + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); |
| 62 | + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 63 | + * var work = new Float64Array( 3 ); |
| 64 | + * |
| 65 | + * dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); |
| 66 | + * // C => <Float64Array>[ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] |
| 67 | + */ |
| 68 | + ( order: Layout, side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, LDA: number, tau: Float64Array, C: Float64Array, LDC: number, work: Float64Array ): Float64Array; |
| 69 | + |
| 70 | + /** |
| 71 | + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization using alternative indexing semantics. |
| 72 | + * |
| 73 | + * ## Notes |
| 74 | + * |
| 75 | + * `dorm2r` overwrites the general real M by N matrix C with |
| 76 | + * |
| 77 | + * - `Q * C` if side = 'left' and trans = 'no-transpose' |
| 78 | + * - `Q^T * C` if side = 'left' and trans = 'transpose' |
| 79 | + * - `C * Q` if side = 'right' and trans = 'no-transpose' |
| 80 | + * - `C * Q^T` if side = 'right' and trans = 'transpose' |
| 81 | + * |
| 82 | + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. |
| 83 | + * |
| 84 | + * @param side - specifies the side of multiplication with `C` |
| 85 | + * @param trans - specifies the operation to be performed |
| 86 | + * @param M - number of rows in matrix `C` |
| 87 | + * @param N - number of columns in matrix `C` |
| 88 | + * @param K - number of elementary reflectors whose product defines the matrix `Q` |
| 89 | + * @param A - input matrix containing the elementary reflectors |
| 90 | + * @param strideA1 - stride length for the first dimension of `A` |
| 91 | + * @param strideA2 - stride length for the second dimension of `A` |
| 92 | + * @param offsetA - starting index for `A` |
| 93 | + * @param tau - array containing the scalar factors of the elementary reflectors |
| 94 | + * @param strideTau - stride length for `tau` |
| 95 | + * @param offsetTau - starting index for `tau` |
| 96 | + * @param C - input/output matrix to be multiplied |
| 97 | + * @param strideC1 - stride length for the first dimension of `C` |
| 98 | + * @param strideC2 - stride length for the second dimension of `C` |
| 99 | + * @param offsetC - starting index for `C` |
| 100 | + * @param work - workspace array for intermediate calculations |
| 101 | + * @param strideWork - stride length for `work` |
| 102 | + * @param offsetWork - starting index for `work` |
| 103 | + * @returns the modified matrix `C` |
| 104 | + * |
| 105 | + * @example |
| 106 | + * var Float64Array = require( '@stdlib/array/float64' ); |
| 107 | + * |
| 108 | + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); |
| 109 | + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); |
| 110 | + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 111 | + * var work = new Float64Array( 3 ); |
| 112 | + * |
| 113 | + * dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); |
| 114 | + * // C => <Float64Array>[ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] |
| 115 | + */ |
| 116 | + ndarray( side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, tau: Float64Array, strideTau: number, offsetTau: number, C: Float64Array, strideC1: number, strideC2: number, offsetC: number, work: Float64Array, strideWork: number, offsetWork: number ): Float64Array; |
| 117 | +} |
| 118 | + |
| 119 | +/** |
| 120 | +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. |
| 121 | +* |
| 122 | +* ## Notes |
| 123 | +* |
| 124 | +* `dorm2r` overwrites the general real M by N matrix C with |
| 125 | +* |
| 126 | +* - `Q * C` if side = 'left' and trans = 'no-transpose' |
| 127 | +* - `Q^T * C` if side = 'left' and trans = 'transpose' |
| 128 | +* - `C * Q` if side = 'right' and trans = 'no-transpose' |
| 129 | +* - `C * Q^T` if side = 'right' and trans = 'transpose' |
| 130 | +* |
| 131 | +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. |
| 132 | +* |
| 133 | +* @param order - storage layout |
| 134 | +* @param side - specifies the side of multiplication with `C` |
| 135 | +* @param trans - specifies the operation to be performed |
| 136 | +* @param M - number of rows in matrix `C` |
| 137 | +* @param N - number of columns in matrix `C` |
| 138 | +* @param K - number of elementary reflectors whose product defines the matrix `Q` |
| 139 | +* @param A - input matrix containing the elementary reflectors |
| 140 | +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) |
| 141 | +* @param tau - array containing the scalar factors of the elementary reflectors |
| 142 | +* @param C - input/output matrix to be multiplied |
| 143 | +* @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) |
| 144 | +* @param work - workspace array for intermediate calculations |
| 145 | +* @returns the modified matrix `C` |
| 146 | +* |
| 147 | +* @example |
| 148 | +* var Float64Array = require( '@stdlib/array/float64' ); |
| 149 | +* |
| 150 | +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); |
| 151 | +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); |
| 152 | +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 153 | +* var work = new Float64Array( 3 ); |
| 154 | +* |
| 155 | +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); |
| 156 | +* // C => <Float64Array>[ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] |
| 157 | +* |
| 158 | +* @example |
| 159 | +* var Float64Array = require( '@stdlib/array/float64' ); |
| 160 | +* |
| 161 | +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); |
| 162 | +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); |
| 163 | +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); |
| 164 | +* var work = new Float64Array( 3 ); |
| 165 | +* |
| 166 | +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); |
| 167 | +* // C => <Float64Array>[ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] |
| 168 | +*/ |
| 169 | +declare var dorm2r: Routine; |
| 170 | + |
| 171 | + |
| 172 | +// EXPORTS // |
| 173 | + |
| 174 | +export = dorm2r; |
0 commit comments