Skip to content

Instantly share code, notes, and snippets.

View IainNZ's full-sized avatar

Iain Dunning IainNZ

View GitHub Profile
(v0.7) pkg> test RandomCorrelationMatrices
Testing RandomCorrelationMatrices
Resolving package versions...
Random correlation matrix
ERROR: LoadError: MethodError: no method matching cholesky(::Array{Float64,2}, ::Type{Val{:L}})
Closest candidates are:
cholesky(::Union{Union{DenseArray{T,2}, Base.ReinterpretArray{T,2,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Tuple{AbstractUnitRange,Vararg{Any,N} where N} where A<:DenseArray where N where T, DenseArray}, Base.ReshapedArray{T,2,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{Base.ReinterpretArray{T,N,S,A} where S where A<:Union{SubArray{T,N,A,I,true} where I<:Tuple{AbstractUnitRange,Vararg{Any,N} where N} where A<:DenseArray where N where T, DenseArray} where N where T, SubArray{T,N,A,I,true} where I<:Tuple{AbstractUnitRange,Vararg{Any,N} where N} where A<:DenseArray where N where T, DenseArray}, SubArray{T,2,A,I,L} where L where I<:Tuple{Vararg{Union{Int64, AbstractR
using JuMP, Ipopt
function run_test()
# Create JuMP model, using Ipopt as the solver
mod = Model(solver=IpoptSolver(print_level=0))
# Constants
# Note that all parameters in the model have been normalized
# to be dimensionless. See the COPS3 paper for more info.
h_0 = 1 # Initial height
using JuMP, Ipopt
function run_test()
# Create JuMP model, using Ipopt as the solver
mod = Model(solver=IpoptSolver(print_level=0))
# Constants
# Note that all parameters in the model have been normalized
# to be dimensionless. See the COPS3 paper for more info.
h_0 = 1 # Initial height
JuMP 0.11
Julia 0.4.1
5.173100 seconds (8.65 M allocations: 387.304 MB, 1.78% gc time)
1.112170 seconds (2.30 M allocations: 103.153 MB, 3.06% gc time)
1.112430 seconds (2.30 M allocations: 103.343 MB, 2.77% gc time)
Julia 0.5-dev+2072 (17287f0)
5.294610 seconds (8.65 M allocations: 387.346 MB, 1.70% gc time)
1.164331 seconds (2.30 M allocations: 103.153 MB, 3.15% gc time)
1.104843 seconds (2.30 M allocations: 103.343 MB, 2.81% gc time)
Julia 0.5-llvm37 branch
for col in 1:n
for idx in colptr[i]:colptr[i]-1
row = rowval[idx]
nzv = nzvals[idx]
if row==col && nzv
return true
elseif row>col
break
end
end
{
"cells": [
{
"cell_type": "code",
"execution_count": 113,
"metadata": {
"collapsed": false
},
"outputs": [
{
@IainNZ
IainNZ / jumprepl.jl
Created April 21, 2015 01:21
JuMP REPL
using JuMP
_model = Model()
import Base: LineEdit, REPL
function handle_line(line)
if line[1:3] == "Var"
Base.parse_input_line("@defVar(_model,$(line[5:end]))")
elseif line[1:3] == "Max" || line[1:3] == "Min"
@IainNZ
IainNZ / nightlynames.txt
Created February 28, 2015 23:02
Exported names
AffineTransforms.tformscale
AffineTransforms.tformtranslate
AffineTransforms.tformfwd3rd
AffineTransforms.tformrigid
AffineTransforms.rotationmatrix
AffineTransforms.tformrotate
AffineTransforms.tforminv!
AffineTransforms.rotation3
AffineTransforms.rotationparameters
AffineTransforms.AffineTransforms
@IainNZ
IainNZ / lsp.ipynb
Created February 13, 2015 23:10
LargestSmallestPolygon
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@IainNZ
IainNZ / robot.dat
Created February 13, 2015 22:45
Robot Arm
param max_u_rho := 1;
param max_u_the := 1;
param max_u_phi := 1;
param L := 5;
let tf := 1.0;
let {k in 0..nh} rho[k] := 4.5;
let {k in 0..nh} the[k] := (2*pi/3)*(k/nh)^2;