|
| 1 | + |
| 2 | +{{alias}}( N, DL, D, DU, DU2, IPIV ) |
| 3 | + Computes an LU factorization of a real tridiagonal matrix `A` using |
| 4 | + elimination with partial pivoting and row interchanges. |
| 5 | + |
| 6 | + Indexing is relative to the first index. To introduce an offset, use typed |
| 7 | + array views. |
| 8 | + |
| 9 | + The function mutates `DL`, `D`, `DU`, `DU2`, and `IPIV`. |
| 10 | + |
| 11 | + Parameters |
| 12 | + ---------- |
| 13 | + N: integer |
| 14 | + Number of rows/columns in `A`. |
| 15 | + |
| 16 | + DL: Float64Array |
| 17 | + The first sub diagonal of `A`. Should have `N-1` indexed elements. `DL` |
| 18 | + is overwritten by the multipliers that define the matrix `L` from the LU |
| 19 | + factorization of `A`. |
| 20 | + |
| 21 | + D: Float64Array |
| 22 | + The diagonal of `A`. Should have `N` indexed elements. `D` is |
| 23 | + overwritten by the diagonal elements of the upper triangular matrix `U` |
| 24 | + from the LU factorization of `A`. |
| 25 | + |
| 26 | + DU: Float64Array |
| 27 | + The first super-diagonal of `A`. Should have `N-1` indexed elements. |
| 28 | + `DU` is overwritten by the elements of the first super-diagonal of `U`. |
| 29 | + |
| 30 | + DU2: Float64Array |
| 31 | + The second super-diagonal of `U`. Should have `N-2` indexed elements. |
| 32 | + `DU2` is overwritten by the elements of the second super-diagonal of |
| 33 | + `U`. |
| 34 | + |
| 35 | + IPIV: Int32Array |
| 36 | + Vector of pivot indices. Should have `N` indexed elements. |
| 37 | + |
| 38 | + Returns |
| 39 | + ------- |
| 40 | + info: integer |
| 41 | + Status code. The status code indicates the following conditions: |
| 42 | + |
| 43 | + - if equal to zero, then the factorization was successful. |
| 44 | + - if greater than zero, then `U(k, k)` is exactly zero the factorization |
| 45 | + has been completed, but the factor `U` is exactly singular, and division |
| 46 | + by zero will occur if it is used to solve a system of equations where |
| 47 | + `k = StatusCode`. |
| 48 | + |
| 49 | + Examples |
| 50 | + -------- |
| 51 | + > var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); |
| 52 | + > var D = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0, 1.0 ] ); |
| 53 | + > var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); |
| 54 | + > var DU2 = new {{alias:@stdlib/array/float64}}( 1 ); |
| 55 | + > var IPIV = new {{alias:@stdlib/array/int32}}( 3 ); |
| 56 | + > {{alias}}( 3, DL, D, DU, DU2, IPIV ) |
| 57 | + 0 |
| 58 | + > DL |
| 59 | + <Float64Array>[ 0.5, 0.4 ] |
| 60 | + > D |
| 61 | + <Float64Array>[ 2.0, 2.5, 0.6 ] |
| 62 | + > DU |
| 63 | + <Float64Array>[ 1.0, 1.0 ] |
| 64 | + > DU2 |
| 65 | + <Float64Array>[ 0.0 ] |
| 66 | + > IPIV |
| 67 | + <Int32Array>[ 0, 1, 2 ] |
| 68 | + |
| 69 | + // Using typed array views: |
| 70 | + > var DL0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 1.0 ] ); |
| 71 | + > var D0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 2.0, 3.0, 1.0 ] ); |
| 72 | + > var DU0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 1.0 ] ); |
| 73 | + > var DU20 = new {{alias:@stdlib/array/float64}}( 2 ); |
| 74 | + > var IPIV0 = new {{alias:@stdlib/array/int32}}( 4 ); |
| 75 | + > DL = new Float64Array( DL0.buffer, DL0.BYTES_PER_ELEMENT*1 ); |
| 76 | + > D = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); |
| 77 | + > DU = new Float64Array( DU0.buffer, DU0.BYTES_PER_ELEMENT*1 ); |
| 78 | + > DU2 = new Float64Array( DU20.buffer, DU20.BYTES_PER_ELEMENT*1 ); |
| 79 | + > IPIV = new Int32Array( IPIV0.buffer, IPIV0.BYTES_PER_ELEMENT*1 ); |
| 80 | + > {{alias}}( 3, DL, D, DU, DU2, IPIV ) |
| 81 | + 0 |
| 82 | + > DL0 |
| 83 | + <Float64Array>[ 0.0, 0.5, 0.4 ] |
| 84 | + > D0 |
| 85 | + <Float64Array>[ 0.0, 2.0, 2.5, 0.6 ] |
| 86 | + > DU0 |
| 87 | + <Float64Array>[ 0.0, 1.0, 1.0 ] |
| 88 | + > DU20 |
| 89 | + <Float64Array>[ 0.0, 0.0 ] |
| 90 | + > IPIV0 |
| 91 | + <Int32Array>[ 0, 0, 1, 2 ] |
| 92 | + |
| 93 | + |
| 94 | +{{alias}}.ndarray(N, DL,sdl,odl, D,sd,od, DU,sdu,odu, DU2,sdu2,odu2, IPIV,si,oi) |
| 95 | + Computes an LU factorization of a real tridiagonal matrix `A` using |
| 96 | + elimination with partial pivoting and row interchanges and alternative |
| 97 | + indexing semantics. |
| 98 | + |
| 99 | + While typed array views mandate a view offset based on the underlying |
| 100 | + buffer, the offset parameters support indexing semantics based on starting |
| 101 | + indices. |
| 102 | + |
| 103 | + The function mutates `DL`, `D`, `DU`, `DU2`, and `IPIV`. |
| 104 | + |
| 105 | + Parameters |
| 106 | + ---------- |
| 107 | + N: integer |
| 108 | + Number of rows/columns in `A`. |
| 109 | + |
| 110 | + DL: Float64Array |
| 111 | + The first sub diagonal of `A`. Should have `N-1` indexed elements. `DL` |
| 112 | + is overwritten by the multipliers that define the matrix `L` from the LU |
| 113 | + factorization of `A`. |
| 114 | + |
| 115 | + sdl: integer |
| 116 | + Stride length for `DL`. |
| 117 | + |
| 118 | + odl: integer |
| 119 | + Starting index for `DL`. |
| 120 | + |
| 121 | + D: Float64Array |
| 122 | + The diagonal of `A`. Should have `N` indexed elements. `D` is |
| 123 | + overwritten by the diagonal elements of the upper triangular matrix `U` |
| 124 | + from the LU factorization of `A`. |
| 125 | + |
| 126 | + sd: integer |
| 127 | + Stride length for `D`. |
| 128 | + |
| 129 | + od: integer |
| 130 | + Starting index for `D`. |
| 131 | + |
| 132 | + DU: Float64Array |
| 133 | + The first super-diagonal of `A`. Should have `N-1` indexed elements. |
| 134 | + `DU` is overwritten by the elements of the first super-diagonal of `U`. |
| 135 | + |
| 136 | + sdu: integer |
| 137 | + Stride length for `DU`. |
| 138 | + |
| 139 | + odu: integer |
| 140 | + Starting index for `DU2`. |
| 141 | + |
| 142 | + DU2: Float64Array |
| 143 | + The second super-diagonal of `U`. Should have `N-2` indexed elements. |
| 144 | + `DU2` is overwritten by the elements of the second super-diagonal of |
| 145 | + `U`. |
| 146 | + |
| 147 | + sdu2: integer |
| 148 | + Stride length for `DU2`. |
| 149 | + |
| 150 | + odu2: integer |
| 151 | + Starting index for `DU2`. |
| 152 | + |
| 153 | + IPIV: Int32Array |
| 154 | + Vector of pivot indices. Should have `N` indexed elements. |
| 155 | + |
| 156 | + si: integer |
| 157 | + Stride length for `IPIV`. |
| 158 | + |
| 159 | + oi: integer |
| 160 | + Starting index for `IPIV`. |
| 161 | + |
| 162 | + Returns |
| 163 | + ------- |
| 164 | + info: integer |
| 165 | + Status code. The status code indicates the following conditions: |
| 166 | + |
| 167 | + - if equal to zero, then the factorization was successful. |
| 168 | + - if greater than zero, then `U(k, k)` is exactly zero the factorization |
| 169 | + has been completed, but the factor `U` is exactly singular, and division |
| 170 | + by zero will occur if it is used to solve a system of equations where |
| 171 | + `k = StatusCode`. |
| 172 | + |
| 173 | + Examples |
| 174 | + -------- |
| 175 | + > var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); |
| 176 | + > var D = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0, 1.0 ] ); |
| 177 | + > var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); |
| 178 | + > var DU2 = new {{alias:@stdlib/array/float64}}( 1 ); |
| 179 | + > var IPIV = new {{alias:@stdlib/array/int32}}( 3 ); |
| 180 | + > {{alias}}.ndarray( 3, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 ) |
| 181 | + 0 |
| 182 | + > DL |
| 183 | + <Float64Array>[ 0.5, 0.4 ] |
| 184 | + > D |
| 185 | + <Float64Array>[ 2.0, 2.5, 0.6 ] |
| 186 | + > DU |
| 187 | + <Float64Array>[ 1.0, 1.0 ] |
| 188 | + > DU2 |
| 189 | + <Float64Array>[ 0.0 ] |
| 190 | + > IPIV |
| 191 | + <Int32Array>[ 0, 1, 2 ] |
| 192 | + |
| 193 | + See Also |
| 194 | + -------- |
| 195 | + |
0 commit comments