diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-17 15:04:46 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2002-04-17 15:04:46 +0000 |
commit | ad783baf35ad861a5c27926c37264350dc30940e (patch) | |
tree | 5ea25335bf3030490b83bb48a5f0b6a12e1c2d92 | |
parent | fe6abb59ed03b1daee38da469d1e837748e9a2e9 (diff) |
now do separate Diff() simplifications for ./maple/ and ./gr/,
with only the latter knowing about partial_d_g_dd gridfn defin
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@531 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r-- | src/gr/setup_gfas.maple | 39 | ||||
-rw-r--r-- | src/maple/Diff.maple | 28 |
2 files changed, 55 insertions, 12 deletions
diff --git a/src/gr/setup_gfas.maple b/src/gr/setup_gfas.maple index 5283d48..ede82ca 100644 --- a/src/gr/setup_gfas.maple +++ b/src/gr/setup_gfas.maple @@ -3,6 +3,7 @@ # # setup_gr_gfas - setup all the GR gfas +# `Diff/gridfn2` - Diff() simplification based on gridfn properties known here # ################################################################################ @@ -55,3 +56,41 @@ make_gfa('HD', {inert, fnd}, [], none); NULL; end proc; + + +################################################################################ + +# +# This function implements further simplification rules for Diff() +# based on gridfn properties which are known here but not in ../maple/. +# +# It currently knows about the following simplifications: +# - Diff(g_dd[i,j], x_xyz[k]) --> partial_d_g_dd[k,i,j] +# +# Anything else is returned unchanged. (To avoid infinite recursion, +# such a return is *unevaluated*.) +# +# Arguments: +# operand = (in) The thing to be differentiated. +# var_seq = (in) (varargs) An expression sequence of the variables to +# differentiate with respect to. +# +`Diff/gridfn` := +proc(operand) # varargs +option remember; # performance optimization +global + @include "../maple/coords.minc", + @include "../maple/gfa.minc", + @include "../gr/gr_gfas.minc"; +local var_list, posn; + +var_list := [args[2..nargs]]; + +if ( type(operand, indexed) and (op(0,operand) = 'g_dd') + and (nops(var_list) = 1) and member(var_list[1],x_xyz_list,'posn') ) + then return partial_d_g_dd[posn, op(operand)]; +end if; + +# unevaluated return to avoid infinite recursion +return 'Diff'(operand, op(var_list)); +end proc; diff --git a/src/maple/Diff.maple b/src/maple/Diff.maple index 3ffec13..820ac86 100644 --- a/src/maple/Diff.maple +++ b/src/maple/Diff.maple @@ -104,7 +104,8 @@ local var_list, f, g, x, x_car, x_cdr, temp, n, inner_operand, inner_var_list, k, - sorted_var_list; + sorted_var_list, + operand2, var_seq2; var_list := [args[2..nargs]]; @@ -218,23 +219,31 @@ if (type(operand, function) and (op(0, operand) = 'Diff')) ); end if; -# get to here -# ==> no other transformations to make -# ==> canonicalize ordering of variables and return reconstructed Diff() call +# canonicalize ordering of derivatives sorted_var_list := sort_var_list(var_list); -return `Diff/gridfn`(operand, op(sorted_var_list)); +# simplifications based on gridfn properties known here... +temp := `Diff/gridfn`(operand, op(sorted_var_list)); + +# more simplifications based on gridfn properties known in other directories +if ( type(`Diff/gridfn2`, procedure) + and type(temp, function) and (op(0,temp) = 'Diff') ) + then operand2 := op(1,temp); + var_seq2 := op(2..nops(temp), temp); + temp := `Diff/gridfn2`(operand2, var_seq2); +fi; + +return temp; end proc; ################################################################################ # # This function implements further simplification rules for Diff() -# based on gridfn properties. +# based on gridfn properties (or at least those known here). # # It currently knows about the following simplifications: # - Diff(X_ud[u,i], x_xyz[j]) --> X_udd[u,i,j] -# - Diff(g_dd[i,j], x_xyz[k]) --> partial_d_g_dd[k,i,j] # # Anything else is returned unchanged. (To avoid infinite recursion, # such a return is *unevaluated*.) @@ -260,11 +269,6 @@ if ( type(operand, indexed) and (op(0,operand) = 'X_ud') then return X_udd[op(operand), posn]; end if; -if ( type(operand, indexed) and (op(0,operand) = 'g_dd') - and (nops(var_list) = 1) and member(var_list[1],x_xyz_list,'posn') ) - then return partial_d_g_dd[op(operand), posn]; -end if; - # unevaluated return to avoid infinite recursion return 'Diff'(operand, op(var_list)); end proc; |