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

edited warnings #144

Merged
merged 2 commits into from
Sep 29, 2016
Merged

edited warnings #144

merged 2 commits into from
Sep 29, 2016

Conversation

jstac
Copy link
Contributor

@jstac jstac commented Sep 29, 2016

Example:

julia> f(x) = 0.5 * x
WARNING: Method definition f(Any) in module Main at REPL[14]:1 overwritten at REPL[22]:1.
f (generic function with 1 method)

julia> compute_fixed_point(f, 1.0, verbose=0)
6.103515625e-5

julia> compute_fixed_point(f, 1.0, verbose=1)
6.103515625e-5

julia> compute_fixed_point(f, 1.0, verbose=2)
Compute iterate 10 with error 0.0009765625
Converged in 14 steps
6.103515625e-5

julia> compute_fixed_point(f, 1.0, verbose=1, max_iter=5)
WARNING: max_iter attained in compute_fixed_point
0.03125

julia> compute_fixed_point(f, 1.0, verbose=0, max_iter=5)
0.03125

julia> compute_fixed_point(f, 1.0, verbose=10)
ERROR: ArgumentError: verbose should be 0, 1 or 2
 in #compute_fixed_point#3(::Float64, ::Int64, ::Int64, ::Int64, ::Function, ::#f, ::Float64) at /home/john/sync_dir/quantecon/QuantEcon.jl/src/compute_fp.jl:59
 in (::#kw##compute_fixed_point)(::Array{Any,1}, ::#compute_fixed_point, ::Function, ::Float64) at ./<missing>:0

@jstac jstac mentioned this pull request Sep 29, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 92.876% when pulling bfeca1e on computefp_warn into 99f90e6 on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 92.876% when pulling bfeca1e on computefp_warn into 99f90e6 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 92.876% when pulling bfeca1e on computefp_warn into 99f90e6 on master.

@codecov-io
Copy link

codecov-io commented Sep 29, 2016

Current coverage is 93.12% (diff: 62.50%)

Merging #144 into master will decrease coverage by 0.24%

@@             master       #144   diff @@
==========================================
  Files            19         19          
  Lines          1146       1149     +3   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           1070       1070          
- Misses           76         79     +3   
  Partials          0          0          

Powered by Codecov. Last update 99f90e6...2cc4211

elseif iterate == max_iter
warn("max_iter attained in compute_fixed_point")
end
end
Copy link
Member

Choose a reason for hiding this comment

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

What about this?

if verbose >= 1
    if iterate == max_iter
        warn("max_iter attained in compute_fixed_point")
    elseif verbose == 2
        println("Converged in $iterate steps")
    end
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that's much better ;-)

I'll make the change.

@coveralls
Copy link

coveralls commented Sep 29, 2016

Coverage Status

Coverage decreased (-0.2%) to 93.124% when pulling 2cc4211 on computefp_warn into 99f90e6 on master.

@sglyon sglyon merged commit 9fdf95f into master Sep 29, 2016
@sglyon sglyon deleted the computefp_warn branch November 7, 2016 13:55
oyamad added a commit to QuantEcon/QuantEcon.py that referenced this pull request Nov 9, 2016
oyamad added a commit to QuantEcon/QuantEcon.py that referenced this pull request Nov 14, 2016
oyamad added a commit to QuantEcon/QuantEcon.py that referenced this pull request Nov 14, 2016
oyamad added a commit to QuantEcon/QuantEcon.py that referenced this pull request Nov 14, 2016
oyamad added a commit to QuantEcon/QuantEcon.py that referenced this pull request Nov 15, 2016
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.

5 participants