Commit 8a0f6855 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

Clean root directory

parent 53bab68b
#include <stdio.h>
int main(void)
{
printf("hello, world\n");
return 0;
}
#!/bin/bash
set -x
nbfile="tp-gitlab-ci.ipynb"
jupyter-nbconvert $nbfile --to slides --post serve --execute --allow-errors
.PHONY: clean pythran
all: C pythran
C:
gcc helloworld.c -o helloworld.e
pythran:
pythran rosenbrock.py -o rosenbrock_pythran.so
clean:
rm -rf *.o *.e *.so *.pyf *.pyc __pycache__
# -*- coding: utf-8 -*-
#runas import numpy as np; r = np.arange(0.,10., .01); rosen(r)
#bench import numpy as np; r = np.arange(50000000); rosen(r)
#pythran export rosen(int[])
#pythran export rosen(float[])
import numpy as np
def rosen(x):
t0 = 100 * (x[1:] - x[:-1] ** 2) ** 2
t1 = (1 - x[:-1]) ** 2
return np.sum(t0 + t1)
#!/bin/bash
jupyter-nbconvert tp-gitlab-ci.ipynb --to slides --post serve --execute --allow-errors
set -x
nbfile="tp-gitlab-ci.ipynb"
jupyter-nbconvert $nbfile --to slides --post serve --execute --allow-errors
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test helloworld.c
"""
import os
assert os.popen('./helloworld.e', 'r').read() == "hello, world\n"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Rosenbrock
"""
from rosenbrock_pythran import rosen as rosen_pythran
from rosenbrock import rosen as rosen_python
from pytest import mark, approx
import numpy as np
r_float = np.arange(0., 10., .01)
expect_float = 152089858.36719903
r_int = np.arange(50000000)
expect_int = 7842832767944603480
param = [(r_float, expect_float), (r_int, expect_int)]
@mark.parametrize('r, result', param)
def test_rosen_python(r, result):
assert rosen_python(r) == approx(result)
@mark.parametrize('r, result', param)
def test_rosen_pythran(r, result):
assert rosen_pythran(r) == approx(result)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment