On 10/6/20 5:50 PM, Nikki Holtzer wrote:

I am trying to form a cross product/ outer product of two vectors of type deallii:Vector<double>. I have attempted to use some of the built in functions for the outer product from the Tensor Class but have had no luck. I can't seem to get anything other than

error: no matching function for call to 'outer_product(vec1, vec2);'

I have tried recasting my vec1/vec2 as Tensors but have run into a similar error message.

Is there a built in vector cross product? Alternatively, how could I recast my vectors and then use the built in functions from the Tensor Class and finally recast them back into vectors?

The easy way is to do

  const unsigned int n = vec.size();
  FullMatrix<double> o_p (n,n);
  for (unsigned int i=0; i<n; ++i)
    for (unsigned int j=0; j<n; ++j)
      o_p(i,j) = vec[i] * vec[j];

But the issue is that generally you end up with a full matrix this way. Is that what you want? How large are your vectors?

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/018e32de-2da7-226e-9d9a-838119fa6271%40colostate.edu.

Reply via email to