19 #include "algebraCore.h"
31 T
sq(
const T x) {
return x * x; }
35 void scaled(
const T alpha, std::vector<T> & Y)
36 { std::for_each(Y.begin(),Y.end(),[alpha](T &_x){ _x *= alpha; }); }
40 void p_direct(
const std::vector<T> & X,
const std::vector<T> & Y, std::vector<T> & Z)
41 { std::transform(X.begin(),X.end(),Y.begin(),Z.begin(), std::multiplies<T>() ); }
45 void add(
const std::vector<T> & X, std::vector<T> & Y)
47 for (
size_t i = 0; i < Y.size(); ++i)
53 void sub(
const std::vector<T> & X, std::vector<T> & Y)
55 for (
size_t i = 0; i < Y.size(); ++i)
61 void scaled_add(
const std::vector<T> & X,
const T alpha, std::vector<T> & Y)
63 for (
size_t i = 0; i < Y.size(); ++i)
76 void applyMask(
const std::vector<int>& mask, std::vector<T> & X)
77 { std::for_each(mask.begin(),mask.end(),[&X](
const int _i){ X[_i] = (T)(0); }); }
81 {m.
print(flux);
return flux;}
86 {
return std::none_of(
v.begin(),
v.end(), [](T x){ return std::isnan(x);} ); }
Square sparse matrix.
Definition: sparseMat.h:46
void print(std::ostream &flux=std::cout) const
Definition: sparseMat.h:127
iteration class from GMM, with some adaptations and simplifications.
constexpr double v[NPI]
Definition: facette.h:49
constexpr double A
Definition: tetra.h:52
void scaled_add(const std::vector< T > &X, const T alpha, std::vector< T > &Y)
Definition: algebra.h:61
void p_direct(const std::vector< T > &X, const std::vector< T > &Y, std::vector< T > &Z)
Definition: algebra.h:40
void applyMask(const std::vector< int > &mask, std::vector< T > &X)
Definition: algebra.h:76
void add(const std::vector< T > &X, std::vector< T > &Y)
Definition: algebra.h:45
void sub(const std::vector< T > &X, std::vector< T > &Y)
Definition: algebra.h:53
std::ostream & operator<<(std::ostream &flux, SparseMatrix const &m)
Definition: algebra.h:80
bool check(std::vector< T > &v)
Definition: algebra.h:85
void mult(SparseMatrix &A, std::vector< T > const &X, std::vector< T > &Y)
Definition: algebra.h:69
void scaled(const T alpha, std::vector< T > &Y)
Definition: algebra.h:35
T sq(const T x)
Definition: algebra.h:31