I hereby claim:
- I am angeris on github.
- I am angeris (https://keybase.io/angeris) on keybase.
- I have a public key ASDT_GHDJohjVhunI0yCpEHqZH_yvzT0KEkNhjkOXA1-LQo
To claim this, I am signing this object:
/* | |
* I threw together this set of classes to work on Hackerrank's stuff at a fairly low level. Of | |
* course, you are provided with several libraries to do this for you, such as Weka, which makes | |
* life quite a bit easier than setting up your own feature matrix. But for those who want to | |
* have the simple stuff such as naive QR using Gram-Schmidt, back-substitution, and school-book | |
* matrix multiplication, this will work. Even for fairly large datasets within Hackerrank | |
* the performance is fast enough to give a very wide margin of extra time. Enjoy! | |
* | |
* Guille (@Guillean) | |
*/ |
from numpy import * | |
N, L = 1e8, 10 | |
print("Here's your crappy estimation of pi: {}".format((sum(exp(-(random.rand(N)*2*L-L)**2))*2*L/N)**2)) |
# Author: Guillermo Angeris (@guillean) | |
# Simple UnionFind based on https://www.cs.princeton.edu/~rs/AlgsDS07/01UnionFind.pdf | |
class UnionFind: | |
def __init__(self): | |
self.rank = {} | |
self.parent = {} | |
def add(self, elem): | |
self.rank[elem] = 1 |
Initial positions | |
Player A: | |
[0-5] [1-3] [1-4] [2-2] [3-4] [4-4] [5-6] | |
Player B: | |
[0-0] [0-1] [0-6] [1-1] [1-6] [2-3] [2-6] | |
Player C: | |
[0-2] [2-4] [2-5] [3-3] [3-6] [4-5] [4-6] | |
Player D: | |
[0-3] [0-4] [1-2] [1-5] [3-5] [5-5] [6-6] |
import numpy as np | |
X = np.array([ | |
[1, 4], | |
[20, 35], | |
[8, 15] | |
]) | |
y = np.array([3, 15, 7]) | |
opt_theta = np.linalg.lstsq(X, y) |
using JuMP | |
using ProgressMeter | |
using LinearAlgebra | |
using SparseArrays | |
import Gurobi | |
# Formulates ‖x‖² ≤ y as an SOC | |
function quad_cons(m, x, y) | |
@constraint(m, sum(x.^2) ≤ y ) | |
end |
using JuMP | |
using LinearAlgebra | |
using SparseArrays | |
# Formulates ‖x‖² ≤ y as an SOC | |
function quad_cons(m, x, y) | |
@constraint(m, sum(x.^2) ≤ y ) | |
end | |
const t_min = 1 |
using JuMP | |
using LinearAlgebra | |
using BenchmarkTools | |
using ProgressMeter | |
import Random | |
import SCS | |
Random.seed!(1234) | |
function randn_symm(n) |
I hereby claim:
To claim this, I am signing this object:
import numpy as np | |
import cvxpy as cp | |
import matplotlib.pyplot as plt | |
# The idea is that we have two circles, in opposite corners | |
# that need to move past each other during optimization (in order to minimize | |
# some simple objective function). The important thing to guarantee | |
# is that they do not intersect at any point during any iteration. | |
# Initial/desired positions of circles, radius = 1/4. |