1 #ifndef _CLEHP_2_SMATRIX_MIGRATION_H_
2 #define _CLEHP_2_SMATRIX_MIGRATION_H_
24 template<
unsigned int N1,
unsigned int N2>
25 ROOT::Math::SMatrix<double,N1,N2, typename ROOT::Math::MatRepStd<double,N1,N2> >
asSMatrix(
const CLHEP::HepMatrix &
m) {
26 typedef typename ROOT::Math::MatRepStd<double,N1,N2> REP;
27 assert(m.num_row() == N1); assert(m.num_col() == N2);
28 return ROOT::Math::SMatrix<double,N1,N2,REP> (&
m(1,1), REP::kSize);
31 template<
unsigned int N1>
32 ROOT::Math::SMatrix<double,N1,N1, typename ROOT::Math::MatRepSym<double,N1> >
asSMatrix(
const CLHEP::HepSymMatrix &
m) {
33 typedef typename ROOT::Math::MatRepSym<double,N1> REP;
34 assert(m.num_row() == N1);
35 return ROOT::Math::SMatrix<double,N1,N1,REP> (&
m(1,1), REP::kSize);
38 template<
unsigned int N1>
39 ROOT::Math::SVector<double,N1>
asSVector(
const CLHEP::HepVector &
m) {
40 return ROOT::Math::SVector<double,N1> (&m[0], N1);
43 template<
unsigned int N> CLHEP::HepVector
asHepVector(
const ROOT::Math::SVector<double,N> &
v) {
44 CLHEP::HepVector hv(
N);
45 memcpy(&hv[0], &v[0],
N*
sizeof(
double));
49 template<
unsigned int N1,
unsigned int N2> CLHEP::HepMatrix
asHepMatrix (
50 const ROOT::Math::SMatrix<
double,N1,N2,
typename ROOT::Math::MatRepStd<double,N1,N2> > &
rm) {
51 CLHEP::HepMatrix am(N1,N2);
52 memcpy(&am(1,1),
rm.Array(), N1*N2*
sizeof(double));
57 const ROOT::Math::SMatrix<
double,N1,N1,
typename ROOT::Math::MatRepSym<double,N1> > &
rm) {
58 CLHEP::HepSymMatrix am(N1);
59 memcpy(&am(1,1),
rm.Array(), (N1*(N1+1))/2*
sizeof(double));
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
ROOT::Math::SVector< double, N1 > asSVector(const CLHEP::HepVector &m)
ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > asSMatrix(const CLHEP::HepMatrix &m)
CLHEP::HepVector asHepVector(const ROOT::Math::SVector< double, N > &v)