Use your knowledge of Cython to convert the nbody_opt.py
program you wrote in Assignment 3 into a Cython program. Pay particular attention
to the following:
cdef
declarations for all variablesPlace the resulting code in a file called nbody_cython.pyx
.
Cython provides a module called pyximport
for importing .pyx
files directly. This module will load and compile the Cython code automatically
for you. Use the following commands from IPython or Jupyter in order to load the nbody_cython.pyx
module:
%load_ext Cython
import pyximport
pyximport.install()
At this point you should be able to load your Cython program using the normal import statement:
import nbody_cython
When you are satisfied that your program is working, commit it to the same repository you used in Assignment 3