Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/cran/RcppDist
24 June 2025, 10:44:38 UTC
  • Code
  • Branches (3)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/0.1.1
    • refs/tags/0.1.1.1
    No releases to show
  • 2f3909a
  • /
  • src
  • /
  • test_functions.cpp
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:1a22a960d96fe0219bdb924a5d7c3b6aa918cb8c
origin badgedirectory badge
swh:1:dir:bc0dee9f0ab9c155ed50d3f885dc620b6292865d
origin badgerevision badge
swh:1:rev:e1fe5693fe757879ca107642f322ad1fa2f3b1ed
origin badgesnapshot badge
swh:1:snp:5cf2e8ab115f3e0a0891fb27a96852f78f780eca

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: e1fe5693fe757879ca107642f322ad1fa2f3b1ed authored by JB Duck-Mayr on 12 June 2025, 08:37:39 UTC
version 0.1.1.1
Tip revision: e1fe569
test_functions.cpp
#include <RcppDist.h>

using namespace Rcpp;

// FOUR PARAMETER BETA DISTRIBUTION

// [[Rcpp::export]]
List test_d4beta(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = d4beta(x, shape1, shape2, a, b, true),
        _["VectorNoLog"] = d4beta(x, shape1, shape2, a, b),
        _["DoubleLog"] = d_4beta(x[0], shape1, shape2, a, b, 1),
        _["DoubleNoLog"] = d_4beta(x[0], shape1, shape2, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_p4beta(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = p4beta(x, shape1, shape2, a, b, true, true),
        _["VectorNoLog"] = p4beta(x, shape1, shape2, a, b),
        _["DoubleLog"] = p_4beta(x[0], shape1, shape2, a, b, 1, 1),
        _["DoubleNoLog"] = p_4beta(x[0], shape1, shape2, a, b),
        _["VectorLogNoLower"] = p4beta(x, shape1, shape2, a, b, false, true),
        _["VectorNoLogNoLower"] = p4beta(x, shape1, shape2, a, b, false),
        _["DoubleLogNoLower"] = p_4beta(x[0], shape1, shape2, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_4beta(x[0], shape1, shape2, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_q4beta_nolog(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = q4beta(x, shape1, shape2, a, b),
        _["DoubleNoLog"] = q_4beta(x[0], shape1, shape2, a, b),
        _["VectorNoLogNoLower"] = q4beta(x, shape1, shape2, a, b, false),
        _["DoubleNoLogNoLower"] = q_4beta(x[0], shape1, shape2, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_q4beta_log(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = q4beta(x, shape1, shape2, a, b, true, true),
        _["DoubleLog"] = q_4beta(x[0], shape1, shape2, a, b, 1, 1),
        _["VectorLogNoLower"] = q4beta(x, shape1, shape2, a, b, false, true),
        _["DoubleLogNoLower"] = q_4beta(x[0], shape1, shape2, a, b, 0, 1)
    );
} // nocov



// LOCATION-SCALE T DISTRIBUTION

// [[Rcpp::export]]
List test_dlst(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = dlst(x, df, mu, sigma, true),
        _["VectorNoLog"] = dlst(x, df, mu, sigma),
        _["DoubleLog"] = d_lst(x[0], df, mu, sigma, 1),
        _["DoubleNoLog"] = d_lst(x[0], df, mu, sigma)
    );
} // nocov

// [[Rcpp::export]]
List test_plst(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = plst(x, df, mu, sigma, true, true),
        _["VectorNoLog"] = plst(x, df, mu, sigma),
        _["DoubleLog"] = p_lst(x[0], df, mu, sigma, 1, 1),
        _["DoubleNoLog"] = p_lst(x[0], df, mu, sigma),
        _["VectorLogNoLower"] = plst(x, df, mu, sigma, false, true),
        _["VectorNoLogNoLower"] = plst(x, df, mu, sigma, false),
        _["DoubleLogNoLower"] = p_lst(x[0], df, mu, sigma, 0, 1),
        _["DoubleNoLogNoLower"] = p_lst(x[0], df, mu, sigma, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qlst_nolog(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorNoLog"] = qlst(x, df, mu, sigma),
        _["DoubleNoLog"] = q_lst(x[0], df, mu, sigma),
        _["VectorNoLogNoLower"] = qlst(x, df, mu, sigma, false),
        _["DoubleNoLogNoLower"] = q_lst(x[0], df, mu, sigma, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qlst_log(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = qlst(x, df, mu, sigma, true, true),
        _["DoubleLog"] = q_lst(x[0], df, mu, sigma, 1, 1),
        _["VectorLogNoLower"] = qlst(x, df, mu, sigma, false, true),
        _["DoubleLogNoLower"] = q_lst(x[0], df, mu, sigma, 0, 1)
    );
} // nocov



// TRUNCATED NORMAL DISTRIBUTION

// [[Rcpp::export]]
List test_dtruncnorm(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = dtruncnorm(x, mu, sigma, a, b, true),
        _["VectorNoLog"] = dtruncnorm(x, mu, sigma, a, b),
        _["DoubleLog"] = d_truncnorm(x[0], mu, sigma, a, b, 1),
        _["DoubleNoLog"] = d_truncnorm(x[0], mu, sigma, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptruncnorm(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = ptruncnorm(x, mu, sigma, a, b, true, true),
        _["VectorNoLog"] = ptruncnorm(x, mu, sigma, a, b),
        _["DoubleLog"] = p_truncnorm(x[0], mu, sigma, a, b, 1, 1),
        _["DoubleNoLog"] = p_truncnorm(x[0], mu, sigma, a, b),
        _["VectorLogNoLower"] = ptruncnorm(x, mu, sigma, a, b, false, true),
        _["VectorNoLogNoLower"] = ptruncnorm(x, mu, sigma, a, b, false),
        _["DoubleLogNoLower"] = p_truncnorm(x[0], mu, sigma, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_truncnorm(x[0], mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtruncnorm_nolog(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtruncnorm(x, mu, sigma, a, b),
        _["DoubleNoLog"] = q_truncnorm(x[0], mu, sigma, a, b),
        _["VectorNoLogNoLower"] = qtruncnorm(x, mu, sigma, a, b, false),
        _["DoubleNoLogNoLower"] = q_truncnorm(x[0], mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtruncnorm_log(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = qtruncnorm(x, mu, sigma, a, b, true, true),
        _["DoubleLog"] = q_truncnorm(x[0], mu, sigma, a, b, 1, 1),
        _["VectorLogNoLower"] = qtruncnorm(x, mu, sigma, a, b, false, true),
        _["DoubleLogNoLower"] = q_truncnorm(x[0], mu, sigma, a, b, 0, 1)
    );
} // nocov



// TRUNCATED T DISTRIBUTION

// [[Rcpp::export]]
List test_dtrunct(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = dtrunct(x, df, a, b, true),
        _["VectorNoLog"] = dtrunct(x, df, a, b),
        _["DoubleLog"] = d_trunct(x[0], df, a, b, 1),
        _["DoubleNoLog"] = d_trunct(x[0], df, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptrunct(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = ptrunct(x, df, a, b, true, true),
        _["VectorNoLog"] = ptrunct(x, df, a, b),
        _["DoubleLog"] = p_trunct(x[0], df, a, b, 1, 1),
        _["DoubleNoLog"] = p_trunct(x[0], df, a, b),
        _["VectorLogNoLower"] = ptrunct(x, df, a, b, false, true),
        _["VectorNoLogNoLower"] = ptrunct(x, df, a, b, false),
        _["DoubleLogNoLower"] = p_trunct(x[0], df, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_trunct(x[0], df, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunct_nolog(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtrunct(x, df, a, b),
        _["DoubleNoLog"] = q_trunct(x[0], df, a, b),
        _["VectorNoLogNoLower"] = qtrunct(x, df, a, b, false),
        _["DoubleNoLogNoLower"] = q_trunct(x[0], df, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunct_log(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = qtrunct(x, df, a, b, true, true),
        _["DoubleLog"] = q_trunct(x[0], df, a, b, 1, 1),
        _["VectorLogNoLower"] = qtrunct(x, df, a, b, false, true),
        _["DoubleLogNoLower"] = q_trunct(x[0], df, a, b, 0, 1)
    );
} // nocov



// TRUNCATED LOCATION-SCALE T DISTRIBUTION

// [[Rcpp::export]]
List test_dtrunclst(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = dtrunclst(x, df, mu, sigma, a, b, true),
        _["VectorNoLog"] = dtrunclst(x, df, mu, sigma, a, b),
        _["DoubleLog"] = d_trunclst(x[0], df, mu, sigma, a, b, 1),
        _["DoubleNoLog"] = d_trunclst(x[0], df, mu, sigma, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptrunclst(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = ptrunclst(x, df, mu, sigma, a, b, true, true),
        _["VectorNoLog"] = ptrunclst(x, df, mu, sigma, a, b),
        _["DoubleLog"] = p_trunclst(x[0], df, mu, sigma, a, b, 1, 1),
        _["DoubleNoLog"] = p_trunclst(x[0], df, mu, sigma, a, b),
        _["VectorLogNoLower"] = ptrunclst(x, df, mu, sigma, a, b, false, true),
        _["VectorNoLogNoLower"] = ptrunclst(x, df, mu, sigma, a, b, false),
        _["DoubleLogNoLower"] = p_trunclst(x[0], df, mu, sigma, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_trunclst(x[0], df, mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunclst_nolog(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtrunclst(x, df, mu, sigma, a, b),
        _["DoubleNoLog"] = q_trunclst(x[0], df, mu, sigma, a, b),
        _["VectorNoLogNoLower"] = qtrunclst(x, df, mu, sigma, a, b, false),
        _["DoubleNoLogNoLower"] = q_trunclst(x[0], df, mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunclst_log(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = qtrunclst(x, df, mu, sigma, a, b, true, true),
        _["DoubleLog"] = q_trunclst(x[0], df, mu, sigma, a, b, 1, 1),
        _["VectorLogNoLower"] = qtrunclst(x, df, mu, sigma, a, b, false, true),
        _["DoubleLogNoLower"] = q_trunclst(x[0], df, mu, sigma, a, b, 0, 1)
    );
} // nocov



// FOUR PARAMETER BETA DISTRIBUTION

// [[Rcpp::export]]
List test_dtri(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = dtri(x, a, b, c, true),
        _["VectorNoLog"] = dtri(x, a, b, c),
        _["DoubleLog"] = d_tri(x[0], a, b, c, 1),
        _["DoubleNoLog"] = d_tri(x[0], a, b, c)
    );
} // nocov

// [[Rcpp::export]]
List test_ptri(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = ptri(x, a, b, c, true, true),
        _["VectorNoLog"] = ptri(x, a, b, c),
        _["DoubleLog"] = p_tri(x[0], a, b, c, 1, 1),
        _["DoubleNoLog"] = p_tri(x[0], a, b, c),
        _["VectorLogNoLower"] = ptri(x, a, b, c, false, true),
        _["VectorNoLogNoLower"] = ptri(x, a, b, c, false),
        _["DoubleLogNoLower"] = p_tri(x[0], a, b, c, 0, 1),
        _["DoubleNoLogNoLower"] = p_tri(x[0], a, b, c, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtri_nolog(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorNoLog"] = qtri(x, a, b, c),
        _["DoubleNoLog"] = q_tri(x[0], a, b, c),
        _["VectorNoLogNoLower"] = qtri(x, a, b, c, false),
        _["DoubleNoLogNoLower"] = q_tri(x[0], a, b, c, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtri_log(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = qtri(x, a, b, c, true, true),
        _["DoubleLog"] = q_tri(x[0], a, b, c, 1, 1),
        _["VectorLogNoLower"] = qtri(x, a, b, c, false, true),
        _["DoubleLogNoLower"] = q_tri(x[0], a, b, c, 0, 1)
    );
} // nocov



// MULTIVARIATE NORMAL DISTRIBUTION

// [[Rcpp::export]]
List test_dmvnorm(arma::mat x, arma::vec mu, arma::mat S) {
    return List::create(
        _["Log"] = dmvnorm(x, mu, S, true),
        _["NoLog"] = dmvnorm(x, mu, S, false)
    );
} // nocov



// MULTIVARIATE T DISTRIBUTION

// [[Rcpp::export]]
List test_dmvt(arma::mat x, arma::vec mu, arma::mat S, double df) {
    return List::create(
        _["Log"] = dmvt(x, mu, S, df, true),
        _["NoLog"] = dmvt(x, mu, S, df, false)
    );
} // nocov



// WISHART DISTRIBUTION

// [[Rcpp::export]]
List test_dwish(arma::mat x, int df, arma::mat S) {
    return List::create(
        _["Log"] = dwish(x, df, S, true),
        _["NoLog"] = dwish(x, df, S, false)
    );
} // nocov



// INVERSE WISHART DISTRIBUTION

// [[Rcpp::export]]
List test_diwish(arma::mat x, int df, arma::mat S) {
    return List::create(
        _["Log"] = diwish(x, df, S, true),
        _["NoLog"] = diwish(x, df, S, false)
    );
} // nocov

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API