This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy | |
import sys | |
import timeit | |
try: | |
import numpy.core._dotblas | |
print 'FAST BLAS' | |
except ImportError: | |
print 'slow blas' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def unfold(arr, ax): | |
""" | |
Unfolds a given array along the given axis | |
""" | |
return np.rollaxis(arr, ax, 0).reshape(arr.shape[ax], -1) | |
def test_unfold(): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo(object): | |
def __init__(self, data): | |
self.data = data | |
self.shape = self.data.shape | |
def __getitem__(self, index): | |
return self.data[index] ** 2 | |
def __dir__(self): |
NewerOlder