import timeit
tt = timeit.Timer("tree.query(queries, k=5)",
"""
import numpy as np
from scipy.spatial import cKDTree
data = np.random.rand(10**5, 4)
tree = cKDTree(data)
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
module ProtoType | |
using Parameters | |
using ForwardDiff | |
using NLsolve | |
export ProtoTypeMS, ProtoTypeMP, stress | |
@with_kw immutable ProtoTypeMS | |
n_ε_p::Vector{Float64} |
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
diff --git a/update_w.jl b/update_w.jl | |
index 681f17c..d165e9d 100644 | |
--- a/update_w.jl | |
+++ b/update_w.jl | |
@@ -14,7 +14,12 @@ function update_w( d::Int64, t::Int64, i::Int64, sim::Sim, | |
net_ = calc_net( d, t, i, sim, param ) | |
# avoid 0 * -Inf error | |
- net_adjusted_ = net_ + 1e-12 .* (transpose(Prob_o_i) .== 0) | |
+ net_adjusted_ = zeros(Prob_o_i) |
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
diff --git a/calc_net.jl b/calc_net.jl | |
index 2d4c480..6600cf7 100644 | |
--- a/calc_net.jl | |
+++ b/calc_net.jl | |
@@ -7,10 +7,10 @@ function calc_net( d::Int64, t::Int64, i::Int64, sim::Sim, param::Param ) | |
w0 = sim.w[d, 1, i] | |
# retrieve some history | |
- b_hist_1 = sim.b[d, 1:t, i, 1] | |
- b_hist_3 = sim.b[d, 1:t, i, 3] |
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
# Insert a value into a sorted list | |
# Uses linear search | |
# Returns 1 if a new value was inserted else 0 | |
function insertsorted!(listrow, listval, row, val) | |
if isempty(listrow) | |
insert!(listrow, 1, row) | |
insert!(listval, 1, val) | |
return 1 | |
end | |
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
define %jl_value_t* @julia_collect_21980(%LinSpace*) { | |
top: | |
%1 = alloca [3 x %jl_value_t*], align 8 | |
%.sub = getelementptr inbounds [3 x %jl_value_t*]* %1, i64 0, i64 0 | |
%2 = getelementptr [3 x %jl_value_t*]* %1, i64 0, i64 2 | |
store %jl_value_t* inttoptr (i64 2 to %jl_value_t*), %jl_value_t** %.sub, align 8 | |
%3 = getelementptr [3 x %jl_value_t*]* %1, i64 0, i64 1 | |
%4 = load %jl_value_t*** @jl_pgcstack, align 8 | |
%.c = bitcast %jl_value_t** %4 to %jl_value_t* |
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
function _dense2sparsevec{Tv,Ti}(s::AbstractArray{Tv}, initcap::Ti) | |
# pre-condition: initcap > 0; the initcap determines the index type | |
n = length(s) | |
nzind = Array(Ti, initcap) | |
nzval = Array(Tv, initcap) | |
c = 0 | |
@inbounds for i = 1:n | |
v = s[i] | |
if v != 0 | |
push!(nzind, i) |
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
julia> reduce_col(A, x, j) | |
/tmp/tmptdytgh/cgen_output0.cpp(32): error: expected an expression | |
GenSym0 = A.ARRAYELEM(,col); | |
^ | |
/tmp/tmptdytgh/cgen_output0.cpp(32): error: no operator "=" matches these operands | |
operand types are: j2c_array<double> = double | |
GenSym0 = A.ARRAYELEM(,col); | |
^ |
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
#include <omp.h> | |
#include <stdint.h> | |
#include <float.h> | |
#include <limits.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include "/home/kristoffer/.julia/v0.4/ParallelAccelerator/src/../deps/include/j2c-array.h" | |
#include "/home/kristoffer/.julia/v0.4/ParallelAccelerator/src/../deps/include/pse-types.h" | |
void _preduce_col2p13088( j2c_array< double > & A, j2c_array< double > & x, int64_t col, double * __restrict ret0) |
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
#include <omp.h> | |
#include <stdint.h> | |
#include <float.h> | |
#include <limits.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include "/home/kristoffer/.julia/v0.4/ParallelAccelerator/src/../deps/include/j2c-array.h" | |
#include "/home/kristoffer/.julia/v0.4/ParallelAccelerator/src/../deps/include/pse-types.h" | |
void _preduce_col2p13088( j2c_array< double > & A, j2c_array< double > & x, int64_t col, double * __restrict ret0) |