19 #include "algebraCore.h"
30 T
sq(
const T x) {
return x * x; }
34 void scaled(
const T alpha, std::vector<T> & Y)
35 { std::for_each(Y.begin(),Y.end(),[alpha](T &_x){ _x *= alpha; }); }
39 void p_direct(
const std::vector<T> & X,
const std::vector<T> & Y, std::vector<T> & Z)
40 { std::transform(X.begin(),X.end(),Y.begin(),Z.begin(), std::multiplies<T>() ); }
44 void add(
const std::vector<T> & X, std::vector<T> & Y)
46 for (
size_t i = 0; i < Y.size(); ++i)
52 void sub(
const std::vector<T> & X, std::vector<T> & Y)
54 for (
size_t i = 0; i < Y.size(); ++i)
60 void scaled_add(
const std::vector<T> & X,
const T alpha, std::vector<T> & Y)
62 for (
size_t i = 0; i < Y.size(); ++i)
75 void applyMask(
const std::vector<int>& mask, std::vector<T> & X)
76 { std::for_each(mask.begin(),mask.end(),[&X](
const int _i){ X[_i] = (T)(0); }); }
80 {m.
print(flux);
return flux;}
85 {
return std::none_of(
v.begin(),
v.end(), [](T x){ return std::isnan(x);} ); }
Read-mode square sparse matrix.
Definition: sparseMat.h:87
void print(std::ostream &flux=std::cout) const
Definition: sparseMat.h:167
iteration class from GMM, with some adaptations and simplifications.
constexpr double v[NPI]
Definition: facette.h:22
constexpr double A
Definition: tetra.h:29
void scaled_add(const std::vector< T > &X, const T alpha, std::vector< T > &Y)
Definition: algebra.h:60
void p_direct(const std::vector< T > &X, const std::vector< T > &Y, std::vector< T > &Z)
Definition: algebra.h:39
void applyMask(const std::vector< int > &mask, std::vector< T > &X)
Definition: algebra.h:75
void add(const std::vector< T > &X, std::vector< T > &Y)
Definition: algebra.h:44
void sub(const std::vector< T > &X, std::vector< T > &Y)
Definition: algebra.h:52
bool check(std::vector< T > &v)
Definition: algebra.h:84
std::ostream & operator<<(std::ostream &flux, r_sparseMat const &m)
Definition: algebra.h:79
void mult(r_sparseMat &A, std::vector< T > const &X, std::vector< T > &Y)
Definition: algebra.h:68
void scaled(const T alpha, std::vector< T > &Y)
Definition: algebra.h:34
T sq(const T x)
Definition: algebra.h:30