[35] | 1 | /*! |
---|
| 2 | * \file |
---|
| 3 | * \brief Definitions of functions for solving linear equation systems |
---|
| 4 | * \author Tony Ottosson |
---|
| 5 | * |
---|
| 6 | * ------------------------------------------------------------------------- |
---|
| 7 | * |
---|
| 8 | * IT++ - C++ library of mathematical, signal processing, speech processing, |
---|
| 9 | * and communications classes and functions |
---|
| 10 | * |
---|
| 11 | * Copyright (C) 1995-2007 (see AUTHORS file for a list of contributors) |
---|
| 12 | * |
---|
| 13 | * This program is free software; you can redistribute it and/or modify |
---|
| 14 | * it under the terms of the GNU General Public License as published by |
---|
| 15 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 16 | * (at your option) any later version. |
---|
| 17 | * |
---|
| 18 | * This program is distributed in the hope that it will be useful, |
---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 21 | * GNU General Public License for more details. |
---|
| 22 | * |
---|
| 23 | * You should have received a copy of the GNU General Public License |
---|
| 24 | * along with this program; if not, write to the Free Software |
---|
| 25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 26 | * |
---|
| 27 | * ------------------------------------------------------------------------- |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef LS_SOLVE_H |
---|
| 31 | #define LS_SOLVE_H |
---|
| 32 | |
---|
| 33 | #include <itpp/base/mat.h> |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | namespace itpp { |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | /*! \addtogroup linearequations |
---|
| 40 | */ |
---|
| 41 | //!@{ |
---|
| 42 | |
---|
| 43 | /*! \brief Solve linear equation system by LU factorisation. |
---|
| 44 | |
---|
| 45 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. |
---|
| 46 | Uses the LAPACK routine DGESV. |
---|
| 47 | */ |
---|
| 48 | bool ls_solve(const mat &A, const vec &b, vec &x); |
---|
| 49 | |
---|
| 50 | /*! \brief Solve linear equation system by LU factorisation. |
---|
| 51 | |
---|
| 52 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. |
---|
| 53 | Uses the LAPACK routine DGESV. |
---|
| 54 | */ |
---|
| 55 | vec ls_solve(const mat &A, const vec &b); |
---|
| 56 | |
---|
| 57 | /*! \brief Solve multiple linear equations by LU factorisation. |
---|
| 58 | |
---|
| 59 | Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. |
---|
| 60 | Uses the LAPACK routine DGESV. |
---|
| 61 | */ |
---|
| 62 | bool ls_solve(const mat &A, const mat &B, mat &X); |
---|
| 63 | |
---|
| 64 | /*! \brief Solve multiple linear equations by LU factorisation. |
---|
| 65 | |
---|
| 66 | Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. |
---|
| 67 | Uses the LAPACK routine DGESV. |
---|
| 68 | */ |
---|
| 69 | mat ls_solve(const mat &A, const mat &B); |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /*! \brief Solve linear equation system by LU factorisation. |
---|
| 73 | |
---|
| 74 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. |
---|
| 75 | Uses the LAPACK routine ZGESV. |
---|
| 76 | */ |
---|
| 77 | bool ls_solve(const cmat &A, const cvec &b, cvec &x); |
---|
| 78 | |
---|
| 79 | /*! \brief Solve linear equation system by LU factorisation. |
---|
| 80 | |
---|
| 81 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a \f$n \times n\f$ matrix. |
---|
| 82 | Uses the LAPACK routine ZGESV. |
---|
| 83 | */ |
---|
| 84 | cvec ls_solve(const cmat &A, const cvec &b); |
---|
| 85 | |
---|
| 86 | /*! \brief Solve multiple linear equations by LU factorisation. |
---|
| 87 | |
---|
| 88 | Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. |
---|
| 89 | Uses the LAPACK routine ZGESV. |
---|
| 90 | */ |
---|
| 91 | bool ls_solve(const cmat &A, const cmat &B, cmat &X); |
---|
| 92 | |
---|
| 93 | /*! \brief Solve multiple linear equations by LU factorisation. |
---|
| 94 | |
---|
| 95 | Solves the linear system \f$AX=B\f$. Here \f$A\f$ is a nonsingular \f$n \times n\f$ matrix. |
---|
| 96 | Uses the LAPACK routine ZGESV. |
---|
| 97 | */ |
---|
| 98 | cmat ls_solve(const cmat &A, const cmat &B); |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 102 | |
---|
| 103 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a symmetric postive definite \f$n \times n\f$ matrix. |
---|
| 104 | Uses the LAPACK routine DPOSV. |
---|
| 105 | */ |
---|
| 106 | bool ls_solve_chol(const mat &A, const vec &b, vec &x); |
---|
| 107 | |
---|
| 108 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 109 | |
---|
| 110 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a symmetric postive definite \f$n \times n\f$ matrix. |
---|
| 111 | Uses the LAPACK routine DPOSV. |
---|
| 112 | */ |
---|
| 113 | vec ls_solve_chol(const mat &A, const vec &b); |
---|
| 114 | |
---|
| 115 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 116 | |
---|
| 117 | Solves the linear system \f$AX=B\f$, where \f$A\f$ is a symmetric postive definite \f$n \times n\f$ matrix. |
---|
| 118 | Uses the LAPACK routine DPOSV. |
---|
| 119 | */ |
---|
| 120 | bool ls_solve_chol(const mat &A, const mat &B, mat &X); |
---|
| 121 | |
---|
| 122 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 123 | |
---|
| 124 | Solves the linear system \f$AX=B\f$, where \f$A\f$ is a symmetric postive definite \f$n \times n\f$ matrix. |
---|
| 125 | Uses the LAPACK routine DPOSV. |
---|
| 126 | */ |
---|
| 127 | mat ls_solve_chol(const mat &A, const mat &B); |
---|
| 128 | |
---|
| 129 | |
---|
| 130 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 131 | |
---|
| 132 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a Hermitian postive definite \f$n \times n\f$ matrix. |
---|
| 133 | Uses the LAPACK routine ZPOSV. |
---|
| 134 | */ |
---|
| 135 | bool ls_solve_chol(const cmat &A, const cvec &b, cvec &x); |
---|
| 136 | |
---|
| 137 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 138 | |
---|
| 139 | Solves the linear system \f$Ax=b\f$, where \f$A\f$ is a Hermitian postive definite \f$n \times n\f$ matrix. |
---|
| 140 | Uses the LAPACK routine ZPOSV. |
---|
| 141 | */ |
---|
| 142 | cvec ls_solve_chol(const cmat &A, const cvec &b); |
---|
| 143 | |
---|
| 144 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 145 | |
---|
| 146 | Solves the linear system \f$AX=B\f$, where \f$A\f$ is a Hermitian postive definite \f$n \times n\f$ matrix. |
---|
| 147 | Uses the LAPACK routine ZPOSV. |
---|
| 148 | */ |
---|
| 149 | bool ls_solve_chol(const cmat &A, const cmat &B, cmat &X); |
---|
| 150 | |
---|
| 151 | /*! \brief Solve linear equation system by Cholesky factorisation. |
---|
| 152 | |
---|
| 153 | Solves the linear system \f$AX=B\f$, where \f$A\f$ is a Hermitian postive definite \f$n \times n\f$ matrix. |
---|
| 154 | Uses the LAPACK routine ZPOSV. |
---|
| 155 | */ |
---|
| 156 | cmat ls_solve_chol(const cmat &A, const cmat &B); |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 161 | |
---|
| 162 | Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 163 | Uses QR-factorization and is built upon the LAPACK routine DGELS. |
---|
| 164 | */ |
---|
| 165 | bool ls_solve_od(const mat &A, const vec &b, vec &x); |
---|
| 166 | |
---|
| 167 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 168 | |
---|
| 169 | Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 170 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 171 | */ |
---|
| 172 | vec ls_solve_od(const mat &A, const vec &b); |
---|
| 173 | |
---|
| 174 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 175 | |
---|
| 176 | Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 177 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 178 | */ |
---|
| 179 | bool ls_solve_od(const mat &A, const mat &B, mat &X); |
---|
| 180 | |
---|
| 181 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 182 | |
---|
| 183 | Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 184 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 185 | */ |
---|
| 186 | mat ls_solve_od(const mat &A, const mat &B); |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 190 | |
---|
| 191 | Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 192 | Uses QR-factorization and is built upon the LAPACK routine ZGELS. |
---|
| 193 | */ |
---|
| 194 | bool ls_solve_od(const cmat &A, const cvec &b, cvec &x); |
---|
| 195 | |
---|
| 196 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 197 | |
---|
| 198 | Solves the overdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 199 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 200 | */ |
---|
| 201 | cvec ls_solve_od(const cmat &A, const cvec &b); |
---|
| 202 | |
---|
| 203 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 204 | |
---|
| 205 | Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 206 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 207 | */ |
---|
| 208 | bool ls_solve_od(const cmat &A, const cmat &B, cmat &X); |
---|
| 209 | |
---|
| 210 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 211 | |
---|
| 212 | Solves the overdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \geq n\f$. |
---|
| 213 | Uses QR-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 214 | */ |
---|
| 215 | cmat ls_solve_od(const cmat &A, const cmat &B); |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | |
---|
| 219 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 220 | |
---|
| 221 | Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 222 | Uses LQ-factorization and is built upon the LAPACK routine DGELS. |
---|
| 223 | */ |
---|
| 224 | bool ls_solve_ud(const mat &A, const vec &b, vec &x); |
---|
| 225 | |
---|
| 226 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 227 | |
---|
| 228 | Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 229 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 230 | */ |
---|
| 231 | vec ls_solve_ud(const mat &A, const vec &b); |
---|
| 232 | |
---|
| 233 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 234 | |
---|
| 235 | Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 236 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 237 | */ |
---|
| 238 | bool ls_solve_ud(const mat &A, const mat &B, mat &X); |
---|
| 239 | |
---|
| 240 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 241 | |
---|
| 242 | Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 243 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine DGELS. |
---|
| 244 | */ |
---|
| 245 | mat ls_solve_ud(const mat &A, const mat &B); |
---|
| 246 | |
---|
| 247 | |
---|
| 248 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 249 | |
---|
| 250 | Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 251 | Uses LQ-factorization and is built upon the LAPACK routine ZGELS. |
---|
| 252 | */ |
---|
| 253 | bool ls_solve_ud(const cmat &A, const cvec &b, cvec &x); |
---|
| 254 | |
---|
| 255 | /*! \brief Solves overdetermined linear equation systems. |
---|
| 256 | |
---|
| 257 | Solves the underdetermined linear system \f$Ax=b\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 258 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 259 | */ |
---|
| 260 | cvec ls_solve_ud(const cmat &A, const cvec &b); |
---|
| 261 | |
---|
| 262 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 263 | |
---|
| 264 | Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 265 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 266 | */ |
---|
| 267 | bool ls_solve_ud(const cmat &A, const cmat &B, cmat &X); |
---|
| 268 | |
---|
| 269 | /*! \brief Solves underdetermined linear equation systems. |
---|
| 270 | |
---|
| 271 | Solves the underdetermined linear system \f$AX=B\f$, where \f$A\f$ is a \f$m \times n\f$ matrix and \f$m \leq n\f$. |
---|
| 272 | Uses LQ-factorization and assumes that \f$A\f$ is full rank. Based on the LAPACK routine ZGELS. |
---|
| 273 | */ |
---|
| 274 | cmat ls_solve_ud(const cmat &A, const cmat &B); |
---|
| 275 | |
---|
| 276 | |
---|
| 277 | /*! \brief A general linear equation system solver. |
---|
| 278 | |
---|
| 279 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 280 | ls_solve(A,b,x), ls_solve_od(A,b,x) or ls_solve_ud(A,b,x) |
---|
| 281 | */ |
---|
| 282 | bool backslash(const mat &A, const vec &b, vec &x); |
---|
| 283 | |
---|
| 284 | /*! \brief A general linear equation system solver. |
---|
| 285 | |
---|
| 286 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 287 | ls_solve(A,b), ls_solve_od(A,b) or ls_solve_ud(A,b) |
---|
| 288 | */ |
---|
| 289 | vec backslash(const mat &A, const vec &b); |
---|
| 290 | |
---|
| 291 | /*! \brief A general linear equation system solver. |
---|
| 292 | |
---|
| 293 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 294 | ls_solve(A,B,X), ls_solve_od(A,B,X), or ls_solve_ud(A,B,X). |
---|
| 295 | */ |
---|
| 296 | bool backslash(const mat &A, const mat &B, mat &X); |
---|
| 297 | |
---|
| 298 | /*! \brief A general linear equation system solver. |
---|
| 299 | |
---|
| 300 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 301 | ls_solve(A,B), ls_solve_od(A,B), or ls_solve_ud(A,B). |
---|
| 302 | */ |
---|
| 303 | mat backslash(const mat &A, const mat &B); |
---|
| 304 | |
---|
| 305 | |
---|
| 306 | /*! \brief A general linear equation system solver. |
---|
| 307 | |
---|
| 308 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 309 | ls_solve(A,b,x), ls_solve_od(A,b,x) or ls_solve_ud(A,b,x) |
---|
| 310 | */ |
---|
| 311 | bool backslash(const cmat &A, const cvec &b, cvec &x); |
---|
| 312 | |
---|
| 313 | /*! \brief A general linear equation system solver. |
---|
| 314 | |
---|
| 315 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 316 | ls_solve(A,b), ls_solve_od(A,b) or ls_solve_ud(A,b) |
---|
| 317 | */ |
---|
| 318 | cvec backslash(const cmat &A, const cvec &b); |
---|
| 319 | |
---|
| 320 | /*! \brief A general linear equation system solver. |
---|
| 321 | |
---|
| 322 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 323 | ls_solve(A,B,X), ls_solve_od(A,B,X), or ls_solve_ud(A,B,X). |
---|
| 324 | */ |
---|
| 325 | bool backslash(const cmat &A, const cmat &B, cmat &X); |
---|
| 326 | |
---|
| 327 | /*! \brief A general linear equation system solver. |
---|
| 328 | |
---|
| 329 | Tries to emulate the backslash operator in Matlab by calling |
---|
| 330 | ls_solve(A,B), ls_solve_od(A,B), or ls_solve_ud(A,B). |
---|
| 331 | */ |
---|
| 332 | cmat backslash(const cmat &A, const cmat &B); |
---|
| 333 | |
---|
| 334 | |
---|
| 335 | |
---|
| 336 | /*! \brief Forward substitution of square matrix. |
---|
| 337 | |
---|
| 338 | Solves Lx=b, where L is a lower triangular n by n matrix. |
---|
| 339 | Assumes that L is nonsingular. Requires n^2 flops. |
---|
| 340 | Uses Alg. 3.1.1 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. |
---|
| 341 | */ |
---|
| 342 | vec forward_substitution(const mat &L, const vec &b); |
---|
| 343 | |
---|
| 344 | /*! \brief Forward substitution of square matrix. |
---|
| 345 | |
---|
| 346 | Solves Lx=b, where L is a lower triangular n by n matrix. |
---|
| 347 | Assumes that L is nonsingular. Requires n^2 flops. |
---|
| 348 | Uses Alg. 3.1.1 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. |
---|
| 349 | */ |
---|
| 350 | void forward_substitution(const mat &L, const vec &b, vec &x); |
---|
| 351 | |
---|
| 352 | /*! \brief Forward substitution of band matricies. |
---|
| 353 | |
---|
| 354 | Solves Lx=b, where L is a lower triangular n by n band-matrix with lower |
---|
| 355 | bandwidth p. |
---|
| 356 | Assumes that L is nonsingular. Requires about 2np flops (if n >> p). |
---|
| 357 | Uses Alg. 4.3.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. |
---|
| 358 | */ |
---|
| 359 | vec forward_substitution(const mat &L, int p, const vec &b); |
---|
| 360 | |
---|
| 361 | /*! \brief Forward substitution of band matricies. |
---|
| 362 | |
---|
| 363 | Solves Lx=b, where L is a lower triangular n by n band-matrix with |
---|
| 364 | lower bandwidth p. |
---|
| 365 | Assumes that L is nonsingular. Requires about 2np flops (if n >> p). |
---|
| 366 | Uses Alg. 4.3.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. |
---|
| 367 | */ |
---|
| 368 | void forward_substitution(const mat &L, int p, const vec &b, vec &x); |
---|
| 369 | |
---|
| 370 | /*! \brief Backward substitution of square matrix. |
---|
| 371 | |
---|
| 372 | Solves Ux=b, where U is a upper triangular n by n matrix. |
---|
| 373 | Assumes that U is nonsingular. Requires n^2 flops. |
---|
| 374 | Uses Alg. 3.1.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. |
---|
| 375 | */ |
---|
| 376 | vec backward_substitution(const mat &U, const vec &b); |
---|
| 377 | |
---|
| 378 | /*! \brief Backward substitution of square matrix. |
---|
| 379 | |
---|
| 380 | Solves Ux=b, where U is a upper triangular n by n matrix. |
---|
| 381 | Assumes that U is nonsingular. Requires n^2 flops. |
---|
| 382 | Uses Alg. 3.1.2 in Golub & van Loan "Matrix computations", 3rd ed., p. 89. |
---|
| 383 | */ |
---|
| 384 | void backward_substitution(const mat &U, const vec &b, vec &x); |
---|
| 385 | |
---|
| 386 | /*! \brief Backward substitution of band matrix. |
---|
| 387 | |
---|
| 388 | Solves Ux=b, where U is a upper triangular n by n matrix band-matrix with |
---|
| 389 | upper bandwidth q. |
---|
| 390 | Assumes that U is nonsingular. Requires about 2nq flops (if n >> q). |
---|
| 391 | Uses Alg. 4.3.3 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. |
---|
| 392 | */ |
---|
| 393 | vec backward_substitution(const mat &U, int q, const vec &b); |
---|
| 394 | |
---|
| 395 | /*! \brief Backward substitution of band matrix. |
---|
| 396 | |
---|
| 397 | Solves Ux=b, where U is a upper triangular n by n matrix band-matrix with |
---|
| 398 | upper bandwidth q. |
---|
| 399 | Assumes that U is nonsingular. Requires about 2nq flops (if n >> q). |
---|
| 400 | Uses Alg. 4.3.3 in Golub & van Loan "Matrix computations", 3rd ed., p. 153. |
---|
| 401 | */ |
---|
| 402 | void backward_substitution(const mat &U, int q, const vec &b, vec &x); |
---|
| 403 | |
---|
| 404 | //!@} |
---|
| 405 | |
---|
| 406 | } //namespace itpp |
---|
| 407 | |
---|
| 408 | #endif // #ifndef LS_SOLVE_H |
---|
| 409 | |
---|
| 410 | |
---|