OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
BoostMatrix.h
Go to the documentation of this file.
1//
2// This header file is made to facilitate boost's matrix and vector_t operations in OPAL.
3//
4// Copyright (c) 2023, Paul Scherrer Institute, Villigen PSI, Switzerland
5// All rights reserved
6//
7// This file is part of OPAL.
8//
9// OPAL is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// You should have received a copy of the GNU General Public License
15// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
16//
17
18#ifndef OPAL_MATRIX_HH
19#define OPAL_MATRIX_HH
20
21#include <boost/numeric/ublas/matrix.hpp>
22
23typedef boost::numeric::ublas::matrix<double> matrix_t;
24
25template <class T>
26T prod_boost_vector(boost::numeric::ublas::matrix<double> rotation, const T& vect) {
27 boost::numeric::ublas::vector<double> boostVector(3);
28
29 boostVector(0) = vect[0];
30 boostVector(1) = vect[1];
31 boostVector(2) = vect[2];
32
33 boostVector = boost::numeric::ublas::prod(rotation, boostVector);
34
35 T prodVector(0.0);
36
37 prodVector[0] = boostVector(0);
38 prodVector[1] = boostVector(1);
39 prodVector[2] = boostVector(2);
40
41 return prodVector;
42}
43
44#endif
boost::numeric::ublas::matrix< double > matrix_t
Definition BoostMatrix.h:23
T prod_boost_vector(boost::numeric::ublas::matrix< double > rotation, const T &vect)
Definition BoostMatrix.h:26
double T
Definition datatypes.h:7