Replies: 1 comment
-
Hi @gear-head, That is true, you need an extra dummy index Note that you can use the placeholder tensor A{2,2};
tensor b{2,1};
tensor C = A(_i,_j)*b(_j,_); or you could use the ublas' tensor C = ublas::prod( A, b, 2 ) ; See also: https://godbolt.org/z/9Yd7fqj73 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I am currently trying to use the Tensor class to compute tensor expressions similar to NumPy's einsum function. I get this to work with second and higher order tensors, however, a simple matrix vector multiplication I only got to work using the code shown below:
`
#include <boost/numeric/ublas/tensor.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include
int main() {
}
`
I find this notation quite cumbersome. I would expect a proper matrix vector multiplication to be expressed as A_ij b_j = C_i, however, the code only works if I add the dummy index _k. Am I missing something here?
Thanks for any suggestions in advance!
Regards
Beta Was this translation helpful? Give feedback.
All reactions