Public Member Functions | Private Member Functions | Private Attributes
ap::template_2d_array< T > Class Template Reference

#include <ap.h>

Public Member Functions

 template_2d_array ()
 
 ~template_2d_array ()
 
 template_2d_array (const template_2d_array &rhs)
 
const template_2d_arrayoperator= (const template_2d_array &rhs)
 
const Toperator() (int i1, int i2) const
 
Toperator() (int i1, int i2)
 
void setbounds (int iLow1, int iHigh1, int iLow2, int iHigh2)
 
void setcontent (int iLow1, int iHigh1, int iLow2, int iHigh2, const T *pContent)
 
Tgetcontent ()
 
const Tgetcontent () const
 
int getlowbound (int iBoundNum) const
 
int gethighbound (int iBoundNum) const
 
raw_vector< Tgetcolumn (int iColumn, int iRowStart, int iRowEnd)
 
raw_vector< Tgetrow (int iRow, int iColumnStart, int iColumnEnd)
 
const_raw_vector< Tgetcolumn (int iColumn, int iRowStart, int iRowEnd) const
 
const_raw_vector< Tgetrow (int iRow, int iColumnStart, int iColumnEnd) const
 
 template_2d_array ()
 
 ~template_2d_array ()
 
 template_2d_array (const template_2d_array &rhs)
 
const template_2d_arrayoperator= (const template_2d_array &rhs)
 
const Toperator() (int i1, int i2) const
 
Toperator() (int i1, int i2)
 
void setbounds (int iLow1, int iHigh1, int iLow2, int iHigh2)
 
void setcontent (int iLow1, int iHigh1, int iLow2, int iHigh2, const T *pContent)
 
Tgetcontent ()
 
const Tgetcontent () const
 
int getlowbound (int iBoundNum) const
 
int gethighbound (int iBoundNum) const
 
raw_vector< Tgetcolumn (int iColumn, int iRowStart, int iRowEnd)
 
raw_vector< Tgetrow (int iRow, int iColumnStart, int iColumnEnd)
 
const_raw_vector< Tgetcolumn (int iColumn, int iRowStart, int iRowEnd) const
 
const_raw_vector< Tgetrow (int iRow, int iColumnStart, int iColumnEnd) const
 

Private Member Functions

bool wrongRow (int i) const
 
bool wrongColumn (int j) const
 
bool wrongRow (int i) const
 
bool wrongColumn (int j) const
 

Private Attributes

Tm_Vec
 
long m_iVecSize
 
long m_iLow1
 
long m_iLow2
 
long m_iHigh1
 
long m_iHigh2
 
long m_iConstOffset
 
long m_iLinearMember
 

Detailed Description

template<class T>
class ap::template_2d_array< T >

Definition at line 806 of file ap.h.

Constructor & Destructor Documentation

◆ template_2d_array() [1/4]

template<class T>
ap::template_2d_array< T >::template_2d_array ( )
inline

Definition at line 809 of file ap.h.

810  {
811  m_Vec=0;
812  m_iVecSize=0;
813  };

◆ ~template_2d_array() [1/2]

template<class T>
ap::template_2d_array< T >::~template_2d_array ( )
inline

Definition at line 815 of file ap.h.

816  {
817  if(m_Vec)
818  delete[] m_Vec;
819  };

◆ template_2d_array() [2/4]

template<class T>
ap::template_2d_array< T >::template_2d_array ( const template_2d_array< T > &  rhs)
inline

Definition at line 821 of file ap.h.

822  {
823  m_iVecSize = rhs.m_iVecSize;
824  m_iLow1 = rhs.m_iLow1;
825  m_iLow2 = rhs.m_iLow2;
826  m_iHigh1 = rhs.m_iHigh1;
827  m_iHigh2 = rhs.m_iHigh2;
828  m_iConstOffset = rhs.m_iConstOffset;
829  m_iLinearMember = rhs.m_iLinearMember;
830  if(rhs.m_Vec)
831  {
832  m_Vec = new T[m_iVecSize];
833  #ifndef UNSAFE_MEM_COPY
834  for(int i=0; i<m_iVecSize; i++)
835  m_Vec[i] = rhs.m_Vec[i];
836  #else
837  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
838  #endif
839  }
840  else
841  m_Vec=0;
842  };
int i
Definition: cfEzgcd.cc:125
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

