20template <
typename T,
size_t ROW,
size_t COL>
21using Matrix = std::array<std::array<T, COL>, ROW>;
23template <
size_t N,
size_t M = N>
24auto eye(
double k = 1.0)
27 size_t m = std::min(M, N);
28 for (
size_t i = 0; i < m; i++)
34template <
size_t N,
size_t M = N>
41template <
int N,
int M = N>
46 for (
int i = 0; i < M; i++)
47 for (
int j = 0; j < N; j++)
57 for (
int k = 0; k < N; k++) {
58 const double Lk = L[k][k];
59 const double s = x[k] / Lk;
62 r = std::sqrt(Lk * Lk - x[k] * x[k]);
64 r = std::hypot(Lk, x[k]);
66 const double c = r / Lk;
69 for (
int j = k + 1; (k != (N - 1) && (j < N)); j++) {
71 L[j][k] -= s * x[j] / c;
73 L[j][k] += s * x[j] / c;
74 x[j] = c * x[j] - s * L[j][k];
Slide namespace contains all the types, classes, and functions for the simulation framework.
Definition: Cell.hpp:27
std::array< std::array< T, COL >, ROW > Matrix
See source: http://cpptruths.blogspot.com/2011/10/multi-dimensional-arrays-in-c11....
Definition: matrix.hpp:21
void cholUpdate(slide::Matrix< double, N, N > &L, std::array< double, N > x, bool isDowndate=false)
Definition: matrix.hpp:54
auto ones(double k=1.0)
Definition: matrix.hpp:42
auto eye(double k=1.0)
Definition: matrix.hpp:24
auto zeros()
Definition: matrix.hpp:35