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
#Monte Carlo Integration | |
#Example taken from Miranda and Fackler, Chapter 5, page 94 | |
#We want to computer the following integral: | |
# \int_{-1}^1 \int_{-1}^1 \exp(-x_1) * cos (x_2^2)dx_1 dx_2 | |
#which should be equal to 4.25199 |
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
import numpy as np | |
cimport numpy as np | |
cimport cython | |
@cython.boundscheck(False) | |
@cython.wraparound(False) | |
def my_cum_sum_memv(double[:, ::1] A, | |
double[:, ::1] B): | |
cdef int i, j, lA, lB |
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
cimport cython | |
cdef class MatOpC: | |
#no need to declare the matrices anymore, they're declared inside the pxd file | |
#cdef public double[:, ::1] matA, matB | |
def __init__(self, A, B): | |
self.matA = A | |
self.matB = B |
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
cimport cython | |
from MatOpC cimport MatOpC | |
@cython.boundscheck(False) | |
@cython.wraparound(False) | |
cdef class wrapclass: | |
cdef public MatOpC matopobj | |
def __init__(self, matopobj): |
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
cdef class MatOpC: | |
cdef public double[:, ::1] matA, matB | |
cpdef cumsumC(self) |
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(janitor) | |
> get_dupes | |
function (dat, ...) | |
{ | |
names <- as.list(substitute(list(...)))[-1L] | |
df_name <- deparse(substitute(dat)) | |
var_names <- names | |
if (is.list(var_names)) { | |
var_names <- lapply(names, deparse) | |
} |
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(dplyr) | |
data("iris") | |
# At the first occurence of, say, Petal.Length = 1 and Petal.Width = 1, counter = 1. If Petal.Length = 1 and Petal.Width = 1 occur | |
# again, counter gets incremented to 2 | |
iris %>% | |
group_by(Petal.Length, Petal.Width) %>% | |
mutate(counter = seq_along(Species)) |
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
Date,Poids | |
2013-10-28,84.1 | |
2013-11-11,85.6 | |
2013-11-24,85.2 | |
2013-12-02,84.4 | |
2013-12-30,83.5 | |
2014-01-10,82.4 | |
2014-02-08,83.5 | |
2015-03-24,83 | |
2015-03-28,82.7 |
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(tidyverse) | |
library(forecast) | |
library(lubridate) | |
library(tsibble) | |
library(brotools) | |
ihs <- function(x){ | |
log(x + sqrt(x**2 + 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
<?xml version="1.0" encoding="UTF-8"?> | |
<alto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/standards/alto/ns-v3#" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v3# https://www.loc.gov/standards/alto/v3/alto-3-1.xsd"> | |
<Description> | |
<MeasurementUnit>mm10</MeasurementUnit> | |
<sourceImageInformation> | |
<fileName>../tif/1877-12-29_01-00004.tif</fileName> | |
</sourceImageInformation> | |
<OCRProcessing ID="OCR1"> | |
<ocrProcessingStep> | |
<processingStepSettings> |
OlderNewer