问题
I am trying to implement certain matrix operations but I am lost in the internals of ublas library. is there a resource such as tutorial or an example on how to implement new ublas matrix expressions?
Thanks
回答1:
Don't know if it'll help, but there's a wiki page on extending uBlas here. That expression template stuff really blows my mind. :)
回答2:
My suggestion is to just template your new functions so you don't have to worry about matrix expressions or ublas internals. For example, if you wanted to write your own inverse function, write it as a template:
template<typename MATRIX_IN, typename MATRIX_OUT>
bool invert_matrix(const MATRIX& A, MATRIX_OUT& B)
{
// now use A(i,j), B(i,j), etc
...
}
回答3:
There are also some examples here, if they help at all.
来源:https://stackoverflow.com/questions/2079602/ublas-matrix-expression-tutorial-examples