public ILanguageExpressionBasic Generate_Diff(ILanguageExpression expr1, ILanguageExpression expr2) { SetOperands(expr1, expr2); VerifyOperation_Diff(); return(BasicBinary.CreatePrimitive(_resultType, GMacOpInfo.BinaryDiff.OpName, _atomicOperand1, _atomicOperand2)); }
public ILanguageExpressionBasic Generate_BinaryEuclideanScalarProduct(GMacOpInfo opInfo, ILanguageExpression expr1, ILanguageExpression expr2) { SetOperands(expr1, expr2); VerifyOperation_ScalarProduct(); //The Euclidean products are metric-independent and the result is the same for orthogonal and non-orthogonal frames of the same dimension return (BasicBinary .CreatePrimitive(_resultType, opInfo.OpName, _atomicOperand1, _atomicOperand2)); }
public ILanguageExpressionBasic Generate_OrthogonalBinaryProduct(GMacOpInfo opInfo) { var operandsMvType = _atomicOperand1.ExpressionType as GMacFrameMultivector; if (!( opInfo.IsMetricIndependent == false && GMacCompilerOptions.ForceOrthogonalMetricProducts && ReferenceEquals(operandsMvType, null) == false && operandsMvType.ParentFrame.IsDerivedFrame && operandsMvType.ParentFrame.AssociatedSymbolicFrame.IsNonOrthogonal )) { return(BasicBinary.CreatePrimitive(_resultType, opInfo.OpName, _atomicOperand1, _atomicOperand2)); } var omv1 = Context.ActiveParentCommandBlock.NonOrthogonalToOrthogonalMultivector( operandsMvType.ParentFrame, _atomicOperand1 ); var omv2 = Context.ActiveParentCommandBlock.NonOrthogonalToOrthogonalMultivector( operandsMvType.ParentFrame, _atomicOperand2 ); var mv = Context.ActiveParentCommandBlock.ExpressionToAtomicExpression( BasicBinary.CreatePrimitive( operandsMvType.ParentFrame.BaseFrame.MultivectorType, opInfo.OpName, omv1, omv2 ) ); return (Context.ActiveParentCommandBlock.OrthogonalToNonOrthogonalMultivectorTransform( operandsMvType.ParentFrame, mv )); }
public ILanguageExpression Generate_OrthogonalScalarProduct(GMacOpInfo opInfo) { var operandsMvType = _atomicOperand1.ExpressionType as GMacFrameMultivector; if (!( opInfo.IsMetricIndependent == false && GMacCompilerOptions.ForceOrthogonalMetricProducts && ReferenceEquals(operandsMvType, null) == false && operandsMvType.ParentFrame.IsDerivedFrame && operandsMvType.ParentFrame.AssociatedSymbolicFrame.IsNonOrthogonal )) { return(BasicBinary.CreatePrimitive(_resultType, opInfo.OpName, _atomicOperand1, _atomicOperand2)); } var omv1 = Context.ActiveParentCommandBlock.NonOrthogonalToOrthogonalMultivector( operandsMvType.ParentFrame, _atomicOperand1 ); var omv2 = Context.ActiveParentCommandBlock.NonOrthogonalToOrthogonalMultivector( operandsMvType.ParentFrame, _atomicOperand2 ); //There is no need to apply the base-to-derived outermorphsm because the scalar product always gives a scalar // and the outer morphism of any scalar is itself return (Context.ActiveParentCommandBlock.ExpressionToAtomicExpression( BasicBinary.CreatePrimitive( ScalarType, opInfo.OpName, omv1, omv2 ) )); }