Skip to content

Instantly share code, notes, and snippets.

Eric Hanson ericphanson

View GitHub Profile
@ericphanson
ericphanson / simdiag.jl
Last active Jan 19, 2019
Simultaneous diagonalization for complex commuting normal matrices
View simdiag.jl
# Adapted from
# https://uk.mathworks.com/matlabcentral/fileexchange/46794-simdiag-m
# which has the following license:
# Copyright (c) 2009, Christian B. Mendl
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
@ericphanson
ericphanson / diff_eigmin.md
Created Aug 3, 2019
Various attempts to differentiate through `eigmin` in Julia
View diff_eigmin.md

Attempts to differentiate eigmin

Julia 1.1, with Zygote master

Version information:

julia> Pkg.status()
    Status `~/Dropbox (Personal)/Research/Code/julia-projects/DiffEvals/ZygoteMaster/Project.toml`
  [ec485272] ArnoldiMethod v0.0.4
  [14197337] GenericLinearAlgebra v0.1.0
@ericphanson
ericphanson / convert_tests.jl
Created Sep 9, 2019
Convex.jl ProblemDepot test conversion
View convert_tests.jl
function convert_test(file, prefix)
# handle start and end:
# delete @testset for... and final "end"
file_contents = read(file, String)
file_contents = replace(file_contents, r"\h*@testset.*for\ssolver.*\n" => "")
file_contents = lstrip(file_contents)
file_contents = file_contents[1:prevind(file_contents, first(findlast("end", file_contents)))]
file_contents = replace(file_contents, r"\n\h\h\h\h(.*)" => SubstitutionString("\n\\1"))
# handle special cases
@ericphanson
ericphanson / warmstart_error.jl
Created Oct 27, 2019
Problem trying to warmstart
View warmstart_error.jl
using SCS
using MathOptInterface # MathOptInterface v0.9.6
const MOI = MathOptInterface
const MOIU = MOI.Utilities
const MOIB = MOI.Bridges
function make_model(vector)
optimizer = SCS.Optimizer(verbose=false)
T = Float64
model = MOIB.full_bridge_optimizer(
@ericphanson
ericphanson / IntervalSpecialFunctions.jl
Last active Dec 11, 2019
IntervalOptimisation problem benchmark
View IntervalSpecialFunctions.jl
# This file contains code taken from https://github.com/JuliaIntervals/IntervalSpecialFunctions.jl
# which is available under the following MIT license:
# > Copyright (c) 2018: David Sanders.
# >
# > Permission is hereby granted, free of charge, to any person obtaining a copy
# > of this software and associated documentation files (the "Software"), to deal
# > in the Software without restriction, including without limitation the rights
# > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# > copies of the Software, and to permit persons to whom the Software is
@ericphanson
ericphanson / Manifest.toml
Last active Mar 7, 2020
Generating and testing precompile statements for COSMO + Convex + MOI
View Manifest.toml
# This file is machine-generated - editing it directly is not advised
[[AMD]]
deps = ["Libdl", "LinearAlgebra", "SparseArrays", "Test"]
git-tree-sha1 = "7b8e22e91af4ccbfbcae87c36d141441defe6f0f"
uuid = "14f7f29c-3bd6-536c-9a0b-7339e30b5a3e"
version = "0.3.1"
[[AbstractTrees]]
deps = ["Markdown"]
View Convex219.jl
using Mosek
using SCS
import DSP: conv
using Convex
conv(x::AbstractVector, y::AbstractVector) = DSP.conv(x,y)
conv(x::Variable, y::AbstractVector) = Convex.conv(x,y)
conv(x::AbstractVector, y::Variable) = Convex.conv(x,y)
using Random
using SparseArrays
@ericphanson
ericphanson / Manifest.toml
Created May 1, 2020
Logging removes error. Julia bug?
View Manifest.toml
# This file is machine-generated - editing it directly is not advised
[[AbstractFFTs]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "051c95d6836228d120f5f4b984dd5aba1624f716"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "0.5.0"
[[AbstractNumbers]]
deps = ["SpecialFunctions"]
@ericphanson
ericphanson / Manifest.toml
Created Jun 6, 2020
EAGO / Gurobi / MOI error ?
View Manifest.toml
# This file is machine-generated - editing it directly is not advised
[[ASL_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7fa8d4626ddb4a142e82a8ce07279c1315803433"
uuid = "ae81ac8f-d209-56e5-92de-9978fef736f9"
version = "0.1.1+3"
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
You can’t perform that action at this time.