All files / lapack/base/dlarfb/lib ndarray.js

93.68% Statements 89/95
62.5% Branches 5/8
100% Functions 1/1
93.68% Lines 89/95

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 962x 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 169x 169x     169x     169x     169x 8x 8x 161x 169x 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 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 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} 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`
* @param {string} direct - indicates how `H` is formed from a product of elementary reflectors
* @param {string} storev - indicates how the vectors which define the elementary reflectors are stored
* @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 {integer} strideV1 - stride of the first dimension of `V`
* @param {integer} strideV2 - stride of the second dimension of `V`
* @param {integer} offsetV - index offset for `V`
* @param {Float64Array} T - input matrix
* @param {integer} strideT1 - stride of the first dimension of `T`
* @param {integer} strideT2 - stride of the second dimension of `T`
* @param {integer} offsetT - index offset for `T`
* @param {Float64Array} C - input matrix
* @param {integer} strideC1 - stride of the first dimension of `C`
* @param {integer} strideC2 - stride of the second dimension of `C`
* @param {integer} offsetC - index offset for `C`
* @param {Float64Array} work - work array
* @param {integer} strideWork1 - stride of the first dimension of `work`
* @param {integer} strideWork2 - stride of the second dimension of `work`
* @param {integer} offsetWork - index offset for `work`
* @throws {TypeError} first argument must be a valid BLAS operation side
* @throws {TypeError} second argument must be a valid BLAS transpose operation
* @throws {TypeError} third argument must be either `forward` or `backward`
* @throws {TypeError} fourth argument must be a valid matrix orientation
* @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( 'left', 'transpose', 'forward', 'columns', 3, 3, 3, V, 3, 1, 0, T, 3, 1, 0, C, 3, 1, 0, work, 3, 1, 0 );
*
* // C => <Float64Array>[ -1350.00, -1400.00, -1450.00, -30961.00, -32102.00, -33243.00, -266612.00, -275464.00, -284316.00 ]
*/
function dlarfb( side, trans, direct, storev, M, N, K, V, strideV1, strideV2, offsetV, T, strideT1, strideT2, offsetT, C, strideC1, strideC2, offsetC, work, strideWork1, strideWork2, offsetWork ) { // eslint-disable-line max-len, max-params
	if ( !isOperationSide( side ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be a valid BLAS operation side. Value: `%s`.', side ) );
	}
	if ( !isTransposeOperation( trans ) ) {
		throw new TypeError( format( 'invalid argument. Second argument must be a valid BLAS transpose operation. Value: `%s`.', trans ) );
	}
	if ( direct !== 'forward' && direct !== 'backward' ) {
		throw new TypeError( format( 'invalid argument. Third argument must be either `forward` or `backward`. Value: `%s`.', direct ) );
	}
	if ( !isMatrixOrientation( storev ) ) {
		throw new TypeError( format( 'invalid argument. Fourth argument must be a valid matrix orientation. Value: `%s`.', storev ) );
	}
	return base( side, trans, direct, storev, M, N, K, V, strideV1, strideV2, offsetV, T, strideT1, strideT2, offsetT, C, strideC1, strideC2, offsetC, work, strideWork1, strideWork2, offsetWork ); // eslint-disable-line max-len
}
 
 
// EXPORTS //
 
module.exports = dlarfb;