Skip to content

mjasher/computation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

computation

I enjoy maths, python, and fast code. Here are some methods like minded people may find useful.

Demo of how to transfer a float32 array javascript <--> python as a base64 encoded byte string.

A succinct and fairly flexible way to cache a given python function. Easy as

@cache.money(key_func, cache_directory)
def slow_function(a, b, c):
    return y

Here's a demo.

Python performance can be dramatically improved by writing slow functions in C. Ctypes allows C functions to be called from python. Here's a demo which compiles and runs some trivial examples, including some using numpy arrays.

Ctypes can also be used to wrap Fortran in python! Excellent if you want access to troves of well written numerical code such as John Burkardt's collection. This example wraps John Burkardt's 1D FEM steady state heat equation code.

This also contains a comparison of Chebyshev Collocation and Finite Element solutions of the 1d heat equation.

To call c++ from python, SWIG can be used. Here is a simple example for computing a correlation matrix used in applications such as Karhunen-Loève expansions.

About

Computational methods I've implemented or collected

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published