| 174 | |
| 175 | |
| 176 | RowMatrix::value_type UdUdet (const RowMatrix& UD) |
| 177 | /* Compute the determinant of the original PSD |
| 178 | * matrix for which UD is the factor UdU' or LdL' |
| 179 | * Result comes directly from determinant of diagonal in triangular matrices |
| 180 | * Defined to be 1 for 0 size UD |
| 181 | */ |
| 182 | { |
| 183 | const std::size_t n = UD.size1(); |
| 184 | assert (n == UD.size2()); |
| 185 | RowMatrix::value_type det = 1; |
| 186 | for (std::size_t i = 0; i < n; ++i) { |
| 187 | det *= UD(i,i); |
| 188 | } |
| 189 | return det; |
| 190 | } |
| 191 | |
| 192 | |
| 193 | RowMatrix::value_type UdUfactor_variant1 (RowMatrix& M, std::size_t n) |