From 79d6ce944d7b946633abddabebbe3a7cda33af17 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Mon, 6 Feb 2012 19:18:31 -0600 Subject: KrancScript.m: Handle numeric indices --- Tools/CodeGen/KrancScript.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Tools/CodeGen/KrancScript.m') diff --git a/Tools/CodeGen/KrancScript.m b/Tools/CodeGen/KrancScript.m index 0163aaa..e728f14 100644 --- a/Tools/CodeGen/KrancScript.m +++ b/Tools/CodeGen/KrancScript.m @@ -121,9 +121,11 @@ process["dtensor"["indices"["lower_index"["index_symbol"["t"]]],tensor_]] := dot[process[tensor]]; process["indices"[inds___]] := Map[process, {inds}]; -process["lower_index"[i_]] := TensorIndex[process[i], "l"]; -process["upper_index"[i_]] := TensorIndex[process[i], "u"]; -process["index_symbol"[s_]] := s; + +process[(pos:("lower_index"|"upper_index"))["index_symbol"[i_]]] := + If[StringMatchQ[i,DigitCharacter], + ToExpression[i], + TensorIndex[i, If[pos==="lower_index","l","u"]]]; process["func"["name"[name_],exprs__]] := Module[ -- cgit v1.2.3