Skip to content

Make trace_gen_inv_quad_form_ldlt work with size 0 input - #1493

Merged
bob-carpenter merged 1 commit into
stan-dev:developfrom
mcol:issue_1447
Dec 8, 2019
Merged

bob-carpenter merged 1 commit into
stan-dev:developfrom
mcol:issue_1447

Conversation

@mcol

@mcol mcol commented Dec 8, 2019

Copy link
Copy Markdown
Member

Summary

This adds some checks for size 0 inputs so we can return 0 immediately without failing later on. These checks have to be before check_multipliable because that throws on size 0 inputs. For the test in mix to work, I had to add a little workaround to the to_ldlt function so that it returns an empty LDLT_factor if the input is an empty matrix. Fixes #1447.

Tests

I added those that @bob-carpenter had originally written and commented out. I've also added equivalent tests in prim.

Side Effects

None.

Checklist

@stan-buildbot

Copy link
Copy Markdown
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, 1.01)
(stat_comp_benchmarks/benchmarks/irt_2pl/irt_2pl.stan, 1.01)
(stat_comp_benchmarks/benchmarks/pkpd/one_comp_mm_elim_abs.stan, 0.94)
(stat_comp_benchmarks/benchmarks/eight_schools/eight_schools.stan, 1.0)
(stat_comp_benchmarks/benchmarks/gp_regr/gp_regr.stan, 0.98)
(stat_comp_benchmarks/benchmarks/arK/arK.stan, 1.0)
(performance.compilation, 1.01)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan, 1.0)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix/low_dim_gauss_mix.stan, 1.0)
(stat_comp_benchmarks/benchmarks/sir/sir.stan, 0.96)
(stat_comp_benchmarks/benchmarks/pkpd/sim_one_comp_mm_elim_abs.stan, 1.0)
(stat_comp_benchmarks/benchmarks/garch/garch.stan, 1.0)
(stat_comp_benchmarks/benchmarks/gp_regr/gen_gp_data.stan, 0.98)
(stat_comp_benchmarks/benchmarks/arma/arma.stan, 0.99)
Result: 0.99069523529
Commit hash: 5a4805b

@bob-carpenter bob-carpenter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Thanks.

@bob-carpenter
bob-carpenter merged commit b4d963d into stan-dev:develop Dec 8, 2019
@mcol
mcol deleted the issue_1447 branch December 10, 2019 10:17
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.

consistent trace_gen_inv_quad_form_ldlt behavior at size 0

3 participants