Skip to content

Instantly share code, notes, and snippets.

View kvchen's full-sized avatar

Kevin Chen kvchen

View GitHub Profile
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@kvchen
kvchen / gist:1b843ba2e91c26538a1e
Last active September 22, 2017 10:05
Installing SQLite

Installing SQLite

The simplest way to start using SQLite is to download a precompiled binary from the

The latest version of SQLite at the time of writing is 3.8.9, but you can check for additional updates on the SQLite download page.

Windows

import json
def main():
with open('test.json', 'rb') as infile:
test = json.load(infile)['result']
print(test)
if __name__ == "__main__":
main()
@kvchen
kvchen / keybase.md
Created December 12, 2016 10:50
keybase.md

Keybase proof

I hereby claim:

  • I am kvchen on github.
  • I am kevinchen (https://keybase.io/kevinchen) on keybase.
  • I have a public key ASDOJ1rzklOEGkN0LP1t-vGd2Q3dQfON2di2vhNrDybITQo

To claim this, I am signing this object:

import ray
import matplotlib.pyplot as plt
import numpy as np
import ray.array.distributed as rd
# from scipy.linalg import lu
def main():
ray.init(start_ray_local=True, num_workers=10)
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote
def lu_decomp_invert(lu_decomp):
"""Takes the inverse of each of the components in the P, L, U
decomposition. Needed as a helper function for the block-level LU decomp.
"""
return tuple(np.linalg.inv(x) for x in lu_decomp)
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
@ray.remote(num_return_vals=3)
def block_lu(a, block_size=100):
"""Returns the LU decomposition of a square matrix.
Parameters
----------
a : array_like
Returns
-------
def assemble(self):
"""Assemble an array on this node from a distributed array of object IDs."""
first_block = ray.get(self.objectids[(0,) * self.ndim])
dtype = first_block.dtype
result = np.zeros(self.shape, dtype=dtype)
indices = np.ndindex(*self.num_blocks)
# Fetch all the blocks asynchronously
blocks = ray.get([self.objectids[idx] for idx in indices])