This gist demonstrates how to setup a python project that process a numpy array from C language.
To compile the project, run
make all
To test it, run
make test
""" | |
Reference: | |
1. https://gist.github.com/ycopin/3342888 | |
2. http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt |
This gist demonstrates how to setup a python project that process a numpy array from C language.
To compile the project, run
make all
To test it, run
make test
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ |
# Calculate Pi using monte carlo method | |
function estimate_pi_vec() | |
# Vectorized way of calculating Pi | |
# This style is commonly seen in python or Matlab/Octave to avoid for loops | |
samplenum=100000000 | |
mc_x=rand(samplenum,1) | |
mc_y=rand(samplenum,1) |
{ | |
"metadata": { | |
"language": "Julia", | |
"name": "", | |
"signature": "sha256:999e48e1cfeb072e56d4089a89783a9483f6c014acc704990d74ba7079a57434" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ |
{ | |
"metadata": { | |
"language": "Julia", | |
"name": "", | |
"signature": "sha256:6394928c631f491d9b3776e1af071144d00c1446e0ec4d032c094af7b3d8edd6" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ |
const ContinueGame=999 | |
const WinGame=777 | |
const LoseGame=444 | |
const QuitGame=-99 | |
function move(line,direction) | |
lineLen=length(line) | |
nonZeroLine=line[line.>0] |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |