This file contains 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
#' ReversionTest | |
#' Tests the precision of two reciprocal functions. It evaluates the differences between | |
#' a computed value \eqn{x'} and an expected value \eqn{x} after \eqn{x' = finv(f(x))}. | |
#' @param f,finv The functions to be tested for precision with finv the inverse function for f. | |
#' @param ToIterate a list of vectors, on for each variable. | |
#' @param KeyVar The variable in ToIterate for which the test is for. Either an list index | |
#' or a name as string (partial strings allowed). | |
#' @param ... additional arguments to be passed to f and finv. | |
#' @param DiffFunc A function to quantify the difference between expected | |
#' value and computed value. If Null, ReversionTest will use the absolute ratio. |
This file contains 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
#' SaturationThold | |
#' Where does an asymptotic function run into saturation? 'SaturationThold' | |
#' determines the practical range of definition of a function. | |
#' Though a function may theoretically approach to a limit asymptotically, | |
#' an implemented function ususally does not work along the full range of | |
#' possible input values. The limitations in the precision of floating point | |
#' numbers will most likely cause a function to run into saturation (long) | |
#' before the input values reach the maximum possible values. | |
#' @param f A function. It's first argument will be used to find the | |
#' saturation threshold. |
This file contains 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
#' polyPDF | |
#' This function constructs a PD function from the moments. The output of this function is the PDF. | |
#' @param moments data frame, containing the moment order ("n") in one column | |
#' and their values ("moments") in the other | |
#' @param xmin,xmax Lower and upper limit of the PDF. | |
#' @param scale Scale factor can be used to transform data avoiding singularity (default = 1). | |
#' @param disp If TRUE, the PDF will be plotted and the polynomial coefficients are shown. | |
#' @author Hugo Hernandez; small refactoring by Jan Seifert | |
#' @reference Hernandez, H. (2018). Comparison of Methods for the Reconstruction | |
#' of Probability Density Functions from Data Samples. Technical Report |
This file contains 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
#' Double factorial function | |
#' The double factorial is the product of all the integers from 1 up to x | |
#' that have the same parity (odd or even) as x (see https://t1p.de/byye). | |
#' | |
#' @param x Numeric vector. Will be coerced to integer. | |
#' | |
#' @note dfactorial is defined for x in [0, 300] | |
#' @references Gould, H. & Quaintance, J. (2012). Double Fun with Double | |
#' Factorials. Mathematics Magazine, 85(3), 177-192. doi:10.4169/math.mag.85.3.177 | |
dfactorial <- function(x) { |
This file contains 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
library(dfoptim) | |
fopt <- "dfoptim" | |
# Choose objective function ---- | |
rosbkext <- function(x) { | |
# Extended Rosenbrock function | |
n <- length(x) | |
sum (100*(x[1:(n-1)]^2 - x[2:n])^2 + (x[1:(n-1)] - 1)^2) | |
} | |
# moved rastrigin by 1 so that the global optimum is at rep(1, 6) |
This file contains 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
#' `%./%` | |
#' Specialized integer division `x1 / x2` that correctly rounds to the | |
#' nearest value. | |
#' @param x1,x2 numerator and denominator (integer) | |
#' @return integer | |
#' @source https://stackoverflow.com/questions/36377244/make-int-round-off-to-nearest-value/36377365 | |
`%./%` <- function(x1, x2) { | |
return( x1 %/% x2 + (x1 %% x2) %/% (x2 %/% 2L + x2 %% 2L) ) | |
} |
This file contains 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
/* | |
How to de-serialise a property that returns an IReadOnlyList and shall not be set | |
from outside? | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
public class PersonClass |
This file contains 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
:: Convert vector file formats in the current folder and their subfolders | |
:: Adaptation of Johannes Demls great batch script to convert vector graphic files with InkScape in batch mode | |
:: Original taken from https://gist.github.com/JohannesDeml/779b29128cdd7f216ab5000466404f11 | |
:: Please refer to the original site for instructions | |
:: This script can be found at: https://gist.github.com/SigurdJanson/ddccf14d41ecbd490fd9070dd1ec13d6 | |
@Echo off | |
setlocal ENABLEDELAYEDEXPANSION | |
:: Possible paths to check for the installation |
This file contains 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
// TYPE 1 | |
protected RenderFragment RenderThis = @<span title = "I was a render fragment, once" class="fragged"> | |
You can use me many times without per-component overhead | |
</span>; |
OlderNewer