On Sun, Jan  5, 2020, at 07:15 CST, "A.Z Ihsan" <jurnalaz...@gmail.com> wrote:

> Tensor<1, 3> b();

If you write this then you declare a function "b" returning a
Tensor<1,3>. Declare the tensor without the parentheses:

  Tensor<1, 3> b;

You can access individual elements of the tensor via operator[]:

  b[0] = 1;
  b[1] = 1;
  b[2] = 0;

And you can do meaningful mathematical tensor operations. Including,
scaling a tensor

  auto a = 5. * b;

Adding two tensors together:

  auto c = a + b;

Taking the inner product:

  auto k = a * b;

etc.

Best,
Matthias

-- 
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/87eewe2cf4.fsf%4043-1.org.

Reply via email to