]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Rewrite inner product as an integral of a product.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Tue, 18 Sep 2012 18:53:53 +0000 (19:53 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Tue, 18 Sep 2012 18:53:53 +0000 (19:53 +0100)
src/Parser.hs
src/TopLevel.hs

index e5f920ef1a89c0ada2c5f525cdef06df25353090..12b233bb98cdbc4ccbeaa5c6d2bdb7fc041ea7e6 100644 (file)
@@ -95,7 +95,7 @@ parseInner = do
   e1 <- parseExpression
   _ <- lSymbol ","
   e2 <- parseExpression
-  return $ Inner e1 e2
+  return $ Integrate $ Multiply  e1 e2
   <?> "inner product"
  
 parseSum = do 
index 3b4fe20fa2099e9591ba17e5b0c24ac707491c49..81ad69e45901f43e8899dbf7f683b2511ecdfc87 100644 (file)
@@ -23,7 +23,7 @@ data Expression =
   ConstReal Double |
   ConstInteger Integer |
   Negate Expression | 
-  Inner Expression Expression | 
+  Integrate Expression | 
   Laplacian Expression | 
   Sum Expression String |
   Multiply Expression Expression |
@@ -135,7 +135,7 @@ promoteType IntegerType IntegerType = IntegerType
 getType :: OFL -> Expression -> BaseType
 getType _ (ConstReal _) = RealType
 getType _ (ConstInteger _) = IntegerType
-getType _ (Inner _ _) = RealType
+getType _ (Integrate _) = RealType
 getType _ (Laplacian _) = FunctionType 
 getType _ (PositionComponent _) = FunctionType
 getType ofl (IndexedIdentifier name _) = getValueType ofl name
@@ -213,11 +213,9 @@ validateExpression _ (ConstInteger _) = validationSuccess
 
 validateExpression ofl (Negate e) = validateExpression ofl e
 
-validateExpression ofl (Inner a b) = do
+validateExpression ofl (Integrate a) = do
   validateExpression ofl a
-  validateExpression ofl b
   isFunction ofl a
-  isFunction ofl b
 
 validateExpression ofl (Laplacian e) = do
   validateExpression ofl e