Skip to content
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

Add convention for (numeric) type annotations in function signatures #31

Open
mforets opened this issue Nov 18, 2020 · 0 comments
Open

Comments

@mforets
Copy link
Member

mforets commented Nov 18, 2020

ref: JuliaReach/LazySets.jl#2276


Draft:

  1. function vertices_list(H::AbstractHyperrectangle{N}) where {N<:Real} . here N is not used in the body of the function => we can remove it from the signature

  2. function constraints_list(H::AbstractHyperrectangle{N}) where {N<:Real} here N is used to preallocate outputs, constraints = Vector{LinearConstraint{N, SingleEntryVector{N}}}(undef, 2*n) so we keep where {N}

  3. binary operations.... 3i) do nothing if N is not used in the body of the function; remove the type parameter N in both arguments
    ... 3ii) use promote_type(N, M) if it's used in the function

  4. inner functions where we already know that the arguments are of the same numeric type. for example, _abs_sum , since rho already makes the conversion.

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

No branches or pull requests

1 participant