Skip to content

Commit

Permalink
TensorTools.m: Add ClearAllTensors
Browse files Browse the repository at this point in the history
This is a very heavy-handed way of achieving this.  We should change the way that tensors work at a more fundamental level, but this is enough for now.
  • Loading branch information
ianhinder committed Sep 9, 2013
1 parent c602337 commit aa0cbf9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Tools/CodeGen/TensorTools.m
Expand Up @@ -31,6 +31,8 @@
TensorTools tensor kernel.";
DefineDerivative::usage = "DefineDerivative[pd] registers a symbol to be used as a derivative operator.";

ClearAllTensors;

MakeExplicit::usage = "MakeExplicit[x] converts an expression x \
containing abstract indices into one containing components \
instead.";
Expand Down Expand Up @@ -1421,7 +1423,18 @@
IsTensor[k_] :=
ListQ[TensorAttributes[k]];

ClearAllTensors[] :=
(ClearAll[Tensor];
ClearAll[TensorCharacter];
ClearAll[TensorAttributes]);

UndefineTensor[Tensor[T,___]] :=
Module[
{},
T[is:((TensorIndex[_,_] | _Integer) ..)] =.;
(* TODO: undefine the symmetries somehow *)
TensorCharacter[T] =.;
TensorAttributes[T] =.];



Expand Down

0 comments on commit aa0cbf9

Please sign in to comment.