◆ template_2d_array() [3/4]

template<class T>
ap::template_2d_array< T >::template_2d_array ( )
inline

Definition at line 817 of file svd_si.h.

818  {
819  m_Vec=0;
820  m_iVecSize=0;
821  };

◆ ~template_2d_array() [2/2]

template<class T>
ap::template_2d_array< T >::~template_2d_array ( )
inline

Definition at line 823 of file svd_si.h.

824  {
825  if(m_Vec)
826  delete[] m_Vec;
827  };

◆ template_2d_array() [4/4]

template<class T>
ap::template_2d_array< T >::template_2d_array ( const template_2d_array< T > &  rhs)
inline

Definition at line 829 of file svd_si.h.

830  {
831  m_iVecSize = rhs.m_iVecSize;
832  m_iLow1 = rhs.m_iLow1;
833  m_iLow2 = rhs.m_iLow2;
834  m_iHigh1 = rhs.m_iHigh1;
835  m_iHigh2 = rhs.m_iHigh2;
836  m_iConstOffset = rhs.m_iConstOffset;
837  m_iLinearMember = rhs.m_iLinearMember;
838  if(rhs.m_Vec)
839  {
840  m_Vec = new T[m_iVecSize];
841  #ifndef UNSAFE_MEM_COPY
842  for(int i=0; i<m_iVecSize; i++)
843  m_Vec[i] = rhs.m_Vec[i];
844  #else
845  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
846  #endif
847  }
848  else
849  m_Vec=0;
850  };
int i
Definition: cfEzgcd.cc:125
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

Member Function Documentation

◆ getcolumn() [1/4]

template<class T>
raw_vector<T> ap::template_2d_array< T >::getcolumn ( int  iColumn,
int  iRowStart,
int  iRowEnd 
)
inline

Definition at line 931 of file ap.h.

