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
long m_iConstOffset
Definition: ap.h:969
STATIC_VAR jList * T
Definition: janet.cc:30

◆ template_2d_array() [3/4]

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

Definition at line 818 of file svd_si.h.

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

◆ ~template_2d_array() [2/2]

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

Definition at line 824 of file svd_si.h.

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

◆ 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 830 of file svd_si.h.

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

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 940 of file svd_si.h.

941  {
942  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
943  return raw_vector<T>(0, 0, 1);
944  else
945  return raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
946  };
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 956 of file svd_si.h.

957  {
958  if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) )
959  return const_raw_vector<T>(0, 0, 1);
960  else
961  return const_raw_vector<T>(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember);
962  };
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 920 of file svd_si.h.

921  {
922  return m_Vec;
923  };

◆ getcontent() [4/4]

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

Definition at line 925 of file svd_si.h.

926  {
927  return m_Vec;
928  };

◆ 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 935 of file svd_si.h.

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

◆ 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 930 of file svd_si.h.

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

◆ 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 948 of file svd_si.h.

949  {
950  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
951  return raw_vector<T>(0, 0, 1);
952  else
953  return raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
954  };
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 964 of file svd_si.h.

965  {
966  if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd))
967  return const_raw_vector<T>(0, 0, 1);
968  else
969  return const_raw_vector<T>(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1);
970  };
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 881 of file svd_si.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()() [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 890 of file svd_si.h.

891  {
892  #ifndef NO_AP_ASSERT
895  #endif
896  return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember];
897  };
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
long m_iConstOffset
Definition: ap.h:969
STATIC_VAR jList * T
Definition: janet.cc:30

◆ 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 852 of file svd_si.h.

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

◆ 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
long m_iConstOffset
Definition: ap.h:969
STATIC_VAR jList * T
Definition: janet.cc:30

◆ 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 899 of file svd_si.h.

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

◆ 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 913 of file svd_si.h.

914  {
915  setbounds(iLow1, iHigh1, iLow2, iHigh2);
916  for(int i=0; i<m_iVecSize; i++)
917  m_Vec[i]=pContent[i];
918  };
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 973 of file svd_si.h.

973 { 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 972 of file svd_si.h.

972 { 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: