{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
module Language.Drasil.Expr.Class (
ExprC(..),
frac, recip_,
square, half,
oneHalf, oneThird,
apply1, apply2,
m2x2, vec2D, dgnl2x2, rowVec, columnVec
) where
import Prelude hiding (sqrt, log, sin, cos, tan, exp)
import Control.Lens ((^.))
import Language.Drasil.Symbol
import Language.Drasil.Expr.Lang
import Language.Drasil.Literal.Lang
import Language.Drasil.Space (DomainDesc(..), RTopology(..), RealInterval)
import qualified Language.Drasil.ModelExpr.Lang as M
import qualified Language.Drasil.CodeExpr.Lang as C
import Language.Drasil.Literal.Class (LiteralC(..))
import Language.Drasil.UID (HasUID(..))
import Utils.Drasil (toColumn)
frac :: (ExprC r, LiteralC r) => Integer -> Integer -> r
frac :: forall r. (ExprC r, LiteralC r) => Integer -> Integer -> r
frac Integer
n Integer
d = forall r. LiteralC r => Integer -> r
exactDbl Integer
n forall r. ExprC r => r -> r -> r
$/ forall r. LiteralC r => Integer -> r
exactDbl Integer
d
recip_ :: (ExprC r, LiteralC r) => r -> r
recip_ :: forall r. (ExprC r, LiteralC r) => r -> r
recip_ r
denom = forall r. LiteralC r => Integer -> r
exactDbl Integer
1 forall r. ExprC r => r -> r -> r
$/ r
denom
square :: (ExprC r, LiteralC r) => r -> r
square :: forall r. (ExprC r, LiteralC r) => r -> r
square r
x = r
x forall r. ExprC r => r -> r -> r
$^ forall r. LiteralC r => Integer -> r
exactDbl Integer
2
half :: (ExprC r, LiteralC r) => r -> r
half :: forall r. (ExprC r, LiteralC r) => r -> r
half r
x = r
x forall r. ExprC r => r -> r -> r
$/ forall r. LiteralC r => Integer -> r
exactDbl Integer
2
oneHalf :: (ExprC r, LiteralC r) => r
oneHalf :: forall r. (ExprC r, LiteralC r) => r
oneHalf = forall r. (ExprC r, LiteralC r) => Integer -> Integer -> r
frac Integer
1 Integer
2
oneThird :: (ExprC r, LiteralC r) => r
oneThird :: forall r. (ExprC r, LiteralC r) => r
oneThird = forall r. (ExprC r, LiteralC r) => Integer -> Integer -> r
frac Integer
1 Integer
3
apply1 :: (ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) => f -> a -> r
apply1 :: forall r f a.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a) =>
f -> a -> r
apply1 f
f a
a = forall r f. (ExprC r, HasUID f, HasSymbol f) => f -> [r] -> r
apply f
f [forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy a
a]
apply2 :: (ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b, HasSymbol b)
=> f -> a -> b -> r
apply2 :: forall r f a b.
(ExprC r, HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b,
HasSymbol b) =>
f -> a -> b -> r
apply2 f
f a
a b
b = forall r f. (ExprC r, HasUID f, HasSymbol f) => f -> [r] -> r
apply f
f [forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy a
a, forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy b
b]
m2x2 :: ExprC r => r -> r -> r -> r -> r
m2x2 :: forall r. ExprC r => r -> r -> r -> r -> r
m2x2 r
a r
b r
c r
d = forall r. ExprC r => [[r]] -> r
matrix [[r
a,r
b],[r
c,r
d]]
vec2D :: ExprC r => r -> r -> r
vec2D :: forall r. ExprC r => r -> r -> r
vec2D r
a r
b = forall r. ExprC r => [[r]] -> r
matrix [[r
a],[r
b]]
dgnl2x2 :: (ExprC r, LiteralC r) => r -> r -> r
dgnl2x2 :: forall r. (ExprC r, LiteralC r) => r -> r -> r
dgnl2x2 r
a = forall r. ExprC r => r -> r -> r -> r -> r
m2x2 r
a (forall r. LiteralC r => Integer -> r
int Integer
0) (forall r. LiteralC r => Integer -> r
int Integer
0)
rowVec :: ExprC r => [r] -> r
rowVec :: forall r. ExprC r => [r] -> r
rowVec [r]
a = forall r. ExprC r => [[r]] -> r
matrix [[r]
a]
columnVec :: ExprC r => [r] -> r
columnVec :: forall r. ExprC r => [r] -> r
columnVec [r]
a = forall r. ExprC r => [[r]] -> r
matrix forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [[a]]
toColumn [r]
a
class ExprC r where
infixr 8 $^
infixl 7 $/
infixr 4 $=
infixr 9 $&&
infixr 9 $||
lit :: Literal -> r
($=), ($!=) :: r -> r -> r
($<), ($>), ($<=), ($>=) :: r -> r -> r
($.) :: r -> r -> r
addI :: r -> r -> r
addRe :: r -> r -> r
mulI :: r -> r -> r
mulRe :: r -> r -> r
($-), ($/), ($^) :: r -> r -> r
($=>), ($<=>) :: r -> r -> r
($&&), ($||) :: r -> r -> r
abs_ :: r -> r
neg :: r -> r
log :: r -> r
ln :: r -> r
sqrt :: r -> r
sin :: r -> r
cos :: r -> r
tan :: r -> r
sec :: r -> r
csc :: r -> r
cot :: r -> r
arcsin :: r -> r
arccos :: r -> r
arctan :: r -> r
exp :: r -> r
dim :: r -> r
norm :: r -> r
negVec :: r -> r
not_ :: r -> r
idx :: r -> r -> r
defint, defsum, defprod :: Symbol -> r -> r -> r -> r
realInterval :: HasUID c => c -> RealInterval r r -> r
euclidean :: [r] -> r
cross :: r -> r -> r
vScale :: r -> r -> r
vAdd :: r -> r -> r
vSub :: r -> r -> r
completeCase :: [(r, r)] -> r
incompleteCase :: [(r, r)] -> r
matrix :: [[r]] -> r
apply :: (HasUID f, HasSymbol f) => f -> [r] -> r
sy :: (HasUID c, HasSymbol c) => c -> r
instance ExprC Expr where
lit :: Literal -> Expr
lit = Literal -> Expr
Lit
$= :: Expr -> Expr -> Expr
($=) = EqBinOp -> Expr -> Expr -> Expr
EqBinaryOp EqBinOp
Eq
$!= :: Expr -> Expr -> Expr
($!=) = EqBinOp -> Expr -> Expr -> Expr
EqBinaryOp EqBinOp
NEq
$< :: Expr -> Expr -> Expr
($<) = OrdBinOp -> Expr -> Expr -> Expr
OrdBinaryOp OrdBinOp
Lt
$> :: Expr -> Expr -> Expr
($>) = OrdBinOp -> Expr -> Expr -> Expr
OrdBinaryOp OrdBinOp
Gt
$<= :: Expr -> Expr -> Expr
($<=) = OrdBinOp -> Expr -> Expr -> Expr
OrdBinaryOp OrdBinOp
LEq
$>= :: Expr -> Expr -> Expr
($>=) = OrdBinOp -> Expr -> Expr -> Expr
OrdBinaryOp OrdBinOp
GEq
$. :: Expr -> Expr -> Expr
($.) = VVNBinOp -> Expr -> Expr -> Expr
VVNBinaryOp VVNBinOp
Dot
addI :: Expr -> Expr -> Expr
addI Expr
l (Lit (Int Integer
0)) = Expr
l
addI (Lit (Int Integer
0)) Expr
r = Expr
r
addI (AssocA AssocArithOper
AddI [Expr]
l) (AssocA AssocArithOper
AddI [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddI ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr]
r)
addI (AssocA AssocArithOper
AddI [Expr]
l) Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddI ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr
r])
addI Expr
l (AssocA AssocArithOper
AddI [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddI (Expr
l forall a. a -> [a] -> [a]
: [Expr]
r)
addI Expr
l Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddI [Expr
l, Expr
r]
addRe :: Expr -> Expr -> Expr
addRe Expr
l (Lit (Dbl Double
0))= Expr
l
addRe (Lit(Dbl Double
0)) Expr
r = Expr
r
addRe Expr
l (Lit (ExactDbl Integer
0)) = Expr
l
addRe (Lit (ExactDbl Integer
0)) Expr
r = Expr
r
addRe (AssocA AssocArithOper
AddRe [Expr]
l) (AssocA AssocArithOper
AddRe [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddRe ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr]
r)
addRe (AssocA AssocArithOper
AddRe [Expr]
l) Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddRe ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr
r])
addRe Expr
l (AssocA AssocArithOper
AddRe [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddRe (Expr
l forall a. a -> [a] -> [a]
: [Expr]
r)
addRe Expr
l Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
AddRe [Expr
l, Expr
r]
mulI :: Expr -> Expr -> Expr
mulI Expr
l (Lit (Int Integer
1)) = Expr
l
mulI (Lit (Int Integer
1)) Expr
r = Expr
r
mulI (AssocA AssocArithOper
MulI [Expr]
l) (AssocA AssocArithOper
MulI [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulI ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr]
r)
mulI (AssocA AssocArithOper
MulI [Expr]
l) Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulI ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr
r])
mulI Expr
l (AssocA AssocArithOper
MulI [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulI (Expr
l forall a. a -> [a] -> [a]
: [Expr]
r)
mulI Expr
l Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulI [Expr
l, Expr
r]
mulRe :: Expr -> Expr -> Expr
mulRe Expr
l (Lit (Dbl Double
1)) = Expr
l
mulRe (Lit (Dbl Double
1)) Expr
r = Expr
r
mulRe Expr
l (Lit (ExactDbl Integer
1)) = Expr
l
mulRe (Lit (ExactDbl Integer
1)) Expr
r = Expr
r
mulRe (AssocA AssocArithOper
MulRe [Expr]
l) (AssocA AssocArithOper
MulRe [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulRe ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr]
r)
mulRe (AssocA AssocArithOper
MulRe [Expr]
l) Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulRe ([Expr]
l forall a. [a] -> [a] -> [a]
++ [Expr
r])
mulRe Expr
l (AssocA AssocArithOper
MulRe [Expr]
r) = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulRe (Expr
l forall a. a -> [a] -> [a]
: [Expr]
r)
mulRe Expr
l Expr
r = AssocArithOper -> [Expr] -> Expr
AssocA AssocArithOper
MulRe [Expr
l, Expr
r]
$- :: Expr -> Expr -> Expr
($-) = ArithBinOp -> Expr -> Expr -> Expr
ArithBinaryOp ArithBinOp
Subt
$/ :: Expr -> Expr -> Expr
($/) = ArithBinOp -> Expr -> Expr -> Expr
ArithBinaryOp ArithBinOp
Frac
$^ :: Expr -> Expr -> Expr
($^) = ArithBinOp -> Expr -> Expr -> Expr
ArithBinaryOp ArithBinOp
Pow
$=> :: Expr -> Expr -> Expr
($=>) = BoolBinOp -> Expr -> Expr -> Expr
BoolBinaryOp BoolBinOp
Impl
$<=> :: Expr -> Expr -> Expr
($<=>) = BoolBinOp -> Expr -> Expr -> Expr
BoolBinaryOp BoolBinOp
Iff
Expr
a $&& :: Expr -> Expr -> Expr
$&& Expr
b = AssocBoolOper -> [Expr] -> Expr
AssocB AssocBoolOper
And [Expr
a, Expr
b]
Expr
a $|| :: Expr -> Expr -> Expr
$|| Expr
b = AssocBoolOper -> [Expr] -> Expr
AssocB AssocBoolOper
Or [Expr
a, Expr
b]
abs_ :: Expr -> Expr
abs_ = UFunc -> Expr -> Expr
UnaryOp UFunc
Abs
neg :: Expr -> Expr
neg = UFunc -> Expr -> Expr
UnaryOp UFunc
Neg
log :: Expr -> Expr
log = UFunc -> Expr -> Expr
UnaryOp UFunc
Log
ln :: Expr -> Expr
ln = UFunc -> Expr -> Expr
UnaryOp UFunc
Ln
sqrt :: Expr -> Expr
sqrt = UFunc -> Expr -> Expr
UnaryOp UFunc
Sqrt
sin :: Expr -> Expr
sin = UFunc -> Expr -> Expr
UnaryOp UFunc
Sin
cos :: Expr -> Expr
cos = UFunc -> Expr -> Expr
UnaryOp UFunc
Cos
tan :: Expr -> Expr
tan = UFunc -> Expr -> Expr
UnaryOp UFunc
Tan
sec :: Expr -> Expr
sec = UFunc -> Expr -> Expr
UnaryOp UFunc
Sec
csc :: Expr -> Expr
csc = UFunc -> Expr -> Expr
UnaryOp UFunc
Csc
cot :: Expr -> Expr
cot = UFunc -> Expr -> Expr
UnaryOp UFunc
Cot
arcsin :: Expr -> Expr
arcsin = UFunc -> Expr -> Expr
UnaryOp UFunc
Arcsin
arccos :: Expr -> Expr
arccos = UFunc -> Expr -> Expr
UnaryOp UFunc
Arccos
arctan :: Expr -> Expr
arctan = UFunc -> Expr -> Expr
UnaryOp UFunc
Arctan
exp :: Expr -> Expr
exp = UFunc -> Expr -> Expr
UnaryOp UFunc
Exp
dim :: Expr -> Expr
dim = UFuncVN -> Expr -> Expr
UnaryOpVN UFuncVN
Dim
norm :: Expr -> Expr
norm = UFuncVN -> Expr -> Expr
UnaryOpVN UFuncVN
Norm
negVec :: Expr -> Expr
negVec = UFuncVV -> Expr -> Expr
UnaryOpVV UFuncVV
NegV
vScale :: Expr -> Expr -> Expr
vScale = NVVBinOp -> Expr -> Expr -> Expr
NVVBinaryOp NVVBinOp
Scale
not_ :: Expr -> Expr
not_ = UFuncB -> Expr -> Expr
UnaryOpB UFuncB
Not
idx :: Expr -> Expr -> Expr
idx = LABinOp -> Expr -> Expr -> Expr
LABinaryOp LABinOp
Index
defint :: Symbol -> Expr -> Expr -> Expr -> Expr
defint Symbol
v Expr
low Expr
high = AssocArithOper -> DiscreteDomainDesc Expr Expr -> Expr -> Expr
Operator AssocArithOper
AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Continuous Expr
low Expr
high)
defsum :: Symbol -> Expr -> Expr -> Expr -> Expr
defsum Symbol
v Expr
low Expr
high = AssocArithOper -> DiscreteDomainDesc Expr Expr -> Expr -> Expr
Operator AssocArithOper
AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete Expr
low Expr
high)
defprod :: Symbol -> Expr -> Expr -> Expr -> Expr
defprod Symbol
v Expr
low Expr
high = AssocArithOper -> DiscreteDomainDesc Expr Expr -> Expr -> Expr
Operator AssocArithOper
MulRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete Expr
low Expr
high)
realInterval :: forall c. HasUID c => c -> RealInterval Expr Expr -> Expr
realInterval c
c = UID -> RealInterval Expr Expr -> Expr
RealI (c
c forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)
euclidean :: [Expr] -> Expr
euclidean = forall r. ExprC r => r -> r
sqrt forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 forall r. ExprC r => r -> r -> r
addRe forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall r. (ExprC r, LiteralC r) => r -> r
square
cross :: Expr -> Expr -> Expr
cross = VVVBinOp -> Expr -> Expr -> Expr
VVVBinaryOp VVVBinOp
Cross
vAdd :: Expr -> Expr -> Expr
vAdd = VVVBinOp -> Expr -> Expr -> Expr
VVVBinaryOp VVVBinOp
VAdd
vSub :: Expr -> Expr -> Expr
vSub = VVVBinOp -> Expr -> Expr -> Expr
VVVBinaryOp VVVBinOp
VSub
completeCase :: [(Expr, Expr)] -> Expr
completeCase = Completeness -> [(Expr, Expr)] -> Expr
Case Completeness
Complete
incompleteCase :: [(Expr, Expr)] -> Expr
incompleteCase = Completeness -> [(Expr, Expr)] -> Expr
Case Completeness
Incomplete
matrix :: [[Expr]] -> Expr
matrix = [[Expr]] -> Expr
Matrix
apply :: forall f. (HasUID f, HasSymbol f) => f -> [Expr] -> Expr
apply f
f [] = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy f
f
apply f
f [Expr]
ps = UID -> [Expr] -> Expr
FCall (f
f forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid) [Expr]
ps
sy :: forall c. (HasUID c, HasSymbol c) => c -> Expr
sy c
x = UID -> Expr
C (c
x forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)
instance ExprC M.ModelExpr where
lit :: Literal -> ModelExpr
lit = Literal -> ModelExpr
M.Lit
$= :: ModelExpr -> ModelExpr -> ModelExpr
($=) = EqBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.EqBinaryOp EqBinOp
M.Eq
$!= :: ModelExpr -> ModelExpr -> ModelExpr
($!=) = EqBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.EqBinaryOp EqBinOp
M.NEq
$< :: ModelExpr -> ModelExpr -> ModelExpr
($<) = OrdBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.OrdBinaryOp OrdBinOp
M.Lt
$> :: ModelExpr -> ModelExpr -> ModelExpr
($>) = OrdBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.OrdBinaryOp OrdBinOp
M.Gt
$<= :: ModelExpr -> ModelExpr -> ModelExpr
($<=) = OrdBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.OrdBinaryOp OrdBinOp
M.LEq
$>= :: ModelExpr -> ModelExpr -> ModelExpr
($>=) = OrdBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.OrdBinaryOp OrdBinOp
M.GEq
$. :: ModelExpr -> ModelExpr -> ModelExpr
($.) = VVNBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.VVNBinaryOp VVNBinOp
M.Dot
addI :: ModelExpr -> ModelExpr -> ModelExpr
addI ModelExpr
l (M.Lit (Int Integer
0)) = ModelExpr
l
addI (M.Lit (Int Integer
0)) ModelExpr
r = ModelExpr
r
addI (M.AssocA AssocArithOper
M.AddI [ModelExpr]
l) (M.AssocA AssocArithOper
M.AddI [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddI ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr]
r)
addI (M.AssocA AssocArithOper
M.AddI [ModelExpr]
l) ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddI ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr
r])
addI ModelExpr
l (M.AssocA AssocArithOper
M.AddI [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddI (ModelExpr
l forall a. a -> [a] -> [a]
: [ModelExpr]
r)
addI ModelExpr
l ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddI [ModelExpr
l, ModelExpr
r]
addRe :: ModelExpr -> ModelExpr -> ModelExpr
addRe ModelExpr
l (M.Lit (Dbl Double
0)) = ModelExpr
l
addRe (M.Lit (Dbl Double
0)) ModelExpr
r = ModelExpr
r
addRe ModelExpr
l (M.Lit (ExactDbl Integer
0)) = ModelExpr
l
addRe (M.Lit (ExactDbl Integer
0)) ModelExpr
r = ModelExpr
r
addRe (M.AssocA AssocArithOper
M.AddRe [ModelExpr]
l) (M.AssocA AssocArithOper
M.AddRe [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddRe ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr]
r)
addRe (M.AssocA AssocArithOper
M.AddRe [ModelExpr]
l) ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddRe ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr
r])
addRe ModelExpr
l (M.AssocA AssocArithOper
M.AddRe [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddRe (ModelExpr
l forall a. a -> [a] -> [a]
: [ModelExpr]
r)
addRe ModelExpr
l ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.AddRe [ModelExpr
l, ModelExpr
r]
mulI :: ModelExpr -> ModelExpr -> ModelExpr
mulI ModelExpr
l (M.Lit (Int Integer
1)) = ModelExpr
l
mulI (M.Lit (Int Integer
1)) ModelExpr
r = ModelExpr
r
mulI (M.AssocA AssocArithOper
M.MulI [ModelExpr]
l) (M.AssocA AssocArithOper
M.MulI [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulI ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr]
r)
mulI (M.AssocA AssocArithOper
M.MulI [ModelExpr]
l) ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulI ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr
r])
mulI ModelExpr
l (M.AssocA AssocArithOper
M.MulI [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulI (ModelExpr
l forall a. a -> [a] -> [a]
: [ModelExpr]
r)
mulI ModelExpr
l ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulI [ModelExpr
l, ModelExpr
r]
mulRe :: ModelExpr -> ModelExpr -> ModelExpr
mulRe ModelExpr
l (M.Lit (Dbl Double
1)) = ModelExpr
l
mulRe (M.Lit (Dbl Double
1)) ModelExpr
r = ModelExpr
r
mulRe ModelExpr
l (M.Lit (ExactDbl Integer
1)) = ModelExpr
l
mulRe (M.Lit (ExactDbl Integer
1)) ModelExpr
r = ModelExpr
r
mulRe (M.AssocA AssocArithOper
M.MulRe [ModelExpr]
l) (M.AssocA AssocArithOper
M.MulRe [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulRe ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr]
r)
mulRe (M.AssocA AssocArithOper
M.MulRe [ModelExpr]
l) ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulRe ([ModelExpr]
l forall a. [a] -> [a] -> [a]
++ [ModelExpr
r])
mulRe ModelExpr
l (M.AssocA AssocArithOper
M.MulRe [ModelExpr]
r) = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulRe (ModelExpr
l forall a. a -> [a] -> [a]
: [ModelExpr]
r)
mulRe ModelExpr
l ModelExpr
r = AssocArithOper -> [ModelExpr] -> ModelExpr
M.AssocA AssocArithOper
M.MulRe [ModelExpr
l, ModelExpr
r]
$- :: ModelExpr -> ModelExpr -> ModelExpr
($-) = ArithBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.ArithBinaryOp ArithBinOp
M.Subt
$/ :: ModelExpr -> ModelExpr -> ModelExpr
($/) = ArithBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.ArithBinaryOp ArithBinOp
M.Frac
$^ :: ModelExpr -> ModelExpr -> ModelExpr
($^) = ArithBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.ArithBinaryOp ArithBinOp
M.Pow
$=> :: ModelExpr -> ModelExpr -> ModelExpr
($=>) = BoolBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.BoolBinaryOp BoolBinOp
M.Impl
$<=> :: ModelExpr -> ModelExpr -> ModelExpr
($<=>) = BoolBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.BoolBinaryOp BoolBinOp
M.Iff
ModelExpr
a $&& :: ModelExpr -> ModelExpr -> ModelExpr
$&& ModelExpr
b = AssocBoolOper -> [ModelExpr] -> ModelExpr
M.AssocB AssocBoolOper
M.And [ModelExpr
a, ModelExpr
b]
ModelExpr
a $|| :: ModelExpr -> ModelExpr -> ModelExpr
$|| ModelExpr
b = AssocBoolOper -> [ModelExpr] -> ModelExpr
M.AssocB AssocBoolOper
M.Or [ModelExpr
a, ModelExpr
b]
abs_ :: ModelExpr -> ModelExpr
abs_ = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Abs
neg :: ModelExpr -> ModelExpr
neg = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Neg
log :: ModelExpr -> ModelExpr
log = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Log
ln :: ModelExpr -> ModelExpr
ln = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Ln
sqrt :: ModelExpr -> ModelExpr
sqrt = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Sqrt
sin :: ModelExpr -> ModelExpr
sin = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Sin
cos :: ModelExpr -> ModelExpr
cos = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Cos
tan :: ModelExpr -> ModelExpr
tan = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Tan
sec :: ModelExpr -> ModelExpr
sec = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Sec
csc :: ModelExpr -> ModelExpr
csc = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Csc
cot :: ModelExpr -> ModelExpr
cot = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Cot
arcsin :: ModelExpr -> ModelExpr
arcsin = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Arcsin
arccos :: ModelExpr -> ModelExpr
arccos = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Arccos
arctan :: ModelExpr -> ModelExpr
arctan = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Arctan
exp :: ModelExpr -> ModelExpr
exp = UFunc -> ModelExpr -> ModelExpr
M.UnaryOp UFunc
M.Exp
dim :: ModelExpr -> ModelExpr
dim = UFuncVN -> ModelExpr -> ModelExpr
M.UnaryOpVN UFuncVN
M.Dim
norm :: ModelExpr -> ModelExpr
norm = UFuncVN -> ModelExpr -> ModelExpr
M.UnaryOpVN UFuncVN
M.Norm
negVec :: ModelExpr -> ModelExpr
negVec = UFuncVV -> ModelExpr -> ModelExpr
M.UnaryOpVV UFuncVV
M.NegV
vScale :: ModelExpr -> ModelExpr -> ModelExpr
vScale = NVVBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.NVVBinaryOp NVVBinOp
M.Scale
not_ :: ModelExpr -> ModelExpr
not_ = UFuncB -> ModelExpr -> ModelExpr
M.UnaryOpB UFuncB
M.Not
idx :: ModelExpr -> ModelExpr -> ModelExpr
idx = LABinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.LABinaryOp LABinOp
M.Index
defint :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
defint Symbol
v ModelExpr
low ModelExpr
high = forall (t :: RTopology).
AssocArithOper
-> DomainDesc t ModelExpr ModelExpr -> ModelExpr -> ModelExpr
M.Operator AssocArithOper
M.AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Continuous ModelExpr
low ModelExpr
high)
defsum :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
defsum Symbol
v ModelExpr
low ModelExpr
high = forall (t :: RTopology).
AssocArithOper
-> DomainDesc t ModelExpr ModelExpr -> ModelExpr -> ModelExpr
M.Operator AssocArithOper
M.AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete ModelExpr
low ModelExpr
high)
defprod :: Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
defprod Symbol
v ModelExpr
low ModelExpr
high = forall (t :: RTopology).
AssocArithOper
-> DomainDesc t ModelExpr ModelExpr -> ModelExpr -> ModelExpr
M.Operator AssocArithOper
M.MulRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete ModelExpr
low ModelExpr
high)
realInterval :: forall c.
HasUID c =>
c -> RealInterval ModelExpr ModelExpr -> ModelExpr
realInterval c
c = UID -> RealInterval ModelExpr ModelExpr -> ModelExpr
M.RealI (c
c forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)
euclidean :: [ModelExpr] -> ModelExpr
euclidean = forall r. ExprC r => r -> r
sqrt forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 forall r. ExprC r => r -> r -> r
addRe forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall r. (ExprC r, LiteralC r) => r -> r
square
cross :: ModelExpr -> ModelExpr -> ModelExpr
cross = VVVBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.VVVBinaryOp VVVBinOp
M.Cross
vAdd :: ModelExpr -> ModelExpr -> ModelExpr
vAdd = VVVBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.VVVBinaryOp VVVBinOp
M.VAdd
vSub :: ModelExpr -> ModelExpr -> ModelExpr
vSub = VVVBinOp -> ModelExpr -> ModelExpr -> ModelExpr
M.VVVBinaryOp VVVBinOp
M.VSub
completeCase :: [(ModelExpr, ModelExpr)] -> ModelExpr
completeCase = Completeness -> [(ModelExpr, ModelExpr)] -> ModelExpr
M.Case Completeness
Complete
incompleteCase :: [(ModelExpr, ModelExpr)] -> ModelExpr
incompleteCase = Completeness -> [(ModelExpr, ModelExpr)] -> ModelExpr
M.Case Completeness
Incomplete
matrix :: [[ModelExpr]] -> ModelExpr
matrix = [[ModelExpr]] -> ModelExpr
M.Matrix
apply :: forall f. (HasUID f, HasSymbol f) => f -> [ModelExpr] -> ModelExpr
apply f
f [] = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy f
f
apply f
f [ModelExpr]
ps = UID -> [ModelExpr] -> ModelExpr
M.FCall (f
f forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid) [ModelExpr]
ps
sy :: forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
sy c
x = UID -> ModelExpr
M.C (c
x forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)
instance ExprC C.CodeExpr where
lit :: Literal -> CodeExpr
lit = Literal -> CodeExpr
C.Lit
$= :: CodeExpr -> CodeExpr -> CodeExpr
($=) = EqBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.EqBinaryOp EqBinOp
C.Eq
$!= :: CodeExpr -> CodeExpr -> CodeExpr
($!=) = EqBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.EqBinaryOp EqBinOp
C.NEq
$< :: CodeExpr -> CodeExpr -> CodeExpr
($<) = OrdBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.OrdBinaryOp OrdBinOp
C.Lt
$> :: CodeExpr -> CodeExpr -> CodeExpr
($>) = OrdBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.OrdBinaryOp OrdBinOp
C.Gt
$<= :: CodeExpr -> CodeExpr -> CodeExpr
($<=) = OrdBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.OrdBinaryOp OrdBinOp
C.LEq
$>= :: CodeExpr -> CodeExpr -> CodeExpr
($>=) = OrdBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.OrdBinaryOp OrdBinOp
C.GEq
$. :: CodeExpr -> CodeExpr -> CodeExpr
($.) = VVNBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.VVNBinaryOp VVNBinOp
C.Dot
addI :: CodeExpr -> CodeExpr -> CodeExpr
addI CodeExpr
l (C.Lit (Int Integer
0)) = CodeExpr
l
addI (C.Lit (Int Integer
0)) CodeExpr
r = CodeExpr
r
addI (C.AssocA AssocArithOper
C.AddI [CodeExpr]
l) (C.AssocA AssocArithOper
C.AddI [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddI ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr]
r)
addI (C.AssocA AssocArithOper
C.AddI [CodeExpr]
l) CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddI ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr
r])
addI CodeExpr
l (C.AssocA AssocArithOper
C.AddI [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddI (CodeExpr
l forall a. a -> [a] -> [a]
: [CodeExpr]
r)
addI CodeExpr
l CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddI [CodeExpr
l, CodeExpr
r]
addRe :: CodeExpr -> CodeExpr -> CodeExpr
addRe CodeExpr
l (C.Lit (Dbl Double
0))= CodeExpr
l
addRe (C.Lit(Dbl Double
0)) CodeExpr
r = CodeExpr
r
addRe CodeExpr
l (C.Lit (ExactDbl Integer
0)) = CodeExpr
l
addRe (C.Lit (ExactDbl Integer
0)) CodeExpr
r = CodeExpr
r
addRe (C.AssocA AssocArithOper
C.AddRe [CodeExpr]
l) (C.AssocA AssocArithOper
C.AddRe [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddRe ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr]
r)
addRe (C.AssocA AssocArithOper
C.AddRe [CodeExpr]
l) CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddRe ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr
r])
addRe CodeExpr
l (C.AssocA AssocArithOper
C.AddRe [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddRe (CodeExpr
l forall a. a -> [a] -> [a]
: [CodeExpr]
r)
addRe CodeExpr
l CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.AddRe [CodeExpr
l, CodeExpr
r]
mulI :: CodeExpr -> CodeExpr -> CodeExpr
mulI CodeExpr
l (C.Lit (Int Integer
1)) = CodeExpr
l
mulI (C.Lit (Int Integer
1)) CodeExpr
r = CodeExpr
r
mulI (C.AssocA AssocArithOper
C.MulI [CodeExpr]
l) (C.AssocA AssocArithOper
C.MulI [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulI ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr]
r)
mulI (C.AssocA AssocArithOper
C.MulI [CodeExpr]
l) CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulI ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr
r])
mulI CodeExpr
l (C.AssocA AssocArithOper
C.MulI [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulI (CodeExpr
l forall a. a -> [a] -> [a]
: [CodeExpr]
r)
mulI CodeExpr
l CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulI [CodeExpr
l, CodeExpr
r]
mulRe :: CodeExpr -> CodeExpr -> CodeExpr
mulRe CodeExpr
l (C.Lit (Dbl Double
1)) = CodeExpr
l
mulRe (C.Lit (Dbl Double
1)) CodeExpr
r = CodeExpr
r
mulRe CodeExpr
l (C.Lit (ExactDbl Integer
1)) = CodeExpr
l
mulRe (C.Lit (ExactDbl Integer
1)) CodeExpr
r = CodeExpr
r
mulRe (C.AssocA AssocArithOper
C.MulRe [CodeExpr]
l) (C.AssocA AssocArithOper
C.MulRe [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulRe ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr]
r)
mulRe (C.AssocA AssocArithOper
C.MulRe [CodeExpr]
l) CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulRe ([CodeExpr]
l forall a. [a] -> [a] -> [a]
++ [CodeExpr
r])
mulRe CodeExpr
l (C.AssocA AssocArithOper
C.MulRe [CodeExpr]
r) = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulRe (CodeExpr
l forall a. a -> [a] -> [a]
: [CodeExpr]
r)
mulRe CodeExpr
l CodeExpr
r = AssocArithOper -> [CodeExpr] -> CodeExpr
C.AssocA AssocArithOper
C.MulRe [CodeExpr
l, CodeExpr
r]
$- :: CodeExpr -> CodeExpr -> CodeExpr
($-) = ArithBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.ArithBinaryOp ArithBinOp
C.Subt
$/ :: CodeExpr -> CodeExpr -> CodeExpr
($/) = ArithBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.ArithBinaryOp ArithBinOp
C.Frac
$^ :: CodeExpr -> CodeExpr -> CodeExpr
($^) = ArithBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.ArithBinaryOp ArithBinOp
C.Pow
$=> :: CodeExpr -> CodeExpr -> CodeExpr
($=>) = BoolBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.BoolBinaryOp BoolBinOp
C.Impl
$<=> :: CodeExpr -> CodeExpr -> CodeExpr
($<=>) = BoolBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.BoolBinaryOp BoolBinOp
C.Iff
CodeExpr
a $&& :: CodeExpr -> CodeExpr -> CodeExpr
$&& CodeExpr
b = AssocBoolOper -> [CodeExpr] -> CodeExpr
C.AssocB AssocBoolOper
C.And [CodeExpr
a, CodeExpr
b]
CodeExpr
a $|| :: CodeExpr -> CodeExpr -> CodeExpr
$|| CodeExpr
b = AssocBoolOper -> [CodeExpr] -> CodeExpr
C.AssocB AssocBoolOper
C.Or [CodeExpr
a, CodeExpr
b]
abs_ :: CodeExpr -> CodeExpr
abs_ = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Abs
neg :: CodeExpr -> CodeExpr
neg = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Neg
log :: CodeExpr -> CodeExpr
log = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Log
ln :: CodeExpr -> CodeExpr
ln = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Ln
sqrt :: CodeExpr -> CodeExpr
sqrt = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Sqrt
sin :: CodeExpr -> CodeExpr
sin = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Sin
cos :: CodeExpr -> CodeExpr
cos = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Cos
tan :: CodeExpr -> CodeExpr
tan = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Tan
sec :: CodeExpr -> CodeExpr
sec = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Sec
csc :: CodeExpr -> CodeExpr
csc = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Csc
cot :: CodeExpr -> CodeExpr
cot = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Cot
arcsin :: CodeExpr -> CodeExpr
arcsin = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Arcsin
arccos :: CodeExpr -> CodeExpr
arccos = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Arccos
arctan :: CodeExpr -> CodeExpr
arctan = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Arctan
exp :: CodeExpr -> CodeExpr
exp = UFunc -> CodeExpr -> CodeExpr
C.UnaryOp UFunc
C.Exp
dim :: CodeExpr -> CodeExpr
dim = UFuncVN -> CodeExpr -> CodeExpr
C.UnaryOpVN UFuncVN
C.Dim
norm :: CodeExpr -> CodeExpr
norm = UFuncVN -> CodeExpr -> CodeExpr
C.UnaryOpVN UFuncVN
C.Norm
negVec :: CodeExpr -> CodeExpr
negVec = UFuncVV -> CodeExpr -> CodeExpr
C.UnaryOpVV UFuncVV
C.NegV
vScale :: CodeExpr -> CodeExpr -> CodeExpr
vScale = NVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.NVVBinaryOp NVVBinOp
C.Scale
not_ :: CodeExpr -> CodeExpr
not_ = UFuncB -> CodeExpr -> CodeExpr
C.UnaryOpB UFuncB
C.Not
idx :: CodeExpr -> CodeExpr -> CodeExpr
idx = LABinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.LABinaryOp LABinOp
C.Index
defint :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr
defint Symbol
v CodeExpr
low CodeExpr
high = AssocArithOper
-> DiscreteDomainDesc CodeExpr CodeExpr -> CodeExpr -> CodeExpr
C.Operator AssocArithOper
C.AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Continuous CodeExpr
low CodeExpr
high)
defsum :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr
defsum Symbol
v CodeExpr
low CodeExpr
high = AssocArithOper
-> DiscreteDomainDesc CodeExpr CodeExpr -> CodeExpr -> CodeExpr
C.Operator AssocArithOper
C.AddRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete CodeExpr
low CodeExpr
high)
defprod :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr
defprod Symbol
v CodeExpr
low CodeExpr
high = AssocArithOper
-> DiscreteDomainDesc CodeExpr CodeExpr -> CodeExpr -> CodeExpr
C.Operator AssocArithOper
C.MulRe (forall a b.
Symbol -> RTopology -> a -> b -> DomainDesc 'Discrete a b
BoundedDD Symbol
v RTopology
Discrete CodeExpr
low CodeExpr
high)
realInterval :: forall c.
HasUID c =>
c -> RealInterval CodeExpr CodeExpr -> CodeExpr
realInterval c
c = UID -> RealInterval CodeExpr CodeExpr -> CodeExpr
C.RealI (c
c forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)
euclidean :: [CodeExpr] -> CodeExpr
euclidean = forall r. ExprC r => r -> r
sqrt forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 forall r. ExprC r => r -> r -> r
addRe forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall r. (ExprC r, LiteralC r) => r -> r
square
cross :: CodeExpr -> CodeExpr -> CodeExpr
cross = VVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.VVVBinaryOp VVVBinOp
C.Cross
vAdd :: CodeExpr -> CodeExpr -> CodeExpr
vAdd = VVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.VVVBinaryOp VVVBinOp
C.VAdd
vSub :: CodeExpr -> CodeExpr -> CodeExpr
vSub = VVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr
C.VVVBinaryOp VVVBinOp
C.VSub
completeCase :: [(CodeExpr, CodeExpr)] -> CodeExpr
completeCase = Completeness -> [(CodeExpr, CodeExpr)] -> CodeExpr
C.Case Completeness
Complete
incompleteCase :: [(CodeExpr, CodeExpr)] -> CodeExpr
incompleteCase = Completeness -> [(CodeExpr, CodeExpr)] -> CodeExpr
C.Case Completeness
Incomplete
matrix :: [[CodeExpr]] -> CodeExpr
matrix = [[CodeExpr]] -> CodeExpr
C.Matrix
apply :: forall f. (HasUID f, HasSymbol f) => f -> [CodeExpr] -> CodeExpr
apply f
f [] = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy f
f
apply f
f [CodeExpr]
ps = UID -> [CodeExpr] -> [(UID, CodeExpr)] -> CodeExpr
C.FCall (f
f forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid) [CodeExpr]
ps []
sy :: forall c. (HasUID c, HasSymbol c) => c -> CodeExpr
sy c
x = UID -> CodeExpr
C.C (c
x forall s a. s -> Getting a s a -> a
^. forall c. HasUID c => Lens' c UID
uid)