This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FetchContent_Declare(boost_ut | |
| GIT_REPOSITORY https://github.com/boost-ext/ut.git | |
| GIT_TAG v2.3.1) | |
| FetchContent_MakeAvailable(boost_ut) | |
| # link this object to your test executable, then call discover_boost_ut_test() on it | |
| add_library(boost_ut_runner OBJECT test_runner.cpp) | |
| target_link_libraries(boost_ut_runner PUBLIC Boost::ut) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "D": 2, | |
| "r": 2.5, | |
| "p": 0.6666666666666666 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # based on tutorial from https://www.cnx-software.com/2017/03/12/how-to-control-your-air-conditioner-with-raspberry-pi-board-and-anavi-infrared-phat/ | |
| begin remote | |
| name ge_ac | |
| flags RAW_CODES | |
| eps 30 | |
| aeps 100 | |
| ptrail 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let style_of_string : string -> Fmt.style option = function | |
| | "b" | "bold" -> Some `Bold | |
| | "i" -> Some `Italic | |
| | "u" -> Some `Underline | |
| | "f" | "faint" -> Some `Faint | |
| | "r" | "reset" -> Some `None | |
| | "reverse" -> Some `Reverse | |
| | "black" -> Some (`Fg `Black) | |
| | "cyan" -> Some (`Fg `Cyan) | |
| | "green" -> Some (`Fg `Green) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # code adapted from https://github.com/stan-dev/example-models/blob/master/knitr/lotka-volterra/lotka-volterra-predator-prey.Rmd | |
| library(posterior) | |
| library(reshape2) | |
| library(ggplot2) | |
| lynx_hare_df <- | |
| read.csv("https://raw.githubusercontent.com/stan-dev/example-models/refs/heads/master/knitr/lotka-volterra/hudson-bay-lynx-hare.csv", | |
| comment.char="#") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from jax import random, jit | |
| import jax.numpy as jnp | |
| from jax.scipy import stats | |
| from util import ravelize_function, make_log_density | |
| __all__ = ["log_density", "log_density_vec", "init_draw_zero"] | |
| def constrain_parameters(sigma_unc, alpha, beta): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # posterior predictive check using the pred_cases generated quantity | |
| install.packages("bayesplot") | |
| library(posterior) | |
| library(ggplot2) | |
| # load from data | |
| d <- jsonlite::read_json('./data.json') | |
| cases <- unlist(d$cases) | |
| n_days <- d$n_days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install.packages("ggplot2") | |
| library(posterior) | |
| library(ggplot2) | |
| # load data from data.json | |
| data <- jsonlite::read_json("./data.json") | |
| x <- unlist(data$x) | |
| y <- unlist(data$y) | |
| # posterior predictive check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdexcept> | |
| #include <iostream> | |
| void maybe_throw(int should_throw) { | |
| if (should_throw) | |
| throw std::domain_error("exception in C++: dummy"); | |
| } | |
| extern "C" int some_fn(int should_throw) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Demonstration of `scalar_type_t`, `base_type_t`, and `value_type_t`, for | |
| * examples where they do the same thing and examples where they differ. | |
| * | |
| * Place in math repo directory and compile with: | |
| make -f make/standalone test_types | |
| */ | |
| #include <stan/math/prim.hpp> | |
| #include <stan/math/prim/fun/typedefs.hpp> |
NewerOlder