932  {
933  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
934  return raw_vector<T>(0, 0, 1);
935  else
936  return raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
937  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964
long m_iLinearMember
Definition: ap.h:969

◆ getcolumn() [2/4]

template<class T>
raw_vector<T> ap::template_2d_array< T >::getcolumn ( int  iColumn,
int  iRowStart,
int  iRowEnd 
)
inline

Definition at line 939 of file svd_si.h.

940  {
941  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
942  return raw_vector<T>(0, 0, 1);
943  else
944  return raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
945  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964
long m_iLinearMember
Definition: ap.h:969

◆ getcolumn() [3/4]

template<class T>
const_raw_vector<T> ap::template_2d_array< T >::getcolumn ( int  iColumn,
int  iRowStart,
int  iRowEnd 
) const
inline

Definition at line 947 of file ap.h.

948  {
949  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
950  return const_raw_vector<T>(0, 0, 1);
951  else
952  return const_raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
953  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964
long m_iLinearMember
Definition: ap.h:969

◆ getcolumn() [4/4]

template<class T>
const_raw_vector<T> ap::template_2d_array< T >::getcolumn ( int  iColumn,
int  iRowStart,
int  iRowEnd 
) const
inline

Definition at line 955 of file svd_si.h.

956  {
957  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
958  return const_raw_vector<T>(0, 0, 1);
959  else
960  return const_raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
961  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964
long m_iLinearMember
Definition: ap.h:969

◆ getcontent() [1/4]

template<class T>
T* ap::template_2d_array< T >::getcontent ( )
inline

Definition at line 911 of file ap.h.

912  {
913  return m_Vec;
914  };

◆ getcontent() [2/4]

template<class T>
const T* ap::template_2d_array< T >::getcontent ( ) const
inline

Definition at line 916 of file ap.h.

917  {
918  return m_Vec;
919  };

◆ getcontent() [3/4]

template<class T>
T* ap::template_2d_array< T >::getcontent ( )
inline

Definition at line 919 of file svd_si.h.

920  {
921  return m_Vec;
922  };

◆ getcontent() [4/4]

template<class T>
const T* ap::template_2d_array< T >::getcontent ( ) const
inline

Definition at line 924 of file svd_si.h.

925  {
926  return m_Vec;
927  };

◆ gethighbound() [1/2]

template<class T>
int ap::template_2d_array< T >::gethighbound ( int  iBoundNum) const
inline

Definition at line 926 of file ap.h.

927  {
928  return iBoundNum==1 ? m_iHigh1 : m_iHigh2;
929  };

◆ gethighbound() [2/2]

template<class T>
int ap::template_2d_array< T >::gethighbound ( int  iBoundNum) const
inline

Definition at line 934 of file svd_si.h.

935  {
936  return iBoundNum==1 ? m_iHigh1 : m_iHigh2;
937  };

◆ getlowbound() [1/2]

template<class T>
int ap::template_2d_array< T >::getlowbound ( int  iBoundNum) const
inline

Definition at line 921 of file ap.h.

922  {
923  return iBoundNum==1 ? m_iLow1 : m_iLow2;
924  };

◆ getlowbound() [2/2]

template<class T>
int ap::template_2d_array< T >::getlowbound ( int  iBoundNum) const
inline

Definition at line 929 of file svd_si.h.

930  {
931  return iBoundNum==1 ? m_iLow1 : m_iLow2;
932  };

◆ getrow() [1/4]

template<class T>
raw_vector<T> ap::template_2d_array< T >::getrow ( int  iRow,
int  iColumnStart,
int  iColumnEnd 
)
inline

Definition at line 939 of file ap.h.

940  {
941  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
942  return raw_vector<T>(0, 0, 1);
943  else
944  return raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
945  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964

◆ getrow() [2/4]

template<class T>
raw_vector<T> ap::template_2d_array< T >::getrow ( int  iRow,
int  iColumnStart,
int  iColumnEnd 
)
inline

Definition at line 947 of file svd_si.h.

948  {
949  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
950  return raw_vector<T>(0, 0, 1);
951  else
952  return raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
953  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964

◆ getrow() [3/4]

template<class T>
const_raw_vector<T> ap::template_2d_array< T >::getrow ( int  iRow,
int  iColumnStart,
int  iColumnEnd 
) const
inline

Definition at line 955 of file ap.h.

956  {
957  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
958  return const_raw_vector<T>(0, 0, 1);
959  else
960  return const_raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
961  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964

◆ getrow() [4/4]

template<class T>
const_raw_vector<T> ap::template_2d_array< T >::getrow ( int  iRow,
int  iColumnStart,
int  iColumnEnd 
) const
inline

Definition at line 963 of file svd_si.h.

964  {
965  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
966  return const_raw_vector<T>(0, 0, 1);
967  else
968  return const_raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
969  };
bool wrongRow(int i) const
Definition: ap.h:963
bool wrongColumn(int j) const
Definition: ap.h:964

◆ operator()() [1/4]

template<class T>
const T& ap::template_2d_array< T >::operator() ( int  i1,
int  i2 
) const
inline

Definition at line 872 of file ap.h.

873  {
874  #ifndef NO_AP_ASSERT
877  #endif
878  return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember];
879  };
static void make_assertion(bool bClause)
Definition: ap.h:49
long m_iLinearMember
Definition: ap.h:969
long m_iConstOffset
Definition: ap.h:969

◆ operator()() [2/4]

template<class T>
const T& ap::template_2d_array< T >::operator() ( int  i1,
int  i2 
) const
inline

Definition at line 880 of file svd_si.h.

881  {
882  #ifndef NO_AP_ASSERT
885  #endif
886  return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember];
887  };
static void make_assertion(bool bClause)
Definition: ap.h:49
long m_iLinearMember
Definition: ap.h:969
long m_iConstOffset
Definition: ap.h:969

◆ operator()() [3/4]

template<class T>
T& ap::template_2d_array< T >::operator() ( int  i1,
int  i2 
)
inline

Definition at line 881 of file ap.h.

882  {
883  #ifndef NO_AP_ASSERT
886  #endif
887  return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember];
888  };
static void make_assertion(bool bClause)
Definition: ap.h:49
long m_iLinearMember
Definition: ap.h:969
long m_iConstOffset
Definition: ap.h:969

◆ operator()() [4/4]

template<class T>
T& ap::template_2d_array< T >::operator() ( int  i1,
int  i2 
)
inline

Definition at line 889 of file svd_si.h.

890  {
891  #ifndef NO_AP_ASSERT
894  #endif
895  return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember];
896  };
static void make_assertion(bool bClause)
Definition: ap.h:49
long m_iLinearMember
Definition: ap.h:969
long m_iConstOffset
Definition: ap.h:969

◆ operator=() [1/2]

template<class T>
const template_2d_array& ap::template_2d_array< T >::operator= ( const template_2d_array< T > &  rhs)
inline

Definition at line 843 of file ap.h.

844  {
845  if( this==&rhs )
846  return *this;
847 
848  m_iLow1 = rhs.m_iLow1;
849  m_iLow2 = rhs.m_iLow2;
850  m_iHigh1 = rhs.m_iHigh1;
851  m_iHigh2 = rhs.m_iHigh2;
852  m_iConstOffset = rhs.m_iConstOffset;
853  m_iLinearMember = rhs.m_iLinearMember;
854  m_iVecSize = rhs.m_iVecSize;
855  if(m_Vec)
856  delete[] m_Vec;
857  if(rhs.m_Vec)
858  {
859  m_Vec = new T[m_iVecSize];
860  #ifndef UNSAFE_MEM_COPY
861  for(int i=0; i<m_iVecSize; i++)
862  m_Vec[i] = rhs.m_Vec[i];
863  #else
864  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
865  #endif
866  }
867  else
868  m_Vec=0;
869  return *this;
870  };
int i
Definition: cfEzgcd.cc:125
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

◆ operator=() [2/2]

template<class T>
const template_2d_array& ap::template_2d_array< T >::operator= ( const template_2d_array< T > &  rhs)
inline

Definition at line 851 of file svd_si.h.

852  {
853  if( this==&rhs )
854  return *this;
855 
856  m_iLow1 = rhs.m_iLow1;
857  m_iLow2 = rhs.m_iLow2;
858  m_iHigh1 = rhs.m_iHigh1;
859  m_iHigh2 = rhs.m_iHigh2;
860  m_iConstOffset = rhs.m_iConstOffset;
861  m_iLinearMember = rhs.m_iLinearMember;
862  m_iVecSize = rhs.m_iVecSize;
863  if(m_Vec)
864  delete[] m_Vec;
865  if(rhs.m_Vec)
866  {
867  m_Vec = new T[m_iVecSize];
868  #ifndef UNSAFE_MEM_COPY
869  for(int i=0; i<m_iVecSize; i++)
870  m_Vec[i] = rhs.m_Vec[i];
871  #else
872  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
873  #endif
874  }
875  else
876  m_Vec=0;
877  return *this;
878  };
int i
Definition: cfEzgcd.cc:125
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

◆ setbounds() [1/2]

template<class T>
void ap::template_2d_array< T >::setbounds ( int  iLow1,
int  iHigh1,
int  iLow2,
int  iHigh2 
)
inline

Definition at line 890 of file ap.h.

891  {
892  if(m_Vec)
893  delete[] m_Vec;
894  m_iVecSize = (iHigh1-iLow1+1)*(iHigh2-iLow2+1);
895  m_Vec = new T[m_iVecSize];
896  m_iLow1 = iLow1;
897  m_iHigh1 = iHigh1;
898  m_iLow2 = iLow2;
899  m_iHigh2 = iHigh2;
902  };
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

◆ setbounds() [2/2]

template<class T>
void ap::template_2d_array< T >::setbounds ( int  iLow1,
int  iHigh1,
int  iLow2,
int  iHigh2 
)
inline

Definition at line 898 of file svd_si.h.

899  {
900  if(m_Vec)
901  delete[] m_Vec;
902  m_iVecSize = (iHigh1-iLow1+1)*(iHigh2-iLow2+1);
903  m_Vec = new T[m_iVecSize];
904  m_iLow1 = iLow1;
905  m_iHigh1 = iHigh1;
906  m_iLow2 = iLow2;
907  m_iHigh2 = iHigh2;
910  };
long m_iLinearMember
Definition: ap.h:969
static jList * T
Definition: janet.cc:30
long m_iConstOffset
Definition: ap.h:969

◆ setcontent() [1/2]

template<class T>
void ap::template_2d_array< T >::setcontent ( int  iLow1,
int  iHigh1,
int  iLow2,
int  iHigh2,
const T pContent 
)
inline

Definition at line 904 of file ap.h.

905  {
906  setbounds(iLow1, iHigh1, iLow2, iHigh2);
907  for(int i=0; i<m_iVecSize; i++)
908  m_Vec[i]=pContent[i];
909  };
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition: ap.h:890
int i
Definition: cfEzgcd.cc:125

◆ setcontent() [2/2]

template<class T>
void ap::template_2d_array< T >::setcontent ( int  iLow1,
int  iHigh1,
int  iLow2,
int  iHigh2,
const T pContent 
)
inline

Definition at line 912 of file svd_si.h.

913  {
914  setbounds(iLow1, iHigh1, iLow2, iHigh2);
915  for(int i=0; i<m_iVecSize; i++)
916  m_Vec[i]=pContent[i];
917  };
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition: ap.h:890
int i
Definition: cfEzgcd.cc:125

◆ wrongColumn() [1/2]

template<class T>
bool ap::template_2d_array< T >::wrongColumn ( int  j) const
inlineprivate

Definition at line 964 of file ap.h.

964 { return j<m_iLow2 || j>m_iHigh2; };

◆ wrongColumn() [2/2]

template<class T>
bool ap::template_2d_array< T >::wrongColumn ( int  j) const
inlineprivate

Definition at line 972 of file svd_si.h.

972 { return j<m_iLow2 || j>m_iHigh2; };

◆ wrongRow() [1/2]

template<class T>
bool ap::template_2d_array< T >::wrongRow ( int  i) const
inlineprivate

Definition at line 963 of file ap.h.

963 { return i<m_iLow1 || i>m_iHigh1; };

◆ wrongRow() [2/2]

template<class T>
bool ap::template_2d_array< T >::wrongRow ( int  i) const
inlineprivate

Definition at line 971 of file svd_si.h.

971 { return i<m_iLow1 || i>m_iHigh1; };

Field Documentation

◆ m_iConstOffset

template<class T>
long ap::template_2d_array< T >::m_iConstOffset
private

Definition at line 969 of file ap.h.

◆ m_iHigh1

template<class T>
long ap::template_2d_array< T >::m_iHigh1
private

Definition at line 968 of file ap.h.

◆ m_iHigh2

template<class T>
long ap::template_2d_array< T >::m_iHigh2
private

Definition at line 968 of file ap.h.

◆ m_iLinearMember

template<class T>
long ap::template_2d_array< T >::m_iLinearMember
private

Definition at line 969 of file ap.h.

◆ m_iLow1

template<class T>
long ap::template_2d_array< T >::m_iLow1
private

Definition at line 968 of file ap.h.

◆ m_iLow2

template<class T>
long ap::template_2d_array< T >::m_iLow2
private

Definition at line 968 of file ap.h.

◆ m_iVecSize

template<class T>
long ap::template_2d_array< T >::m_iVecSize
private

Definition at line 967 of file ap.h.

◆ m_Vec

template<class T>
T * ap::template_2d_array< T >::m_Vec
private

Definition at line 964 of file ap.h.


The documentation for this class was generated from the following files: