diff --git a/SpMat.h b/SpMat.h
index 9e1cd8a15819e68cc0c655c73f1292530d5dd253..164b4ed335fa83dec56270a7bed6adff377f1b1b 100644
--- a/SpMat.h
+++ b/SpMat.h
@@ -1009,12 +1009,14 @@ const SpMat<T> operator&(const SpMat<T>& th, const NEWMAT::GeneralMatrix& bh)
 //
 /////////////////////////////////////////////////////////////////////
 
+template<class T>
 const std::vector<unsigned int>& SpMat<T>::get_ri(unsigned int i) const
 {
   if (i >= _n) throw SpMatException("SpMat::get_ri: Index out of range");
   return(_ri[i]);
 }
 
+template<class T>
 const std::vector<T>& SpMat<T>::get_val(unsigned int i) const
 {
   if (i >= _n) throw SpMatException("SpMat::get_val: Index out of range");