Re: [eigen] A piece of code that has me confused

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 20.07.2011 21:05, Douglas Bates wrote:
In the file unsupported/Eigen/src/SparseExtra/SimplicialCholesky.h the
method _solve uses the template keyword in a way I have not seen
before:


	  if(m_matrix.nonZeros()>0) // otherwise L==I
	      m_matrix.template triangularView<UnitLower>().solveInPlace(dest);

Can anyone point me to documentation on that usage?

Short answer: Since the compiler does not know the actual type of m_matrix, it can't be sure whether triangularView is a member variable or a templated function, by using template it is told that it is the latter.

Here is a pretty good answer to that question:

http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-template-and-typename-on-dependent-names

HTH
Christoph



--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/