<div class="gmail_quote">On Wed, Jun 15, 2011 at 19:05, Xiang Hao <span dir="ltr">&lt;<a href="mailto:haoxiang@yahoo.cn">haoxiang@yahoo.cn</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Now, I have a problem when I try to change the above to a c++ version(I want to use a class).</blockquote></div><div><br></div>Set the class pointer as the application context and use a simple wrapper:<div><br></div><div>
MatMult_Wrapped(Mat A,Vec X,Vec Y) {</div><div>  TheClass *cls;</div><div>  MatShellGetContext(A,&amp;cls);</div><div>  return cls-&gt;matmult(A,X,Y);</div><div>}</div>