I have the following template:
template<class Matrix>
Matrix horizontal_join (const Matrix& m1, const Matrix& m2) {
ASSERT (rows (m1) == rows (m2), "unequal number of rows");
typedef typename Matrix::value_type Scalar;
Matrix r (rows (m1), nbcol (m1) + nbcol (m2));
for (unsigned i=0; i<nbrow(m1); i++) {
for (unsigned j=0; j<nbcol(m1); j++)
r(i,j)= m1(i,j);
for (unsigned j=0; j<nbcol(m2); j++)
r(i,j+nbcol(m1))= m2(i,j);
}
return r;
}
defined in some library called "MATRDSE.m". There is also defined a structure called "matrsdse" in a file "matrdse.hpp" which represents a dense matrix type and which has several
-constructors,e.g matrdse(int nrRows, int nrCols, const value_type *src, ByRow() )
-and methods, e.g. transpose().
I want to use the "horizontal_join" template in my main function:
#include <matrdse.hpp>
#include <MATRDSE.m>
typedef matrdse<double> MxPoly;
int main{
double v[]={1,2,1,1,3,4,2,2,5,5,5,5,-2, 1,2,3,1, -2.8,-2.4,1,.2,5.8};
matrdse<double> A(4,4,v,ByRow());
std::cout<<"A="<<endl<<A<<endl;
matrdse<double> AT(A);
AT.transpose(); std::cout<<"Transpose(A)="<<endl<<AT<<endl;
MxPoly B;
B=horizontal_join<MxPoly>(A,AT);
cout<<B<<endl;
return 0;
}
Everything works fine, until "horizontal_join" is called and returned in B. I get the following compilation error:
main.cpp:168: error: 'horizontal_join' was not declared in this scope
main.cpp:168: error: expected primary-expression before '>' token
I do not understand the error. As I see it I do not know how to call the template..
Thank you in advance for any suggestions, madalina