Beispiel #1
0
        protected G25.SMV m_smv2 = null; ///< if function over SMV, type goes here

        #endregion Fields

        #region Methods

        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            //String type F.GetArgumentTypeName(0, S.m_GMV.Name);
            return ((F.Name == "equals") && (F.MatchNbArguments(NB_ARGS)) &&
                G25.CG.Shared.Functions.NotMixSmvGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
                G25.CG.Shared.Functions.NotUseOm(S, F, NB_ARGS, S.m_GMV.Name));
        }
Beispiel #2
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return (((F.Name == "hp") || (F.Name == "ihp")) && (F.MatchNbArguments(NB_ARGS)) &&
         G25.CG.Shared.Functions.NotMixScalarGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotMixSmvGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotUseOm(S, F, NB_ARGS, S.m_GMV.Name));
 }
Beispiel #3
0
        protected RefGA.Multivector m_returnValue; ///< returned value (symbolic multivector)

        #endregion Fields

        #region Methods

        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            String arg1Type = F.GetArgumentTypeName(0, S.m_GMV.Name);
            return ((F.Name == "sas") && (F.MatchNbArguments(3) &&
                (S.IsSpecializedMultivectorName(arg1Type) || (arg1Type == S.m_GMV.Name)) &&
                S.IsFloatType(F.GetArgumentTypeName(1, S.m_GMV.Name)) &&
                S.IsFloatType(F.GetArgumentTypeName(2, S.m_GMV.Name))));
        }
Beispiel #4
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented.</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     int NB_ARGS = 2;
     return ((IsAdd(F) || IsSubtract(F)) && (F.MatchNbArguments(NB_ARGS)) &&
         G25.CG.Shared.Functions.NotMixSmvGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotMixScalarGmv(S, F, NB_ARGS, S.m_GMV.Name) &&
         G25.CG.Shared.Functions.NotUseOm(S, F, NB_ARGS, S.m_GMV.Name));
 }
Beispiel #5
0
        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            if (!((F.Name == "log") && (F.MatchNbArguments(1)))) return false;

            string type = F.GetOption("type");
            if (type == null) return false;

            return type.ToLower().Equals("euclidean");
        }
Beispiel #6
0
        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented.</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            int NB_ARGS = 2;
            // do a basic check first:
            bool OK1 = ((F.Name == "applyOM") &&
                (F.MatchNbArguments(NB_ARGS)) &&
                G25.CG.Shared.Functions.IsOm(S, F, 0) && // argument 0 must be an outermorphism
                G25.CG.Shared.Functions.IsMv(S, F, 1)); // argument 1 must be an multivector
            if (!OK1) return false;

            // specialized outermorphisms can only be applied to specialized multivectors
            if (G25.CG.Shared.Functions.IsSom(S, F, 0) &&
                (!G25.CG.Shared.Functions.IsSmv(S, F, 1))) return false;

            return true;
        }
Beispiel #7
0
        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            if (F.Name.Length < G25.CG.Shared.CANSparts.EXTRACT_GRADE.Length) return false;

            try
            {
                int gradeIdx = GetGradeIdx(F.Name);
                return (F.Name.StartsWith(G25.CG.Shared.CANSparts.EXTRACT_GRADE) && F.MatchNbArguments(1) &&  // get the name & number of arguments right
                    (((gradeIdx >= 0) && (gradeIdx <= S.m_dimension)) || // either specify the grade index
                    ((gradeIdx < 0) && (F.GetArgumentTypeName(0, S.m_GMV.Name) == S.m_GMV.Name)))); // or be a function over general multivectors and leave out the grade
            }
            catch (Exception)
            {
                // we arrive there when F.Name is gradeX where X is not a number.
                return false;
            }
        }
Beispiel #8
0
 /// <returns>true when input to function is coordinates.</returns>
 public bool IsCoordBased(Specification S, G25.fgs F, FloatType FT)
 {
     return F.MatchNbArguments(S.m_dimension - 2) &&
         S.IsFloatType(F.GetArgumentTypeName(0, FT.type)) &&
         (!IsRandom(S, F));
 }
Beispiel #9
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     string arg1Type = F.GetArgumentTypeName(0, S.m_GMV.Name);
     return ((IsIncrement(F) || IsDecrement(F)) && (F.MatchNbArguments(1) &&
         (S.IsSpecializedMultivectorName(arg1Type) || (arg1Type == S.m_GMV.Name))));
 }
Beispiel #10
0
        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            if (!(IsApplyVersor(F) || IsApplyVersorWI(F) || IsApplyUnitVersor(F))) return false;

            int nbArgs = GetNbArgs(F);

            // don't allow mixing of GMV/SMV or Scalar/SMV
            if (!G25.CG.Shared.Functions.NotMixSmvGmv(S, F, nbArgs, S.m_GMV.Name)) return false;
            if (!G25.CG.Shared.Functions.NotMixScalarGmv(S, F, nbArgs, S.m_GMV.Name)) return false;

            return (((IsApplyVersor(F) || IsApplyUnitVersor(F)) && F.MatchNbArguments(2)) ||
                (IsApplyVersorWI(F) && F.MatchNbArguments(3)));
        }
Beispiel #11
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((IsReverse(F) || IsNegate(F) || IsCliffordConjugate(F) || IsGradeInvolution(F)) &&
         (F.MatchNbArguments(1)));
 }
Beispiel #12
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((F.Name == "op") && (F.MatchNbArguments(2)));
 }
Beispiel #13
0
        protected G25.SMV m_smv = null; ///< if function over SMV, type goes here

        #endregion Fields

        #region Methods

        /// <summary>
        /// Checks if this FunctionGenerator can implement a certain function.
        /// </summary>
        /// <param name="S">The specification of the algebra.</param>
        /// <param name="F">The function to be implemented.</param>
        /// <returns>true if 'F' can be implemented</returns>
        public override bool CanImplement(Specification S, G25.fgs F)
        {
            return ((F.Name == "versorInverse") && F.MatchNbArguments(1));
        }
Beispiel #14
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented.</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return (IsGradeBitmap(F) && (F.MatchNbArguments(2)));
 }
Beispiel #15
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((IsExp(F) || IsCos(F) || IsSin(F) || IsCosh(F) || IsSinh(F)) && (F.MatchNbArguments(1)));
 }
Beispiel #16
0
 /// <returns>true when input to function is coordinates.</returns>
 public bool IsRandom(Specification S, G25.fgs F)
 {
     return (F.Name == "randomCgaPoint") && F.MatchNbArguments(0);
 }
Beispiel #17
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented.</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return IsRandom(S, F) ||
         (((F.Name == "cgaPoint") && (F.MatchNbArguments(1) || F.MatchNbArguments(S.m_dimension - 2))));
 }
Beispiel #18
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((IsHip(F) || IsMHip(F) || IsLc(F) || IsRc(F) || IsSp(F)) &&
         (F.MatchNbArguments(2)));
 }
Beispiel #19
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((IsNorm(F) || IsNorm2(F)) && (F.MatchNbArguments(1)));
 }
Beispiel #20
0
 /// <summary>
 /// Checks if this FunctionGenerator can implement a certain function.
 /// </summary>
 /// <param name="S">The specification of the algebra.</param>
 /// <param name="F">The function to be implemented.</param>
 /// <returns>true if 'F' can be implemented</returns>
 public override bool CanImplement(Specification S, G25.fgs F)
 {
     return ((F.Name == "div") && (F.MatchNbArguments(2) &&
         S.IsFloatType(F.ArgumentTypeNames[1])));
 }