RSMesh 1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
fgmres.cpp
1//
2// Created by RainSure on 2024/2/13.
3//
4#include "krylov/fgmres.h"
5
6namespace rsmesh::krylov {
7 fgmres::fgmres(const linear_operator& op, const valuesd& rhs, index_t max_iter)
8 : gmres(op, rhs, max_iter) {}
9
10 valuesd fgmres::solution_vector() const {
11 // r is an upper triangular matrix.
12 // Perform backward substitution to solve r y == g for y.
13 valuesd y = valuesd::Zero(iter_);
14 for (index_t j = iter_ - 1; j >= 0; j--) {
15 y(j) = g_(j);
16 for (index_t i = j + 1; i <= iter_ - 1; i++) {
17 y(j) -= r_(j, i) * y(i);
18 }
19 y(j) /= r_(j, j);
20 }
21
22 valuesd x = x0_;
23 for (index_t i = 0; i < iter_; i++) {
24 x += y(i) * zs_.at(i);
25 }
26
27 return x;
28 }
29
30 void fgmres::add_preconditioned_krylov_basis(const valuesd& z) { zs_.push_back(z); }
31
32}