Skip to content

Commit

Permalink
Add AssertSymmetricIncreasing
Browse files Browse the repository at this point in the history
  • Loading branch information
barrywardell committed Mar 10, 2014
1 parent 4277cac commit 8df0c60
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Tools/CodeGen/xTensorKranc.m
Expand Up @@ -33,6 +33,8 @@
HasTensorAttribute::usage = "";
GetTensorAttribute::usage = "";
AntiSymmetrize;
AssertSymmetricDecreasing;
AssertSymmetricIncreasing;
CreateGroupFromTensor::usage = "CreateGroupFromTensor[T[a, b, ...]] Creates a variable group from the tensor T";
ReflectionSymmetries::usage = "ReflectionSymmetries[T[a, b, ...]] Produces a list of reflection symmetries of the tensor T.";
ExpandComponents::usage = "ExpandComponents[expr] converts an expression x containing abstract indices into one containing components instead."
Expand Down Expand Up @@ -157,6 +159,27 @@

AntiSymmetrize[expr_, a_, b_] := Antisymmetrize[expr, {a, b}];

(*************************************************************)
(* AssertSymmetricIncreasing / AssertSymmetricDecreasing *)
(*************************************************************)

AssertSymmetricIncreasing[t_?xTensorQ[inds__], syminds__] :=
Module[{ainds, asymInds, symSlots},
{ainds, asyminds} = {{inds}, {syminds}} /. {i_, (KrancBasis | -KrancBasis)} :> i;
symSlots = Position[ainds, #][[1, 1]] & /@ asyminds;
SymmetryGroupOfTensor[t] ^= Symmetric[symSlots, Cycles];

(* Define components which are related by symmetries *)
SetComponents[t[inds], ToCanonical[ComponentArray[t[inds]]]];
];

AssertSymmetricIncreasing[t_?xTensorQ[inds__]] :=
AssertSymmetricIncreasing[t[inds], inds];

AssertSymmetricDecreasing :=
ThrowError["AssertSymmetricDecreasing is no longer supported"];

(*************************************************************)
(* DefineParameter *)
(*************************************************************)

Expand Down

0 comments on commit 8df0c60

Please sign in to comment.