Skip to content

Commit

Permalink
Real 0.0 to Int 0 and dune promote
Browse files Browse the repository at this point in the history
  • Loading branch information
rok-cesnovar committed Apr 19, 2020
1 parent 71983b8 commit 034a7dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/frontend/Ast_to_Mir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ let constraint_forl = function
let extract_transform_args = function
| Program.Lower a | Upper a -> [a]
| Offset a -> [a; {a with Expr.Fixed.pattern= Lit (Int, "1")}]
| Multiplier a -> [{a with pattern= Lit (Real, "0.0")}; a]
| Multiplier a -> [{a with pattern= Lit (Int, "0")}; a]
| LowerUpper (a1, a2) | OffsetMultiplier (a1, a2) -> [a1; a2]
| Covariance | Correlation | CholeskyCov | CholeskyCorr | Ordered
|PositiveOrdered | Simplex | UnitVector | Identity ->
Expand Down
8 changes: 4 additions & 4 deletions test/integration/good/code-gen/cpp.expected
Original file line number Diff line number Diff line change
Expand Up @@ -4325,14 +4325,14 @@ class mother_model : public model_base_crtp<mother_model> {
assign(no_offset_multiplier,
cons_list(index_uni(sym1__), nil_index_list()),
stan::math::offset_multiplier_constrain(
no_offset_multiplier[(sym1__ - 1)], 0.0, 2, lp__),
no_offset_multiplier[(sym1__ - 1)], 0, 2, lp__),
"assigning variable no_offset_multiplier");
} else {
current_statement__ = 3;
assign(no_offset_multiplier,
cons_list(index_uni(sym1__), nil_index_list()),
stan::math::offset_multiplier_constrain(
no_offset_multiplier[(sym1__ - 1)], 0.0, 2),
no_offset_multiplier[(sym1__ - 1)], 0, 2),
"assigning variable no_offset_multiplier");
}}
current_statement__ = 4;
Expand Down Expand Up @@ -5430,7 +5430,7 @@ class mother_model : public model_base_crtp<mother_model> {
assign(no_offset_multiplier,
cons_list(index_uni(sym1__), nil_index_list()),
stan::math::offset_multiplier_constrain(
no_offset_multiplier[(sym1__ - 1)], 0.0, 2),
no_offset_multiplier[(sym1__ - 1)], 0, 2),
"assigning variable no_offset_multiplier");}
current_statement__ = 4;
validate_non_negative_index("offset_no_multiplier", "5", 5);
Expand Down Expand Up @@ -7288,7 +7288,7 @@ class mother_model : public model_base_crtp<mother_model> {
assign(no_offset_multiplier,
cons_list(index_uni(sym1__), nil_index_list()),
stan::math::offset_multiplier_free(
no_offset_multiplier[(sym1__ - 1)], 0.0, 2),
no_offset_multiplier[(sym1__ - 1)], 0, 2),
"assigning variable no_offset_multiplier");}
current_statement__ = 4;
validate_non_negative_index("offset_no_multiplier", "5", 5);
Expand Down
6 changes: 3 additions & 3 deletions test/integration/good/code-gen/mir.expected
Original file line number Diff line number Diff line change
Expand Up @@ -4097,7 +4097,7 @@
((type_ UReal) (loc <opaque>) (adlevel AutoDiffable))))
((pattern (Lit Str offset_multiplier))
(meta ((type_ UReal) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Real 0.0))
((pattern (Lit Int 0))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Int 2))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly)))))))
Expand Down Expand Up @@ -6702,7 +6702,7 @@
(meta ((type_ UReal) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Str offset_multiplier))
(meta ((type_ UReal) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Real 0.0))
((pattern (Lit Int 0))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Int 2))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly)))))))
Expand Down Expand Up @@ -9700,7 +9700,7 @@
(meta ((type_ UReal) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Str offset_multiplier))
(meta ((type_ UReal) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Real 0.0))
((pattern (Lit Int 0))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly))))
((pattern (Lit Int 2))
(meta ((type_ UInt) (loc <opaque>) (adlevel DataOnly)))))))
Expand Down

0 comments on commit 034a7dd

Please sign in to comment.