4#ifndef ROOT_Math_MatrixRepresentationsStatic
5#define ROOT_Math_MatrixRepresentationsStatic 1
53 template <
class T,
unsigned int D1,
unsigned int D2=D1>
60 inline const T&
operator()(
unsigned int i,
unsigned int j)
const {
78 for(
unsigned int i=0; i<
kSize; ++i)
fArray[i] += rhs[i];
84 for(
unsigned int i=0; i<
kSize; ++i)
fArray[i] -= rhs[i];
90 for(
unsigned int i=0; i<
kSize; ++i)
fArray[i] = rhs[i];
97 for(
unsigned int i=0; i<
kSize; ++i) {
98 rc = rc && (
fArray[i] == rhs[i]);
130 template<
unsigned int D>
135 for (
unsigned int i=1; i<D; ++i)
137 for (
unsigned int i=0; i<D; ++i) {
138 for (
unsigned int j=0; j<=i; ++j)
139 fOff[i*D+j] =
v[i]+j;
140 for (
unsigned int j=i+1; j<D; ++j)
141 fOff[i*D+j] =
v[j]+i ;
144 inline int operator()(
unsigned int i,
unsigned int j)
const {
return fOff[i*D+j]; }
145 inline int apply(
unsigned int i)
const {
return fOff[i]; }
149 namespace rowOffsetsUtils {
155 template<
int I,
class IndexTuple,
int N>
158 template<
int I,
int... Indices,
int N>
165 template<
int N,
int... Indices>
176 template<
int I0,
class F,
int...
I>
177 constexpr std::array<decltype(std::declval<F>()(std::declval<int>())),
sizeof...(I)>
180 return std::array<decltype(std::declval<F>()(std::declval<int>())),
181 sizeof...(I)>{{
f(I0 +
I)... }};
184 template<
int N,
int I0 = 0,
class F>
185 constexpr std::array<decltype(std::declval<F>()(std::declval<int>())),
N>
212 template <
class T,
unsigned int D>
225 inline T
const &
operator()(
unsigned int i,
unsigned int j)
const
236 inline T
apply(
unsigned int i)
const {
250 Cannot_assign_general_to_symmetric_matrix_representation);
264 Cannot_add_general_to_symmetric_matrix_representation);
278 Cannot_substract_general_to_symmetric_matrix_representation);
288 for(
unsigned int i=0; i<D*D; ++i) {
303 static constexpr int off0(
int i) {
return i==0 ? 0 :
off0(i-1)+i;}
304 static constexpr int off2(
int i,
int j) {
return j<i ?
off0(i)+j :
off0(j)+i; }
305 static constexpr int off1(
int i) {
return off2(i/D, i%D);}
308 static constexpr auto v = rowOffsetsUtils::make<D*D>(
off1);
312 static inline constexpr unsigned int
#define STATIC_CHECK(expr, msg)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Expression wrapper class for Matrix objects.
bool operator==(const R &rhs) const
T & operator[](unsigned int i)
const T & operator()(unsigned int i, unsigned int j) const
T apply(unsigned int i) const
MatRepStd< T, D1, D2 > & operator-=(const R &rhs)
@ kCols
return no. of matrix columns
@ kSize
return no of elements: rows*columns
@ kRows
return no. of matrix rows
MatRepStd< T, D1, D2 > & operator+=(const R &rhs)
T & operator()(unsigned int i, unsigned int j)
const T & operator[](unsigned int i) const
MatRepStd< T, D1, D2 > & operator=(const R &rhs)
MatRepSym Matrix storage representation for a symmetric matrix of dimension NxN This class is a templ...
MatRepSym< T, D > & operator-=(const R &)
self subtraction : only symmetric to symmetric allowed
static constexpr int off1(int i)
bool operator==(const R &rhs) const
MatRepSym< T, D > & operator+=(const MatRepSym &rhs)
static constexpr int off0(int i)
@ kCols
return no. of matrix columns
@ kRows
return no. of matrix rows
@ kSize
return no of elements: rows*columns
T & operator[](unsigned int i)
T const & operator()(unsigned int i, unsigned int j) const
MatRepSym< T, D > & operator=(const R &)
assignment : only symmetric to symmetric allowed
MatRepSym< T, D > & operator-=(const MatRepSym &rhs)
MatRepSym< T, D > & operator=(const MatRepSym &rhs)
static constexpr int off2(int i, int j)
T apply(unsigned int i) const
MatRepSym< T, D > & operator+=(const R &)
self addition : only symmetric to symmetric allowed
T const & operator[](unsigned int i) const
static constexpr unsigned int offset(unsigned int i, unsigned int j)
T & operator()(unsigned int i, unsigned int j)
Namespace for new Math classes and functions.
constexpr std::array< decltype(std::declval< F >()(std::declval< int >())), sizeof...(I)> do_make(F f, indices< I... >)
constexpr std::array< decltype(std::declval< F >()(std::declval< int >())), N > make(F f)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Static structure to keep the conversion from (i,j) to offsets in the storage data for a symmetric mat...
int apply(unsigned int i) const
int operator()(unsigned int i, unsigned int j) const
make_indices_impl< I+1, indices< Indices..., I >, N >::type type
indices< Indices... > type