Skip to content

cellml stuff added to handle Beeler-Reuter #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021
Merged

cellml stuff added to handle Beeler-Reuter #6

merged 1 commit into from
Mar 15, 2021

Conversation

shahriariravanian
Copy link
Contributor

No description provided.

Copy link
Contributor

@anandijain anandijain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! just a few changes

return parse_node(firstelement(node))
elseif nodename(node) == "piece"
c = parse_node.(elements(node))
return Symbolics.IfElse.ifelse(c[2] > 0.5, c[1], otherwise)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an IfElse dep, I think you can just have IfElse.ifelse(c[2] > 0.5, c[1], otherwise)

Comment on lines 125 to 144
# """
# parse_piecewise(node)

# parse a <piecewise> node
# parse a <piecewise> node
# want to recursively call ifelse on the pieces
# """
# function parse_piecewise(node)
# es = elements(node)
# IfElse.ifelse(a, b,
# IfElse.ifelse(c, d,
# IfElse.ifelse(a, b,
# IfElse.ifelse(c, d,
# IfElse.ifelse(e, f, otherwise)))
# end

# """
# parse_piece(node)

# parse a <piece> node
# parse a <piece> node
# Each <piece> element contains exactly two children.
# The conditional is the second child and the return is the first.
# """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you just delete all this?


"and" => x -> Base.:*(x...),
"or" => heaviside_or,
"xor" => x -> x[1]*(one(x[2])-x[2]) + (one(x[1])-x[1])*x[2],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine but there must be an easier way

@anandijain
Copy link
Contributor

oh actually could you add a piecewise test? ideally one with some nesting, i have a few in test/runtests.jl

@@ -180,45 +211,72 @@ function check_ivs(node)
all(y -> y.content == x[1].content, x)
end

# need to check the arities
H(x) = Symbolics.IfElse.ifelse(x > 0, one(x), zero(x))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IfElse here too

@anandijain anandijain mentioned this pull request Mar 15, 2021
anandijain added a commit that referenced this pull request Mar 15, 2021
@anandijain anandijain merged commit 45a8d7a into SciML:main Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants