From 9007fbc73c80c19e7f52ed595013af1781565378 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 17 Mar 2009 15:13:17 +0000 Subject: [PATCH] added math_tensorproduct --- trunk/math.f90 | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/trunk/math.f90 b/trunk/math.f90 index e2bd3e960..cb2777338 100644 --- a/trunk/math.f90 +++ b/trunk/math.f90 @@ -533,6 +533,25 @@ end subroutine END FUNCTION +!************************************************************************** +! tensor product a \otimes b +!************************************************************************** + PURE FUNCTION math_tensorproduct(A,B) + + use prec, only: pReal, pInt + implicit none + + real(pReal), dimension(3), intent(in) :: A,B + real(pReal), dimension(3,3) :: math_tensorproduct + integer(pInt) i,j + + forall (i=1:3,j=1:3) math_tensorproduct(i,j) = A(i)*B(j) + + return + + END FUNCTION + + !************************************************************************** ! matrix multiplication 3x3 = 1 !************************************************************************** @@ -923,8 +942,7 @@ end subroutine real(pReal), dimension(3,3) :: math_symmetric3x3,m integer(pInt) i,j - forall (i=1:3,j=1:3) math_symmetric3x3(i,j) = 1.0_pReal/2.0_pReal * & - (m(i,j) + m(j,i)) + forall (i=1:3,j=1:3) math_symmetric3x3(i,j) = 0.5_pReal * (m(i,j) + m(j,i)) END FUNCTION @@ -941,8 +959,7 @@ end subroutine real(pReal), dimension(6,6), intent(in) :: m real(pReal), dimension(6,6) :: math_symmetric6x6 - forall (i=1:6,j=1:6) math_symmetric6x6(i,j) = 1.0_pReal/2.0_pReal * & - (m(i,j) + m(j,i)) + forall (i=1:6,j=1:6) math_symmetric6x6(i,j) = 0.5_pReal * (m(i,j) + m(j,i)) END FUNCTION