## [Vxl-users] matrix vector multiplication

 [Vxl-users] matrix vector multiplication From: David Doria - 2010-09-27 15:35:53 Attachments: Message as HTML ```Hi all, I was wondering if I am interpreting correctly that VXL reshapes a vnl_vector to be a row or column vector depending on the situation? For example, with the following setup: vnl_matrix A(3,3); A.set_identity(); vnl_vector v(3); v(0) = 1; v(1) = 0; v(2) = 0; Both std::cout << A*v << std::endl; // 3x3 times 3x1 and std::cout << v*A << std::endl; // 3x1 times 3x3, so it seems to auto-adjust to make it a 1x3 times 3x3 Is there a way to force it to be one orientation or the other? I am trying to do x^T A x so should I just do x * A * x ? Thanks, David ```

 [Vxl-users] matrix vector multiplication From: David Doria - 2010-09-27 15:35:53 Attachments: Message as HTML ```Hi all, I was wondering if I am interpreting correctly that VXL reshapes a vnl_vector to be a row or column vector depending on the situation? For example, with the following setup: vnl_matrix A(3,3); A.set_identity(); vnl_vector v(3); v(0) = 1; v(1) = 0; v(2) = 0; Both std::cout << A*v << std::endl; // 3x3 times 3x1 and std::cout << v*A << std::endl; // 3x1 times 3x3, so it seems to auto-adjust to make it a 1x3 times 3x3 Is there a way to force it to be one orientation or the other? I am trying to do x^T A x so should I just do x * A * x ? Thanks, David ```
 Re: [Vxl-users] matrix vector multiplication From: Amitha Perera - 2010-09-27 15:43:43 ```On 09/27/2010 11:35 AM, David Doria wrote: > I was wondering if I am interpreting correctly that VXL reshapes a > vnl_vector to be a row or column vector depending on the situation? Correct. > Is there a way to force it to be one orientation or the other? Use a vnl_matrix with one of the dimensions = 1. > I am trying to do > > x^T A x > > so should I just do > > x * A * x ? Nearly. There is no operator* for two vectors (because of ambiguity: inner or outer product?), so you'd need to do dot_product( x, A*x ) or dot_product( x*A, x ) Amitha. ```