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
| function split(df, columns, by){ | |
| var factors = Array.from(new Set(unpack(df, by))); | |
| var y = factors.map(function(factor) { | |
| var rowsFiltered = df.filter(function(row) { | |
| return (row[by] === factor); | |
| }); | |
| var subdf = {}; | |
| for(i=0; i<columns.length; i++){ | |
| subdf[columns[i]] = unpack(rowsFiltered, columns[i]); | |
| } |
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
| ####### Estimates and covariance matrix ######### | |
| deming.estim <- function(x,y,lambda=1){ # lambda=sigmay²/sigmax² | |
| n <- length(x) | |
| my <- mean(y) | |
| mx <- mean(x) | |
| SSDy <- crossprod(y-my)[,] | |
| SSDx <- crossprod(x-mx)[,] | |
| SPDxy <- crossprod(x-mx,y-my)[,] | |
| A <- sqrt((SSDy - lambda*SSDx)^2 + 4*lambda*SPDxy^2) |
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
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
| <script src="libraries/jquery.min.js"></script> | |
| <script src="libraries/papaparse.min.js"></script> | |
| <script src="libraries/xlsx.core.min.js"></script> | |
| <script src="libraries/bootstrap.min.js"></script> | |
| <link rel="stylesheet" href="libraries/bootstrap.min.css"> | |
| <link rel="stylesheet" href="libraries/bootstrap-theme.min.css"> |
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
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
| <script src="libraries/jquery.min.js"></script> | |
| <script src="libraries/papaparse.min.js"></script> | |
| <script src="libraries/xlsx.core.min.js"></script> | |
| <script src="libraries/bootstrap.min.js"></script> | |
| <link rel="stylesheet" href="libraries/bootstrap.min.css"> | |
| <link rel="stylesheet" href="libraries/bootstrap-theme.min.css"> |
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
| {-# LANGUAGE TemplateHaskell #-} | |
| {-# LANGUAGE QuasiQuotes #-} | |
| module TestsCPP | |
| where | |
| import qualified Language.C.Inline.Cpp as C | |
| import qualified Data.Vector.Storable as V | |
| import Data.Monoid ((<>)) | |
| C.context (C.cppCtx <> C.vecCtx) |
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
| {-# LANGUAGE ForeignFunctionInterface #-} | |
| module Lib where | |
| import Foreign.C.Types | |
| import Foreign (peek, newForeignPtr_) | |
| import Foreign.Ptr | |
| import System.IO.Unsafe (unsafePerformIO) | |
| import qualified Data.Vector.Storable as SV |
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
| --- | |
| title: "Bug DLL" | |
| author: "Stéphane Laurent" | |
| date: "10 octobre 2017" | |
| output: html_document | |
| editor_options: | |
| chunk_output_type: console | |
| --- | |
| ```{r setup, include=FALSE} |
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 <cmath> | |
| #include <cfloat> | |
| #include <boost/math/special_functions/erf.hpp> | |
| #include <boost/math/constants/constants.hpp> | |
| const double onedivtwopi = boost::math::constants::one_div_two_pi<double>(); | |
| const double onedivroottwo = boost::math::constants::one_div_root_two<double>(); | |
| int sign(double x){ | |
| return (std::signbit(x) ? -1 : 1); |
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
| library(rgl) | |
| # vertices #### | |
| phi <- (1+sqrt(5))/2 | |
| a <- 1/sqrt(3) | |
| b <- a/phi | |
| c <- a*phi | |
| vertices <- | |
| rbind( | |
| c( a, a, a), |
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
| library(rgl) | |
| # vertices #### | |
| phi <- (1+sqrt(5))/2 | |
| a <- 1/sqrt(3) | |
| b <- a/phi | |
| c <- a*phi | |
| vertices <- | |
| rbind( | |
| c( a, a, a), |