11 #ifndef OOPS_ASSIMILATION_UPHESSSOLVE_H_ 12 #define OOPS_ASSIMILATION_UPHESSSOLVE_H_ 28 void UpHessSolve(std::vector< std::vector<double> > & UpHess,
const std::vector<double> & rhs,
29 std::vector<double> & sol) {
30 const double n = rhs.size();
31 ASSERT(UpHess.size() ==
n);
33 std::vector<double>
v(
n);
34 std::vector<double> y(
n);
39 for (
int ii = 0; ii <=
n-2; ++ii) {
40 v[ii+1] = UpHess[ii][ii+1]/UpHess[ii][ii];
41 for (
int jj = ii; jj <=
n-1; ++jj) {
42 UpHess[jj][ii+1] = UpHess[jj][ii+1] -
v[ii+1]*UpHess[jj][ii];
46 for (
int ii = 0; ii <=
n-1; ++ii) {
47 for (
int jj = ii+1; jj <=
n-1; ++jj) {
54 for (
int ii = 1; ii <=
n-1; ++ii) {
55 y[ii] = rhs[ii] -
v[ii]*y[ii-1];
64 #endif // OOPS_ASSIMILATION_UPHESSSOLVE_H_
Solves the upper triangular system sol = H \ rhs.
The namespace for the main oops code.
void UpHessSolve(std::vector< std::vector< double > > &UpHess, const std::vector< double > &rhs, std::vector< double > &sol)
void UpTriSolve(const std::vector< std::vector< double > > &H, const std::vector< double > &rhs, std::vector< double > &sol, const int &dim)