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
// clang -O3 -DHAVE_INLINE rngint.c -o rngint -lgsl -lgslcblas | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> | |
// Get an integer in the [a,b) semi-closed range. |
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
def getX(i): | |
return int(-0.5 + 0.5 * sqrt(1 + 8 * (i - 1))) + 2 | |
def getY(i): | |
return getX(i) * (3 - getX(i)) / 2 + i - 1 | |
def getXY(i): | |
return (getX(i + 1) - 1, getY(i + 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
void create_assembled_pool(Params *p, double **pool, int divpool, double fert) | |
{ | |
// define and initialize the ecosystem list | |
//----------------------------------------- | |
sll ecosys; | |
sll_init(&ecosys,(void*)free_species); | |
// create the basal resources | |
//--------------------------- | |
basal(p,&ecosys,fert); |
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
//: clang -DHAVE_INLINE -O3 randgsl.c -o randgsl -lgsl -lgslcblas | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <gsl/gsl_rng.h> | |
#include <gsl/gsl_randist.h> | |
int main(int argc, const char *argv[]) |
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
{ | |
int a = 1; | |
int b = 2; | |
{ | |
int a = 3; // Ce 'a' est complètement différent du premier 'a' | |
a += 10; // Cherche un 'a' dans ce scope, il est trouve un (celui qui vaut 3). | |
int c = 5; | |
printf("%d\n", a); // Donne 13 | |
printf("%d\n", b); // Donne 2. Ici il ne trouve pas de 'b' déclarer dans ce scope mais il cherche dans le scope précédent et trove 'b'. | |
printf("%d\n", c); // Donne 5. |
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
typedef struct | |
{ | |
unsigned int id; | |
Params *p; | |
} | |
pth; | |
void treatments(void *param, unsigned long s) | |
{ | |
//------------// |
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
Public preprint servers such as arXiv.org have become central to the scientific | |
process in fields such as physics, mathematics, and economics. These preprint | |
servers allow researchers to make their research rapidly available to the | |
broader community prior to peer review, which facilitates discussion, review, | |
and rapid communication of scientific results. Preprints are increasingly seen | |
as an important component of open science, because the research can be discussed | |
by the scientific community as soon as it is finished, instead of being | |
virtually hidden until officially published. However, in contrast to other | |
disciplines, the field of biology has effectively no preprint culture, with the | |
exception of small pockets of primarily highly quantitative research (e.g., |
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
# Print a sequence of primes. It's not written to be fast, it's just to demonstrate | |
# than an infinite sequence can be compressed in a small program and thus have low | |
# (Kolmogorov) complexity. | |
def printprimes(max) | |
primes = [] | |
for i in 2.. max do | |
primes << i if primes.inject(true) {|res, elt| | |
res and i % elt != 0 | |
} | |
end |
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
getPrimes = f [2, 3] 5 | |
f ps n max = if n >= max then | |
ps | |
else if pr n then | |
f (ps ++ [n]) (n + 2) max | |
else | |
f ps (n + 2) max | |
where pr y = foldl (&&) True (map (\x -> mod y x > 0) ps) |
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
// Compile with g++ -std=c++11 -O2 main.c -o main | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <random> | |
#include <ctime> | |
#include <cstdlib> | |
using namespace std; |