Skip to content

Commit

Permalink
Generalise IsScalar, IsMatrix, IsTensor functions to input parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Harries committed Dec 7, 2016
1 parent d81e520 commit 593f4aa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion meta/Parameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
GetOutputParameters[] := allOutputParameters;
GetPhases[] := allPhases;
GetExtraParameters[] := First /@ allExtraParameters;
GetExtraParametersAndType[] := allExtraParameters;
GetExtraParametersAndTypes[] := allExtraParameters;

additionalRealParameters = {};

Expand Down Expand Up @@ -255,12 +255,24 @@
IsScalar[sym_] :=
Length[SARAH`getDimParameters[sym]] === 1 || Length[SARAH`getDimParameters[sym]] == 0;

IsScalar[sym_?IsInputParameter] :=
MatchQ[GetType[sym], CConversion`ScalarType[_]];

IsScalar[sym_?IsExtraParameter] :=
MatchQ[GetType[sym], CConversion`ScalarType[_]];

IsMatrix[sym_[Susyno`LieGroups`i1, SARAH`i2]] :=
IsMatrix[sym];

IsMatrix[sym_] :=
Length[SARAH`getDimParameters[sym]] === 2;

IsMatrix[sym_?IsInputParameter] :=
MatchQ[GetType[sym], CConversion`MatrixType[__]];

IsMatrix[sym_?IsExtraParameter] :=
MatchQ[GetType[sym], CConversion`MatrixType[__]];

IsSymmetricMatrixParameter[sym_[Susyno`LieGroups`i1, SARAH`i2]] :=
IsSymmetricMatrixParameter[sym];

Expand All @@ -270,6 +282,12 @@
IsTensor[sym_[Susyno`LieGroups`i1, SARAH`i2, SARAH`i3]] :=
IsTensor[sym];

IsTensor[sym_?IsInputParameter] :=
MatchQ[GetType[sym], CConversion`TensorType[_]];

IsTensor[sym_?IsExtraParameter] :=
MatchQ[GetType[sym], CConversion`TensorType[_]];

IsTensor[sym_] :=
Length[SARAH`getDimParameters[sym]] > 2;

Expand Down Expand Up @@ -468,6 +486,9 @@
GetType[sym_?IsInputParameter] :=
Cases[GetInputParametersAndTypes[], {sym, _, type_} :> type][[1]];

GetType[sym_?IsExtraParameter] :=
Cases[GetExtraParametersAndTypes[], {sym, _, type_} :> type][[1]];

GetType[sym_] :=
GetTypeFromDimension[sym, SARAH`getDimParameters[sym]];

Expand Down

0 comments on commit 593f4aa

Please sign in to comment.