ublas matrix expression tutorial/examples

徘徊边缘 提交于 2020-01-01 04:12:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!