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
from scipy.sparse import csr_matrix | |
import scipy as sp | |
import numpy as np | |
from scipy.sparse.linalg import spsolve_triangular | |
# rating matrix | |
a = np.array([[1, 0, 1, 1, 0], | |
[1, 1, 0, 1, 0], | |
[1, 0, 0, 1, 0]]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def _reshape(a, size): | |
return a.reshape(size, order='f') | |
rx1, rx2, ry1, ry2, ra1, ra2, n, l, m = 40, 40, 40, 40, 100, 100, 8, 8, 8 | |
x = np.ones((rx1, n, rx2)) | |
y = np.ones((ry1, n, ry2)) | |
A = np.ones((ra1, n, l, ra2)) | |
interface_prev = np.ones((rx1, ry1*ra1**2)) |
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 Base(object): | |
def __init__(self, a): | |
self._a = a | |
class Derived(Base): | |
def __init__(self, a={"a": 3}, b=10): | |
super().__init__(a) | |
self._b = b | |
def update_a(self, a): |
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
# follow up on | |
# https://medium.com/@cscalfani/goodbye-object-oriented-programming-a59cda4c0e53#.5os988r69 | |
# this, however, is a bit "artificial" example (as it can be simply solved by not defining derived add_all method) | |
# more realistic scenario would be something like | |
# http://stackoverflow.com/questions/20822850/change-python-mro-at-runtime | |
class Array(object): | |
def __init__(self): | |
self._a = [] |
This file has been truncated, but you can view the full file.
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
execve("/root/miniconda2/bin/python", ["python", "-c", "import scipy; scipy.test()"], [/* 16 vars */]) = 0 | |
brk(0) = 0x93c000 | |
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) | |
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc78b6e0000 | |
readlink("/proc/self/exe", "/root/miniconda2/bin/python2.7", 4096) = 30 | |
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
open("/root/miniconda2/bin/../lib/tls/x86_64/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/root/miniconda2/bin/../lib/tls/x86_64", 0x7fffdf5f8830) = -1 ENOENT (No such file or directory) | |
open("/root/miniconda2/bin/../lib/tls/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) | |
stat("/root/miniconda2/bin/../lib/tls", 0x7fffdf5f8830) = -1 ENOENT (No such file or directory) |