From c063ce5bc1719f5c0fd26fc7093bcc24e86173d6 Mon Sep 17 00:00:00 2001 From: Denny Tjahjanto Date: Thu, 27 Mar 2008 11:54:34 +0000 Subject: [PATCH] add a kronecker delta function --- trunk/math.f90 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/trunk/math.f90 b/trunk/math.f90 index 7845fd904..e38162e46 100644 --- a/trunk/math.f90 +++ b/trunk/math.f90 @@ -188,7 +188,26 @@ if (((i == 1).and.(j == 3).and.(k == 2)) .or. & ((i == 2).and.(j == 1).and.(k == 3)) .or. & ((i == 3).and.(j == 2).and.(k == 1))) math_permut = -1.0_pReal - math_permut + return + + END FUNCTION + +!************************************************************************** +! kronecker delta function d_ij +! d_ij = 1 if i = j +! d_ij = 0 otherwise +!************************************************************************** + FUNCTION math_delta(i,j) + + use prec, only: pReal, pInt + implicit none + + integer(pInt) i,j + real(pReal) math_delta + + math_delta = 0.0_pReal + if (i == j) math_delta = 1.0_pReal + return END FUNCTION