Commit b4728120 authored by Yves Ineichen Mon Sep 17 00:00:00 2001's avatar Yves Ineichen Mon Sep 17 00:00:00 2001 Committed by kraus

fixing issue with template specialization and typename

parent 9b8c6a9c
......@@ -43,6 +43,21 @@ MMatrix<Tmplt>::MMatrix() : _matrix(NULL)
template MMatrix<double> ::MMatrix();
template MMatrix<m_complex>::MMatrix();
template MMatrix<double> MMatrix<double> ::Diagonal(size_t i, double diag, double off_diag);
template MMatrix<m_complex> MMatrix<m_complex>::Diagonal(size_t i, m_complex diag, m_complex off_diag);
template std::istream& operator>>(std::istream& in, MMatrix<double>& mat);
template std::istream& operator>>(std::istream& in, MMatrix<m_complex>& mat);
template MMatrix<double> ::MMatrix(size_t i, size_t j, double* data_beg );
template MMatrix<m_complex>::MMatrix(size_t i, size_t j, m_complex* data_beg );
template MMatrix<double> ::MMatrix(size_t i, size_t j, double value);
template MMatrix<m_complex>::MMatrix(size_t i, size_t j, m_complex value);
template MMatrix<double> ::MMatrix(size_t i, size_t j );
template MMatrix<m_complex>::MMatrix(size_t i, size_t j );
template MMatrix<double> MMatrix<double> ::inverse() const;
template MMatrix<m_complex> MMatrix<m_complex>::inverse() const;
template <>
void MMatrix<double>::delete_matrix()
......@@ -106,27 +121,21 @@ MMatrix<Tmplt>::MMatrix(size_t i, size_t j, Tmplt* data_beg ) : _matrix(NULL)
{
build_matrix(i, j, data_beg);
}
template MMatrix<double> ::MMatrix(size_t i, size_t j, double* data_beg );
template MMatrix<m_complex>::MMatrix(size_t i, size_t j, m_complex* data_beg );
template <class Tmplt>
MMatrix<Tmplt>::MMatrix(size_t i, size_t j, Tmplt value )
{
build_matrix(i, j);
for(size_t a=1; a<=i; a++)
for(size_t b=1; b<=j; b++)
operator()(a,b) = value;
build_matrix(i, j);
for(size_t a=1; a<=i; a++)
for(size_t b=1; b<=j; b++)
operator()(a,b) = value;
}
template MMatrix<double> ::MMatrix(size_t i, size_t j, double value);
template MMatrix<m_complex>::MMatrix(size_t i, size_t j, m_complex value);
template <class Tmplt>
MMatrix<Tmplt>::MMatrix(size_t i, size_t j )
{
build_matrix(i, j);
}
template MMatrix<double> ::MMatrix(size_t i, size_t j );
template MMatrix<m_complex>::MMatrix(size_t i, size_t j );
template <class Tmplt>
MMatrix<Tmplt> MMatrix<Tmplt>::Diagonal(size_t i, Tmplt diag_value, Tmplt off_diag_value)
......@@ -140,8 +149,6 @@ MMatrix<Tmplt> MMatrix<Tmplt>::Diagonal(size_t i, Tmplt diag_value, Tmplt off_di
}
return mm;
}
template MMatrix<double> MMatrix<double> ::Diagonal(size_t i, double diag, double off_diag);
template MMatrix<m_complex> MMatrix<m_complex>::Diagonal(size_t i, m_complex diag, m_complex off_diag);
template <class Tmplt>
......@@ -218,8 +225,6 @@ MMatrix<Tmplt> MMatrix<Tmplt>::inverse() const
copy.invert();
return copy;
}
template MMatrix<double> MMatrix<double> ::inverse() const;
template MMatrix<m_complex> MMatrix<m_complex>::inverse() const;
template <>
......@@ -366,8 +371,6 @@ template <class Tmplt> std::istream& operator>>(std::istream& in, MMatrix<Tmplt>
in >> mat(i,j);
return in;
}
template std::istream& operator>>(std::istream& in, MMatrix<double>& mat);
template std::istream& operator>>(std::istream& in, MMatrix<m_complex>& mat);
///////////////// INTERFACES
......
......@@ -47,20 +47,35 @@ std::istream& operator>>(std::istream& in, m_complex& c)
///////////////////////// MVector //////////////////////////////
template MVector<double> ::MVector(size_t i);
template MVector<m_complex>::MVector(size_t i);
template MVector<double> ::MVector(const MVector<double>&);
template MVector<m_complex>::MVector(const MVector<m_complex>&);
template MVector<double> ::MVector(size_t i, double value);
template MVector<m_complex>::MVector(size_t i, m_complex value);
template void MVector<double>::build_vector( const double* data_begin, const double* data_end );
template void MVector<m_complex>::build_vector( const m_complex* data_begin, const m_complex* data_end );
template std::ostream& operator<<(std::ostream& out, MVector<double> v);
template std::ostream& operator<<(std::ostream& out, MVector<m_complex> v);
template std::istream& operator>>(std::istream& out, MVector<double>& v);
template std::istream& operator>>(std::istream& out, MVector<m_complex>& v);
template MVector<double> MVector<double> ::sub(size_t n1, size_t n2) const;
template MVector<m_complex> MVector<m_complex>::sub(size_t n1, size_t n2) const;
template <typename Tmplt>
MVector<Tmplt>::MVector( size_t i ) : _vector(NULL)
{
build_vector(i);
}
template MVector<double> ::MVector(size_t i);
template MVector<m_complex>::MVector(size_t i);
template <typename Tmplt>
MVector<Tmplt>::MVector( const MVector<Tmplt>& mv) : _vector(NULL)
{ *this = mv; }
template MVector<double> ::MVector(const MVector<double>&);
template MVector<m_complex>::MVector(const MVector<m_complex>&);
template <typename Tmplt>
......@@ -69,8 +84,6 @@ MVector<Tmplt>::MVector( size_t size, Tmplt value ) : _vector(NULL)
build_vector(size);
for(size_t i=0; i<size; i++) operator()(i+1) = value;
}
template MVector<double> ::MVector(size_t i, double value);
template MVector<m_complex>::MVector(size_t i, m_complex value);
template <>
......@@ -93,8 +106,6 @@ void MVector<Tmplt>::build_vector ( const Tmplt* data_begin, const Tmplt* data
build_vector(data_end - data_begin);
for(size_t i=0; i<num_row(); i++) operator()(i+1) = data_begin[i];
}
template void MVector<double>::build_vector( const double* data_begin, const double* data_end );
template void MVector<m_complex>::build_vector( const m_complex* data_begin, const m_complex* data_end );
template <class Tmplt>
......@@ -167,8 +178,6 @@ template <class Tmplt> std::ostream& operator<<(std::ostream& out, MVector<Tmplt
for(size_t i=0; i<v.num_row(); i++) out << " " << v(i+1) << "\n";
return out;
}
template std::ostream& operator<<(std::ostream& out, MVector<double> v);
template std::ostream& operator<<(std::ostream& out, MVector<m_complex> v);
template <class Tmplt> std::istream& operator>>(std::istream& in, MVector<Tmplt>& v)
{
......@@ -178,8 +187,6 @@ template <class Tmplt> std::istream& operator>>(std::istream& in, MVector<Tmplt>
for(size_t i=1; i<=v.num_row(); i++) in >> v(i);
return in;
}
template std::istream& operator>>(std::istream& out, MVector<double>& v);
template std::istream& operator>>(std::istream& out, MVector<m_complex>& v);
const gsl_vector* MVector_to_gsl(const MVector<double>& vd)
{return vd.get_vector(vd);}
......@@ -193,8 +200,6 @@ MVector<Tmplt> MVector<Tmplt>::sub(size_t n1, size_t n2) const
for(size_t i=n1; i<=n2; i++) temp(i-n1+1) = operator()(i);
return temp;
}
template MVector<double> MVector<double> ::sub(size_t n1, size_t n2) const;
template MVector<m_complex> MVector<m_complex>::sub(size_t n1, size_t n2) const;
MVector<m_complex> complex(MVector<double> real)
{
......
......@@ -226,8 +226,8 @@ void SquarePolynomialVector::PrintContainer(std::ostream& out, const Container&
// class Container::iterator it;
std::stringstream strstr1("");
std::stringstream strstr2("");
class Container::const_iterator it1 = container.begin();
class Container::const_iterator it2 = it1;
typename Container::const_iterator it1 = container.begin();
typename Container::const_iterator it2 = it1;
while(it1!=container.end())
{
it2++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment