g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::nmat< T > Class Template Reference

Public Member Functions

 nmat (unsigned int a_D)
 
virtual ~nmat ()
 
 nmat (const nmat &a_from)
 
nmatoperator= (const nmat &a_from)
 
 nmat (unsigned int a_D, const T a_v[])
 
unsigned int dimension () const
 

Protected Attributes

unsigned int m_D
 
unsigned int m_D2
 
T * m_vec
 

Detailed Description

template<class T>
class tools::nmat< T >

Definition at line 92 of file mat.

Constructor & Destructor Documentation

◆ nmat() [1/3]

template<class T >
tools::nmat< T >::nmat ( unsigned int  a_D)
inline

Definition at line 105 of file mat.

105  :m_D(a_D),m_D2(a_D*a_D),m_vec(0) {
106 #ifdef TOOLS_MEM
107  mem::increment(s_class().c_str());
108 #endif
109  m_vec = new T[m_D2];
110  for(unsigned int i=0;i<m_D2;i++) m_vec[i] = zero();
111  }

◆ ~nmat()

template<class T >
virtual tools::nmat< T >::~nmat ( )
inlinevirtual

Definition at line 112 of file mat.

112  {
113  delete [] m_vec;
114 #ifdef TOOLS_MEM
115  mem::decrement(s_class().c_str());
116 #endif
117  }

◆ nmat() [2/3]

template<class T >
tools::nmat< T >::nmat ( const nmat< T > &  a_from)
inline

Definition at line 119 of file mat.

120  :m_D(a_from.m_D),m_D2(a_from.m_D2),m_vec(0)
121  {
122 #ifdef TOOLS_MEM
123  mem::increment(s_class().c_str());
124 #endif
125  m_vec = new T[m_D2];
126  _copy(a_from.m_vec);
127  }

◆ nmat() [3/3]

template<class T >
tools::nmat< T >::nmat ( unsigned int  a_D,
const T  a_v[] 
)
inline

Definition at line 140 of file mat.

141  :m_D(a_D),m_D2(a_D*a_D),m_vec(0)
142  {
143 #ifdef TOOLS_MEM
144  mem::increment(s_class().c_str());
145 #endif
146  m_vec = new T[m_D2];
147  _copy(a_v);
148  }

Member Function Documentation

◆ dimension()

template<class T >
unsigned int tools::nmat< T >::dimension ( ) const
inline

Definition at line 150 of file mat.

150 {return m_D;}

◆ operator=()

template<class T >
nmat& tools::nmat< T >::operator= ( const nmat< T > &  a_from)
inline

Definition at line 128 of file mat.

128  {
129  if(&a_from==this) return *this;
130  if(a_from.m_D!=m_D) {
131  m_D = a_from.m_D;
132  m_D2 = a_from.m_D2;
133  delete [] m_vec;
134  m_vec = new T[m_D2];
135  }
136  _copy(a_from.m_vec);
137  return *this;
138  }

Member Data Documentation

◆ m_D

template<class T >
unsigned int tools::nmat< T >::m_D
protected

Definition at line 152 of file mat.

◆ m_D2

template<class T >
unsigned int tools::nmat< T >::m_D2
protected

Definition at line 153 of file mat.

◆ m_vec

template<class T >
T* tools::nmat< T >::m_vec
protected

Definition at line 154 of file mat.


The documentation for this class was generated from the following file:
tools::nmat::m_D2
unsigned int m_D2
Definition: mat:153
tools::nmat::m_vec
T * m_vec
Definition: mat:154
tools::nmat::m_D
unsigned int m_D
Definition: mat:152