S
spyrosthalkidis
Dear Programmers,
I would like to extend the fplll library with an algorithm, so
I am currently reading its code. However, I do not completely
understand the use of templates at several places. I know the
basic use of function and class templates. I attach an example
code snippet:
template<class ZT, class FT>
MatGSO<ZT, FT>::MatGSO(Matrix<ZT>& argB, Matrix<ZT>& argU, Matrix<ZT>& argUInvT,
int flags) :
b(argB),
enableIntGram(flags & GSO_INT_GRAM),
enableRowExpo(flags & GSO_ROW_EXPO),
enableTransform(argU.getRows() > 0),
enableInvTransform(argUInvT.getRows() > 0),
rowOpForceLong(flags & GSO_OP_FORCE_LONG),
u(argU), uInvT(argUInvT),
nKnownRows(0), nSourceRows(0), nKnownCols(0),
colsLocked(false), allocDim(0)
It can be seen that this code defines a method which has two template classes
(ZT, FT) and has as parameter a matrix which is passed by reference and is
used as a ZT template.
The class MatGSO is defined as:
template<class ZT, class FT>
class MatGSO {
If anyone could help me I would be grateful.
Thank you in advance.
Spyros H.
I would like to extend the fplll library with an algorithm, so
I am currently reading its code. However, I do not completely
understand the use of templates at several places. I know the
basic use of function and class templates. I attach an example
code snippet:
template<class ZT, class FT>
MatGSO<ZT, FT>::MatGSO(Matrix<ZT>& argB, Matrix<ZT>& argU, Matrix<ZT>& argUInvT,
int flags) :
b(argB),
enableIntGram(flags & GSO_INT_GRAM),
enableRowExpo(flags & GSO_ROW_EXPO),
enableTransform(argU.getRows() > 0),
enableInvTransform(argUInvT.getRows() > 0),
rowOpForceLong(flags & GSO_OP_FORCE_LONG),
u(argU), uInvT(argUInvT),
nKnownRows(0), nSourceRows(0), nKnownCols(0),
colsLocked(false), allocDim(0)
It can be seen that this code defines a method which has two template classes
(ZT, FT) and has as parameter a matrix which is passed by reference and is
used as a ZT template.
The class MatGSO is defined as:
template<class ZT, class FT>
class MatGSO {
If anyone could help me I would be grateful.
Thank you in advance.
Spyros H.