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

README example doesn't compile #15

Closed
hombit opened this issue Oct 9, 2023 · 2 comments
Closed

README example doesn't compile #15

hombit opened this issue Oct 9, 2023 · 2 comments

Comments

@hombit
Copy link

hombit commented Oct 9, 2023

error[E0609]: no field `step_size_adapt` on type `SamplerArgs`
   --> src/nl_fit/nuts.rs:293:22
    |
293 |         sampler_args.step_size_adapt.target = 0.8;
    |                      ^^^^^^^^^^^^^^^ unknown field
    |
    = note: available fields are: `num_tune`, `num_draws`, `maxdepth`, `store_gradient`, `store_unconstrained` ... and 3 others

error[E0609]: no field `store_mass_matrix` on type `nuts_rs::adapt_strategy::GradDiagOptions`
   --> src/nl_fit/nuts.rs:296:40
    |
296 |         sampler_args.mass_matrix_adapt.store_mass_matrix = true;
    |                                        ^^^^^^^^^^^^^^^^^ unknown field
    |
    = note: available fields are: `dual_average_options`, `mass_matrix_options`, `early_window`, `step_size_window`, `mass_matrix_switch_freq`, `early_mass_matrix_switch_freq`
help: one of the expressions' fields has a field of the same name
    |
296 |         sampler_args.mass_matrix_adapt.mass_matrix_options.store_mass_matrix = true;
    |                                        ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/nl_fit/nuts.rs:303:71
    |
303 |         let mut sampler = new_sampler(logp_func, sampler_args, chain, seed);
    |                           -----------                                 ^^^^ expected `&mut _`, found integer
    |                           |
    |                           arguments to this function are incorrect
    |
    = note: expected mutable reference `&mut _`
                            found type `{integer}`
note: function defined here
   --> /Users/hombit/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nuts-rs-0.8.0/src/cpu_sampler.rs:184:8
    |
184 | pub fn new_sampler<F: CpuLogpFunc, R: Rng + ?Sized>(
    |        ^^^^^^^^^^^
help: consider mutably borrowing here
    |
303 |         let mut sampler = new_sampler(logp_func, sampler_args, chain, &mut seed);
    |                                                                       ++++

error[E0599]: no method named `to_vec` found for associated type `<impl nuts_rs::Chain as nuts_rs::Chain>::Stats` in the current scope
   --> src/nl_fit/nuts.rs:314:34
    |
314 |             let _info_vec = info.to_vec(); // We can collect the stats in a Vec
    |                                  ^^^^^^ method not found in `<impl Chain as Chain>::Stats`

error[E0599]: no method named `start_location` found for reference `&DivergenceInfo` in the current scope
   --> src/nl_fit/nuts.rs:317:66
    |
317 |                 println!("Divergence at position {:?}", div_info.start_location());
    |                                                                  ^^^^^^^^^^^^^^-- help: remove the arguments
    |                                                                  |
    |                                                                  field, not a method
@aseyboldt
Copy link
Member

Thanks for letting us know.
Seems I forgot to update the readme with the contents of lib.rs. Should be fixed by #16

@aseyboldt
Copy link
Member

Should be fixed on main

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 a pull request may close this issue.

2 participants