Skip to content

Instantly share code, notes, and snippets.

Avatar

ofan666 ofan666

View GitHub Profile
@ofan666
ofan666 / intel.py
Last active Aug 29, 2015
A working and passed all test for Numpy/Scipy with icc/ifort 14.0.2 and Intel MKL 11.1 Update 2.
View intel.py
# snippet from numpy 1.8.1
class IntelEM64TFCompiler(IntelFCompiler):
compiler_type = 'intelem'
compiler_aliases = ()
description = 'Intel Fortran Compiler for 64-bit apps'
version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit')
possible_executables = ['ifort', 'efort', 'efc']
@ofan666
ofan666 / intelccompiler.py
Last active Aug 29, 2015
For Numpy/Scipy with icc/ifort 14.0.2 and Intel MKL 11.1 Update 2.
View intelccompiler.py
# snippet from numpy 1.8.1
class IntelEM64TCCompiler(UnixCCompiler):
""" A modified Intel x86_64 compiler compatible with a 64bit gcc built Python.
"""
compiler_type = 'intelem'
cc_exe = 'icc -m64 -fPIC'
cc_args = "-fPIC"
def __init__ (self, verbose=0, dry_run=0, force=0):
UnixCCompiler.__init__ (self, verbose, dry_run, force)
@ofan666
ofan666 / ex_vogel_IPR_uOil.py
Created Feb 22, 2012
Undersaturated Oil Reservoir IPR using Vogel's method based on test points - http://petropy.blogspot.com/2011/09/ipr-using-vogels-method-based-on-test.html
View ex_vogel_IPR_uOil.py
# importing modules
from matplotlib import pyplot as plt # plotting
import numpy as np # numerical array
# Undersaturated Oil Reservoir
### Known data ###
# Reservoir
P_res = 5500.0 # Reservoir Pressure [psia]
P_bp = 3000.0 # Bubble Point Pressure [psia]
View ex_paper_mpmath2.py
#!/usr/bin/python
import sys
# using mpmath for arbitrary precision,
# sympy for showing the equation in pretty way
if sys.platform == 'linux2':
import mpmath as mp, sympy as sm
elif sys.platform == 'win32':
import sympy as sm
View ex_paper_mpmath1.py
import sys
# using mpmath for arbitrary precision,
# sympy for showing the equation in pretty way
if sys.platform == 'linux2':
import mpmath as mp, sympy as sm
elif sys.platform == 'win32':
import sympy as sm
mp = sm.mpmath
View ex_LTI_TransientRespond.py
from numpy import min, max
from scipy import linspace
from scipy.signal import lti, step, impulse
# making transfer function
# example from Ogata Modern Control Engineering
# 4th edition, International Edition page 307
# num and den, can be list or numpy array type
num = [6.3223, 18, 12.811]
View TDMAsolver.py
try:
import numpypy as np # for compatibility with numpy in pypy
except:
import numpy as np # if using numpy in cpython
## Tri Diagonal Matrix Algorithm(a.k.a Thomas algorithm) solver
def TDMAsolver(a, b, c, d):
'''
TDMA solver, a b c d can be NumPy array type or Python list type.
refer to http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
You can’t perform that action at this time.