[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freepooma-devel] A question about code for computation of Tensor de
From: |
Richard Guenther |
Subject: |
Re: [Freepooma-devel] A question about code for computation of Tensor determinant |
Date: |
Tue, 26 Jan 2010 22:38:11 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20091109) |
ali rostai wrote:
> Hi,
>
> In file "Tiny/TensorOperators.h" the following code has
> been used for computation of Tensor determinant.
> -------------------------------------------------
> // Partial specializations for D={1,2,3}
> template<class T, class E>
> inline T
> det(const Tensor<3,T,E>& t)
> {
> T result;
> result =
> t(0,0)*(t(1,1)*t(2,2) - t(1,2)*t(2,1)) +
> t(0,1)*(t(1,2)*t(2,0) - t(1,0)*t(2,2)) +
> t(0,2)*(t(1,0)*t(2,1) - t(1,1)*t(2,0));
> return result;
> }
> ---------------------------------------------------
> as I know the t(0,0) is a runtime call,
> why the member function template "getIJ()" has not been
> used? I mean a code like this
> t.getIJ<0,0>()
It is because TensorOperators.h (and other Tiny classes) do not fully
use expression templates. There is a patch on the patch-tracker
to fix this up for vectors (if I remember correctly) - the interaction
with the Array expression templates is complicated though.
It's an area that needs to be reworked a lot.
Richard.
> Regards
> Ali Roustaei
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Freepooma-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freepooma-devel