| 127 | |
| 128 | |
| 129 | void Information_root_scheme::inverse_Fx (FM::DenseColMatrix& invFx, const FM::Matrix& Fx) |
| 130 | /* Numerical Inversion of Fx using LU factorisation |
| 131 | * Required LAPACK getrf (with PIVOTING) and getrs |
| 132 | */ |
| 133 | { |
| 134 | // LU factorise with pivots |
| 135 | DenseColMatrix FxLU (Fx); |
| 136 | LAPACK::pivot_t ipivot(FxLU.size1()); // Pivots initialised to zero |
| 137 | ipivot.clear(); |
| 138 | |
| 139 | int info = LAPACK::getrf(FxLU, ipivot); |
| 140 | if (info < 0) |
| 141 | error (Numeric_exception("Fx not LU factorisable")); |
| 142 | |
| 143 | FM::identity(invFx); // Invert |
| 144 | info = LAPACK::getrs('N', FxLU, ipivot, invFx); |
| 145 | if (info != 0) |
| 146 | error (Numeric_exception("Predict Fx not LU invertable")); |
| 147 | } |
| 148 | |
| 149 | |
| 150 | |