I am trying to do interpolation on irregular grids using Interpolations.jl.
>From its documentation:
Currently its support is best for B-splines and also supports irregular
> grids.
Anyone knows how I get the irregular grids to work? Basically, I have some
triples (x,y,u) where x,y is a
According to
http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-fields-with-abstract-containers,
this is the way to go for types with a container field:
type MyVector{T<:AbstractFloat,V<:AbstractVector}
v::V
MyVector(v::AbstractVector{T}) = new(v)
end
Accord
to
http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-fields-with-abstract-containers,
this is the way to go for types with a container field:
type MyVector{T<:AbstractFloat,V<:AbstractVector}
v::V
MyVector(v::AbstractVector{T}) = new(v)
end
f = open("myfile.csv","w")
for i in 1:length(data)
write(f,@sprintf("%20.16f\n",data[i]))
end
close(f)
shell> cat myfile.csv
-0.5000
0.
-0.21819900
0.15396700
-0.17899000
0.12671700
-0.02243270
nice solution, thanks!
Op dinsdag 26 april 2016 18:13:22 UTC+2 schreef Steven G. Johnson:
>
>
>
> On Tuesday, April 26, 2016 at 11:07:45 AM UTC-4, Pieterjan Robbe wrote:
>>
>> Is it possible to export all values of an an enum defined inside a module?
>> That is, with
Is it possible to export all values of an an enum defined inside a module?
That is, without rewriting all values after 'export'.
julia> module Compass
export WindDirection
@enum WindDirection north east south west
end
julia> using Compass
julia> WindDirection
Compass.WindDirection
I think you need to specify the path that points to the module, not just the
module name.
No, not really. SharedArrays do only support bitstypes. I have an application
where the function to be executed in parallel depends on some fixed data (some
constants, a dict, some arrays, etc.) I would like to replace my @parallel for
loop by @everywhere (because of the reuse of my cholesky
written.
> E.g.:
>
> ```
> julia> using Base.LinAlg.CHOLMOD.CholmodFactor
> ERROR: UndefVarError: CHOLMOD not defined
> ```
>
> Matthew
>
> On Tuesday, November 24, 2015 at 3:43:21 PM UTC, Pieterjan Robbe wrote:
>>
>> is this of any help?
>>
>> https://groups.google.com/forum/#!msg/julia-users/tgO3hd238Ac/olgfSJLXvzoJ
>>
>
does the @everywhere macro allocate extra memory to make local copies of a
matrix for every processor?
A = sprandn(1,1,0.7)
@time A = sprandn(1,1,0.7)
gives 2.422259 seconds (23 allocations: 1.565 GB, 3.77% gc time)
@everywhere A = sprandn(1,1,0.7)
@time @everywhere A =
Oh genius ;) why didn't I come up with that myself? Thanks a lot!
Why can't I parse a function evaluation of a function defined within the
scope of another function?
i.e., the following terminates with an UndefVarError: bar not defined:
*function* foo()
*function* bar()
x
end
*return* eval(parse("bar()"))
end
x = 7
foo()
However, I can do
Oops looks like I was timing the wrong thing :) Sorry!
My results are the similar now (on a 2014 Mac, Julia 0.4):
time = 0.5201348707
time = 0.0634930367
Thanks a lot!
Op dinsdag 24 november 2015 19:20:15 UTC+1 schreef Steven G. Johnson:
>
> (Note that I'm using Julia 0.4 on a 2012 Mac.)
>
Matlab was running multithreaded, the single-threaded version (LASTN =
maxNumCompThreads(1)) gives time = 0.3449, still better. The Julia-version
where I store the matrices in an Array now gives time = 0.4078, better than
the previous Julia-version but still not what I would expect.
Thanks for the fast response, that explains a lot. I don't see the 7x
speedup on my machine though, but probably the problem is too small to see
significant differences.
Of course :) I also increased the number of experiments (100 instead of 10)
and discarded the first entry of the result. When using Steven's function,
the results are more or less comparable.
mean min max
Matlab0.39550.34700.4978
Julia 0.4669
That makes sense :) Is there a workaround? I need to define some (global
constant) variables, Z1, Z2, Z3 etc. (that's where the parsing comes from) by
calling a function (bar) that does something with data defined in foo(). I'd
like to keep this inside a single function, since it's the
is this of any help?
https://groups.google.com/forum/#!msg/julia-users/tgO3hd238Ac/olgfSJLXvzoJ
Consider the problem of taking a linear combination of m (n x n)-matrices
stored in a (n x n x m)-array A. The weights are stored in a length-m vector
w.
In Matlab, we can accomplish this by
n = 100;
m = 1;
A = rand(n,n,m);
y = randn(1,m);
times = zeros(1,10);
for cntr = 1:10
19 matches
Mail list logo