|
| 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, DiagonalType, MatrixTriangle, TransposeOperation } from '@stdlib/types/blas'; |
| 24 | + |
| 25 | +/** |
| 26 | +* Specifies whether `CNORM` contains the column norms or do they have to be calculated. |
| 27 | +*/ |
| 28 | +type Normin = number; |
| 29 | + |
| 30 | +/** |
| 31 | +* Interface describing `dlatrs`. |
| 32 | +*/ |
| 33 | +interface Routine { |
| 34 | + /** |
| 35 | + * Solves a triangular system of equations with the scale factor set to prevent overflow. |
| 36 | + * |
| 37 | + * @param order - storage layout |
| 38 | + * @param uplo - specifies whether `A` is an upper or lower triangular matrix |
| 39 | + * @param trans - specifies whether `A` should be transposed or not transposed |
| 40 | + * @param diag - specifies whether `A` has a unit diagonal |
| 41 | + * @param normin - specifies whether `CNORM` has been set or not |
| 42 | + * @param N - number of rows/columns in `A` |
| 43 | + * @param A - input matrix |
| 44 | + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) |
| 45 | + * @param X - input vector, specifies the right hand side vector of the equation |
| 46 | + * @param CNORM - used to store the column norms |
| 47 | + * @returns permuted matrix `A` |
| 48 | + * |
| 49 | + * @example |
| 50 | + * var Float64Array = require( '@stdlib/array/float64' ); |
| 51 | + * |
| 52 | + * var A = new Float64Array( [ 2.0, 1.0, -1.0, 0.0, 3.0, 2.0, 0.0, 0.0, 4.0 ] ); // => [ [ 2.0, 1.0, -1.0 ], [ 0.0, 3.0, 2.0 ], [ 0.0, 0.0, 4.0 ] ] |
| 53 | + * var X = new Float64Array( [ 5.0, 10.0, 20,0 ] ); |
| 54 | + * var CNORM = new Float64Array( 3 ); |
| 55 | + * |
| 56 | + * var scale = dlatrs( 'row-major', 'upper', 'no-transpose', 'non-unit', 'no', 3, A, 3, X, CNORM ); |
| 57 | + * // returns 1.0 |
| 58 | + * // X => <Float64Array>[ 5.0, 0.0, 5.0 ] |
| 59 | + * // CNORM => <Float64Array>[ 0.0, 1.0, 3.0 ] |
| 60 | + */ |
| 61 | + ( order: Layout, uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, normin: Normin, N: number, A: Float64Array, LDA: number, X: Float64Array, CNORM: Float64Array ): number; |
| 62 | + |
| 63 | + /** |
| 64 | + * Solves a triangular system of equations with the scale factor set to prevent overflow using alternative indexing semantics. |
| 65 | + * |
| 66 | + * @param uplo - specifies whether `A` is an upper or lower triangular matrix |
| 67 | + * @param trans - specifies whether `A` should be transposed or not transposed |
| 68 | + * @param diag - specifies whether `A` has a unit diagonal |
| 69 | + * @param normin - specifies whether `CNORM` has been set or not |
| 70 | + * @param N - number of rows/columns in `A` |
| 71 | + * @param A - input matrix |
| 72 | + * @param strideA1 - stride of the first dimension of `A` |
| 73 | + * @param strideA2 - stride of the second dimension of `A` |
| 74 | + * @param offsetA - starting index for `A` |
| 75 | + * @param X - input vector, specifies the right hand side vector of the equation |
| 76 | + * @param strideX - stride length for `X` |
| 77 | + * @param offsetX - starting index for `X` |
| 78 | + * @param CNORM - used to store the column norms |
| 79 | + * @param strideCNORM - stride length for `CNORM` |
| 80 | + * @param offsetCNORM - starting index for `CNORM` |
| 81 | + * @returns permuted matrix `A` |
| 82 | + * |
| 83 | + * @example |
| 84 | + * var Float64Array = require( '@stdlib/array/float64' ); |
| 85 | + * |
| 86 | + * var A = new Float64Array( [ 2.0, 1.0, -1.0, 0.0, 3.0, 2.0, 0.0, 0.0, 4.0 ] ); // => [ [ 2.0, 1.0, -1.0 ], [ 0.0, 3.0, 2.0 ], [ 0.0, 0.0, 4.0 ] ] |
| 87 | + * var X = new Float64Array( [ 5.0, 10.0, 20,0 ] ); |
| 88 | + * var CNORM = new Float64Array( 3 ); |
| 89 | + * |
| 90 | + * var scale = dlatrs.ndarray( 'upper', 'no-transpose', 'non-unit', 'no', 3, A, 3, 1, 0, X, 1, 0, CNORM, 1, 0 ); |
| 91 | + * // returns 1.0 |
| 92 | + * // X => <Float64Array>[ 5.0, 0.0, 5.0 ] |
| 93 | + * // CNORM => <Float64Array>[ 0.0, 1.0, 3.0 ] |
| 94 | + */ |
| 95 | + ndarray( uplo: MatrixTriangle, trans: TransposeOperation, diag: DiagonalType, normin: Normin, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, X: Float64Array, strideX: number, offsetX: number, CNORM: Float64Array, strideCNORM: number, offsetCNORM: number ): number; |
| 96 | +} |
| 97 | + |
| 98 | +/** |
| 99 | +* Solves a triangular system of equations with the scale factor set to prevent overflow. |
| 100 | +* |
| 101 | +* @param order - storage layout |
| 102 | +* @param uplo - specifies whether `A` is an upper or lower triangular matrix |
| 103 | +* @param trans - specifies whether `A` should be transposed or not transposed |
| 104 | +* @param diag - specifies whether `A` has a unit diagonal |
| 105 | +* @param normin - specifies whether `CNORM` has been set or not |
| 106 | +* @param N - number of rows/columns in `A` |
| 107 | +* @param A - input matrix |
| 108 | +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) |
| 109 | +* @param X - input vector, specifies the right hand side vector of the equation |
| 110 | +* @param CNORM - used to store the column norms |
| 111 | +* @returns permuted matrix `A` |
| 112 | +* |
| 113 | +* @example |
| 114 | +* var Float64Array = require( '@stdlib/array/float64' ); |
| 115 | +* |
| 116 | +* var A = new Float64Array( [ 2.0, 1.0, -1.0, 0.0, 3.0, 2.0, 0.0, 0.0, 4.0 ] ); // => [ [ 2.0, 1.0, -1.0 ], [ 0.0, 3.0, 2.0 ], [ 0.0, 0.0, 4.0 ] ] |
| 117 | +* var X = new Float64Array( [ 5.0, 10.0, 20,0 ] ); |
| 118 | +* var CNORM = new Float64Array( 3 ); |
| 119 | +* |
| 120 | +* var scale = dlatrs( 'row-major', 'upper', 'no-transpose', 'non-unit', 'no', 3, A, 3, X, CNORM ); |
| 121 | +* // returns 1.0 |
| 122 | +* // X => <Float64Array>[ 5.0, 0.0, 5.0 ] |
| 123 | +* // CNORM => <Float64Array>[ 0.0, 1.0, 3.0 ] |
| 124 | +* |
| 125 | +* @example |
| 126 | +* var Float64Array = require( '@stdlib/array/float64' ); |
| 127 | +* |
| 128 | +* var A = new Float64Array( [ 2.0, 1.0, -1.0, 0.0, 3.0, 2.0, 0.0, 0.0, 4.0 ] ); // => [ [ 2.0, 1.0, -1.0 ], [ 0.0, 3.0, 2.0 ], [ 0.0, 0.0, 4.0 ] ] |
| 129 | +* var X = new Float64Array( [ 5.0, 10.0, 20,0 ] ); |
| 130 | +* var CNORM = new Float64Array( 3 ); |
| 131 | +* |
| 132 | +* var scale = dlatrs.ndarray( 'upper', 'no-transpose', 'non-unit', 'no', 3, A, 3, 1, 0, X, 1, 0, CNORM, 1, 0 ); |
| 133 | +* // returns 1.0 |
| 134 | +* // X => <Float64Array>[ 5.0, 0.0, 5.0 ] |
| 135 | +* // CNORM => <Float64Array>[ 0.0, 1.0, 3.0 ] |
| 136 | +*/ |
| 137 | +declare var dlatrs: Routine; |
| 138 | + |
| 139 | + |
| 140 | +// EXPORTS // |
| 141 | + |
| 142 | +export = dlatrs; |
0 commit comments