Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 90x 11x 11x 90x 8x 8x 90x 8x 8x 90x 8x 8x 90x 8x 8x 47x 90x 28x 6x 6x 28x 3x 3x 28x 8x 28x 11x 7x 3x 3x 11x 4x 4x 11x 28x 90x 19x 19x 19x 11x 7x 11x 4x 4x 19x 8x 8x 19x 11x 19x 8x 8x 19x 3x 3x 19x 32x 90x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 32x 32x 90x 2x 2x 2x 2x 2x | /** * @license Apache-2.0 * * Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; // MODULES // var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); var isMatrixOrientation = require( '@stdlib/blas/base/assert/is-matrix-orientation' ); var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); var max = require( '@stdlib/math/base/special/max' ); var format = require( '@stdlib/string/format' ); var base = require( './base.js' ); // MAIN // /** * Applies a real block reflector `H` or its transpose `H ^ T` to a real `M` by `N` matrix `C`, from either the left or the right. * * @param {string} order - storage layout * @param {string} side - specifies whether `H` or `H ^ T` is applied from the left or right * @param {string} trans - specifies whether to apply `H` or `H ^ T` (`'no-transpose'` or `'transpose'`) * @param {string} direct - indicates how `H` is formed from a product of elementary reflectors (`'forward'` or `'backward'`) * @param {string} storev - indicates how the vectors which define the elementary reflectors are stored (`'column-major'` or `'row-major'`) * @param {NonNegativeInteger} M - number of rows of the matrix `C` * @param {NonNegativeInteger} N - number of columns of the matrix `C` * @param {NonNegativeInteger} K - order of the matrix `T` * @param {Float64Array} V - input matrix * @param {PositiveInteger} LDV - leading dimension of `V` * @param {Float64Array} T - input matrix (upper/lower triangular as dictated by `direct`/`storev`) * @param {PositiveInteger} LDT - leading dimension of `T` (must be ≥ max(1,K)) * @param {Float64Array} C - input/output matrix * @param {PositiveInteger} LDC - leading dimension of `C` * @param {Float64Array} work - work array * @param {PositiveInteger} LDWORK - leading dimension of `work` * @throws {TypeError} first argument must be a valid order * @throws {TypeError} invalid `side` * @throws {TypeError} invalid `trans` * @throws {TypeError} invalid `direct` * @throws {TypeError} invalid `storev` * @throws {RangeError} invalid leading dimension(s) * @returns {Float64Array} updated matrix `C` * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var V = new Float64Array( [ 10.0, 40.0, 70.0, 20.0, 50.0, 80.0, 30.0, 60.0, 90.0 ] ); * var T = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ] ); * var C = new Float64Array( [ 11.0, 12.0, 13.0, 21.0, 22.0, 23.0, 31.0, 32.0, 33.0 ] ); * var work = new Float64Array( 9 ); * * dlarfb( 'row-major', 'left', 'transpose', 'forward', 'columns', 3, 3, 3, V, 3, T, 3, C, 3, work, 3 ); * * // C => <Float64Array>[ -1350.00, -1400.00, -1450.00, -30961.00, -32102.00, -33243.00, -266612.00, -275464.00, -284316.00 ] */ function dlarfb( order, side, trans, direct, storev, M, N, K, V, LDV, T, LDT, C, LDC, work, LDWORK ) { // eslint-disable-line max-params, max-len var requiredLdwork; var sv1; var sv2; var st1; var st2; var sc1; var sc2; var sw1; var sw2; if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } if ( !isOperationSide( side ) ) { throw new TypeError( format( 'invalid argument. Second argument must be a valid BLAS operation side. Value: `%s`.', side ) ); } if ( !isTransposeOperation( trans ) ) { throw new TypeError( format( 'invalid argument. Third argument must be a valid BLAS transpose operation. Value: `%s`.', trans ) ); } if ( direct !== 'forward' && direct !== 'backward' ) { throw new TypeError( format( 'invalid argument. Fourth argument must be either `forward` or `backward`. Value: `%s`.', direct ) ); } if ( !isMatrixOrientation( storev ) ) { throw new TypeError( format( 'invalid argument. Fifth argument must be a valid matrix orientation. Value: `%s`.', storev ) ); } if ( isRowMajor( order ) ) { if ( LDC < max( 1, N ) ) { throw new RangeError( format( 'invalid argument. Thirteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) ); } if ( LDT < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDT ) ); } if ( storev === 'columns' ) { if ( LDV < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDV ) ); } } else if ( storev === 'rows' ) { if ( side === 'left' ) { if ( LDV < max( 1, M ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDV ) ); } } else if ( side === 'right' ) { if ( LDV < max( 1, N ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDV ) ); } } } if ( LDWORK < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Fifteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDWORK ) ); } } else if ( isColumnMajor( order ) ) { if ( LDC < max( 1, M ) ) { throw new RangeError( format( 'invalid argument. Thirteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); } if ( LDT < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDT ) ); } if ( storev === 'columns' ) { if ( side === 'left' ) { if ( LDV < max( 1, M ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDV ) ); } } else if ( side === 'right' ) { if ( LDV < max( 1, N ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDV ) ); } } } else if ( storev === 'rows' ) { if ( LDV < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDV ) ); } } if ( side === 'left' ) { requiredLdwork = N; } else { requiredLdwork = M; } if ( LDWORK < max( 1, requiredLdwork ) ) { throw new RangeError( format( 'invalid argument. Fifteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', requiredLdwork, LDWORK ) ); } } if ( isColumnMajor( order ) ) { sv1 = 1; sv2 = LDV; st1 = 1; st2 = LDT; sc1 = 1; sc2 = LDC; sw1 = 1; sw2 = LDWORK; } else { sv1 = LDV; sv2 = 1; st1 = LDT; st2 = 1; sc1 = LDC; sc2 = 1; sw1 = LDWORK; sw2 = 1; } return base( side, trans, direct, storev, M, N, K, V, sv1, sv2, 0, T, st1, st2, 0, C, sc1, sc2, 0, work, sw1, sw2, 0 ); // eslint-disable-line max-len } // EXPORTS // module.exports = dlarfb; |