compiler_eigen.h
Go to the documentation of this file.
#ifndef _RHEOLEF_COMPILER_EIGEN_H
#define _RHEOLEF_COMPILER_EIGEN_H
// just include eigen Dense & Tensor without any warning
// author: Pierre.Saramito@imag.fr
// date: 22 january 2019
#include "rheolef/compiler.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <unsupported/Eigen/CXX11/Tensor>
#pragma GCC diagnostic pop
namespace rheolef { namespace details {
// c(j,k) = a(i,j,k)*b(i)
template<class T1, class T2, class T3>
void
contract0_tensor3_vector (
const Eigen::Tensor<T1,3>& a,
const Eigen::Matrix<T2,Eigen::Dynamic,1>& b,
Eigen::Matrix<T3,Eigen::Dynamic,Eigen::Dynamic>& c)
{
// TODO: c = b.transpose()*a; ==> need compat between Eigen::Matrix and Tensor
size_t ni = a.dimension(0);
size_t nj = a.dimension(1);
size_t nk = a.dimension(2);
c.resize (nj, nk);
for (size_t j = 0; j < nj; ++j) {
for (size_t k = 0; k < nk; ++k) {
T3 sum = 0;
for (size_t i = 0; i < ni; ++i) {
sum += b[i]*a(i,j,k);
}
c(j,k) = sum;
}}
}
}} // namespace rheolef::details
#endif // _RHEOLEF_COMPILER_EIGEN_H
mkgeo_ball.c
c
Definition: mkgeo_ball.sh:153
a
Definition: diffusion_isotropic.h:25
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
mkgeo_ball.b
b
Definition: mkgeo_ball.sh:152
rheolef::details::contract0_tensor3_vector
void contract0_tensor3_vector(const Eigen::Tensor< T1, 3 > &a, const Eigen::Matrix< T2, Eigen::Dynamic, 1 > &b, Eigen::Matrix< T3, Eigen::Dynamic, Eigen::Dynamic > &c)
Definition: compiler_eigen.h:42
mkgeo_ball.a
a
Definition: mkgeo_ball.sh:151