Skip to content

Instantly share code, notes, and snippets.

View insertinterestingnamehere's full-sized avatar

Ian Henriksen insertinterestingnamehere

View GitHub Profile
Contained in 3.1.0 but not in 3.1.1:
void csrot(int *n, c *cx, int *incx, c *cy, int *incy, s *c, s *s)
void zdrot(int *n, z *cx, int *incx, z *cy, int *incy, d *c, d *s)
Contained in 3.1.1 but not in 3.1.0:
Changed from 3.1.0 to 3.1.1:
Changed signature from 3.1.0 to 3.1.1:
Changed argument names from 3.1.0 to 3.1.1:
@insertinterestingnamehere
insertinterestingnamehere / replace.py
Created June 11, 2015 05:43
Namespace Separating script for dynd-python
beginning_rules = {'using namespace dynd;\n' : '',
'using namespace dynd::nd;\n\n' : '',
'using namespace dynd::ndt;\n\n' : '',
'using namespace pydynd;\n' : '',
' complex_float32_type_id,' : ' dynd::complex_float32_type_id,',
'complex_float64_type_id' : 'dynd::complex_float64_type_id',
'complex_float128_type_id' : 'dynd::complex_float128_type_id',
'nd::string' : 'dynd::nd::string',
'<complex_float32_type_id>' : '<dynd::complex_float32_type_id>',
' complex_float32_type_id:' : ' dynd::complex_float32_type_id:',}
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /
c /IC:\Users\Owner\libdynd\thirdparty\datetime\include /IC:\Users\Owner\libdy
nd\include /IC:\Users\Owner\libdynd\thirdparty\utf8\source /IC:\Users\Owner\l
ibdynd\msvc_build\include /IC:\Users\Owner\libdynd\tests\..\thirdparty /IC:\U
sers\Owner\libdynd\tests\. /W3 /WX /O2 /Ob2 /D WIN32 /D _WINDOWS /D _VARIADIC
_MAX=10 /D NDEBUG /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /EHsc /MD /GS /
fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"test_libdynd.dir\Relea
se\\" /Fd"test_libdynd.dir\Release\vc140.pdb" /Gd /TP /wd4503 /errorReport:qu
eue -bigobj C:\Users\Owner\libdynd\tests\pp\test_pp_arithmetic.cpp C:\Users\
@insertinterestingnamehere
insertinterestingnamehere / enable_for.cpp
Created September 15, 2015 17:33
This shows how to enable a template for an explicit list of types.
#include <iostream>
#include <type_traits>
template<typename T, typename... UsableTypes>
struct SearchImpl : std::is_same<T, UsableTypes>...
{
};
template<typename T, typename... UsableTypes>
struct Search : std::is_base_of<std::true_type, SearchImpl<T, UsableTypes...>>::type
@insertinterestingnamehere
insertinterestingnamehere / gist:ba7b72997e98626d672d
Created October 19, 2015 15:49
templated implicit conversion
#include <iostream>
#include <type_traits>
template <typename T>
struct forward_type {
typedef T type;
};
class myint {
public:
@insertinterestingnamehere
insertinterestingnamehere / call_dgemm.py
Last active October 7, 2020 09:36
This shows how to use SciPy's Cython-exposure of the BLAS and LAPACK libraries from within ctypes.
import numpy as np
import ctypes as ct
from scipy.linalg import cython_blas
#ct.cdll.LoadLibrary("libopenblas.dll")
#openblas = ct.CDLL("libopenblas.dll")
#dgemm = openblas.dgemm
ct.pythonapi.PyCapsule_GetPointer.restype = ct.c_void_p
ct.pythonapi.PyCapsule_GetPointer.argtypes = [ct.py_object, ct.c_char_p]
@insertinterestingnamehere
insertinterestingnamehere / mod.pxd
Created October 19, 2015 22:28
This shows how to wrap a C++ function in a capsule within Cython, how to call a function pointer wrapped in a capsule object, how to export that function as a part of the modules C API, and how to call that function from outside the module using ctypes.
cdef double cymul(double, double) nogil
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <iostream>
#include <type_traits>
#include <typeinfo>
template <typename T, T... I>
struct integer_sequence {
enum { size = sizeof...(I) };
typedef T value_type;
};
@insertinterestingnamehere
insertinterestingnamehere / arithmetic.cpp
Created April 7, 2016 23:45
Demonstrates a bug in MSVC 2015 Update 2
#include <map>
#include <memory>
#include <vector>
#include <limits>
#include <cstdint>
#include <iostream>
#include <atomic>
#include <sstream>
#include <algorithm>
#include <array>