-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoperators.jl
More file actions
55 lines (54 loc) · 1.23 KB
/
operators.jl
File metadata and controls
55 lines (54 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Store the mappings between JuMP's operator names and the functions supported by ExaModels
const _op_mappings = Dict{Symbol, Function}(
:+ => +,
:- => -,
:* => *,
:/ => /,
:^ => ^,
:inv => inv,
:sqrt => sqrt,
:cbrt => cbrt,
:abs => abs,
:abs2 => abs2,
:exp => exp,
:exp2 => exp2,
:log => log,
:log2 => log2,
:log10 => log10,
:log1p => log1p,
:sin => sin,
:cos => cos,
:tan => tan,
:asin => asin,
:acos => acos,
:csc => csc,
:sec => sec,
:cot => cot,
:atan => atan,
:acot => acot,
:sind => sind,
:cosd => cosd,
:tand => tand,
:cscd => cscd,
:secd => secd,
:cotd => cotd,
:atand => atand,
:acotd => acotd,
:sinh => sinh,
:cosh => cosh,
:tanh => tanh,
:csch => csc,
:sech => sech,
:coth => coth,
:atanh => atanh,
:acoth => acoth,
# TODO add the remaining JuMP operators
)
# Map a nonlinear function symbol to the underlying function
function _nl_op(s::Symbol)
if !haskey(_op_mappings, s)
error("`InfiniteExaModel`s does not support the nonlinear operator `$s`. ",
"If you need support for this operator, please open an issue.")
end
return _op_mappings[s]
end