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

Feature/issue 2778 add add diag #2779

Merged
merged 3 commits into from
Jul 29, 2019
Merged

Conversation

drezap
Copy link

@drezap drezap commented Jul 2, 2019

Submission Checklist

  • Run unit tests: ./runTests.py src/test/unit
  • Run cpplint: make cpplint
  • Declare copyright holder and open-source license: see below

Summary

Add the add_diag function to the language.

Intended Effect

Less for loops.

How to Verify

make stan/src/test/test-models/good/function-signatures/math/matrix/add_diag
with command stan.

Side Effects

None.

Documentation

I'll open up an issue to add to docs when this is merged.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Copyright 2019 Andre Zapico

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

@drezap drezap mentioned this pull request Jul 23, 2019
@charlesm93 charlesm93 self-assigned this Jul 23, 2019
@stan-buildbot
Copy link
Contributor

(stat_comp_benchmarks/benchmarks/gp_pois_regr/gp_pois_regr.stan, 1.01)
(stat_comp_benchmarks/benchmarks/low_dim_corr_gauss/low_dim_corr_gauss.stan, 0.94)
(stat_comp_benchmarks/benchmarks/irt_2pl/irt_2pl.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/one_comp_mm_elim_abs.stan, 0.96)
(stat_comp_benchmarks/benchmarks/eight_schools/eight_schools.stan, 1.06)
(stat_comp_benchmarks/benchmarks/gp_regr/gp_regr.stan, 1.0)
(stat_comp_benchmarks/benchmarks/arK/arK.stan, 1.0)
(performance.compilation, 1.03)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan, 1.01)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix/low_dim_gauss_mix.stan, 1.01)
(stat_comp_benchmarks/benchmarks/sir/sir.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/sim_one_comp_mm_elim_abs.stan, 1.02)
(stat_comp_benchmarks/benchmarks/garch/garch.stan, 1.04)
(stat_comp_benchmarks/benchmarks/gp_regr/gen_gp_data.stan, 1.01)
(stat_comp_benchmarks/benchmarks/arma/arma.stan, 0.98)
Result: 1.00406145551
Commit hash: 2f76d60

Copy link
Contributor

@bob-carpenter bob-carpenter left a comment

Choose a reason for hiding this comment

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

Thanks. The only thing this needs is a few more instantiations in the tests. The reason we require that is we want to make sure the math lib is doing the right thing in terms of being able to compile all possible signatures the language will throw at it. Parameters provide var and data provide double.

vector[N] vec;
int scalar;
}
transformed data {
Copy link
Contributor

Choose a reason for hiding this comment

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

This file should have tests for all possible combinations of parameter and data for all possible signatures. That's a total of 3 signatures * 4 instantiations each (data/data, data/parameter, parameter/data, parameter/parameter).

@stan-buildbot
Copy link
Contributor

(stat_comp_benchmarks/benchmarks/gp_pois_regr/gp_pois_regr.stan, 1.0)
(stat_comp_benchmarks/benchmarks/low_dim_corr_gauss/low_dim_corr_gauss.stan, 0.98)
(stat_comp_benchmarks/benchmarks/irt_2pl/irt_2pl.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/one_comp_mm_elim_abs.stan, 0.97)
(stat_comp_benchmarks/benchmarks/eight_schools/eight_schools.stan, 0.97)
(stat_comp_benchmarks/benchmarks/gp_regr/gp_regr.stan, 1.0)
(stat_comp_benchmarks/benchmarks/arK/arK.stan, 1.25)
(performance.compilation, 1.03)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan, 1.05)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix/low_dim_gauss_mix.stan, 0.99)
(stat_comp_benchmarks/benchmarks/sir/sir.stan, 0.99)
(stat_comp_benchmarks/benchmarks/pkpd/sim_one_comp_mm_elim_abs.stan, 0.98)
(stat_comp_benchmarks/benchmarks/garch/garch.stan, 1.11)
(stat_comp_benchmarks/benchmarks/gp_regr/gen_gp_data.stan, 0.99)
(stat_comp_benchmarks/benchmarks/arma/arma.stan, 0.85)
Result: 1.01087269323
Commit hash: 5b0d90d

@bob-carpenter
Copy link
Contributor

Can someone remind which is better, greater or less than one. And also, what's the range of variation we expect.

We don't want to induce 1% performance regressions on PRs, but how much of this is noise?

@wds15
Copy link
Contributor

wds15 commented Jul 26, 2019

Numbers greater than 1 indicate a speed up...but smaller than 3% changes are probably noise anyway.

@drezap
Copy link
Author

drezap commented Jul 26, 2019

Is this ready?

@bob-carpenter bob-carpenter merged commit e5e42cc into develop Jul 29, 2019
@bob-carpenter bob-carpenter deleted the feature/issue-2778-add-add_diag branch July 29, 2019 22:02
@serban-nicusor-toptal serban-nicusor-toptal added this to the 2.20.0++ milestone Oct 18, 2019
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.

6 participants