Re: [julia-users] Updated performance tips?

2016-11-22 Thread Mauro
> Harish > > > > > On Sat, Nov 19, 2016 at 8:32 PM, Mauro <mauro...@runbox.com> wrote: > >> On Sat, 2016-11-19 at 20:48, Harish Kumar <harish.kuma...@gmail.com> >> wrote: >> > Thank you. I agree on python.. but my question was did they update

Re: [julia-users] mismatching types (confusion matrix)

2016-11-20 Thread Mauro
On Sat, 2016-11-19 at 12:46, Sebastian wrote: > I am new to julia so i might ask a strange question. > So far i've been programming quite smoothly, but type managing leads me > astray. Good to have you on board! Note that most discussion has moved to

Re: [julia-users] Updated performance tips?

2016-11-19 Thread Mauro
t julia development pace. > > On Sat, Nov 19, 2016 at 7:38 PM, Mauro <mauro...@runbox.com> wrote: > >> On Sat, 2016-11-19 at 18:36, Harish Kumar <harish.kuma...@gmail.com> >> wrote: >> > Will it support Python 3.4 ? I am calling this from pyjulia interface >>

Re: [julia-users] Updated performance tips?

2016-11-19 Thread Mauro
t; On Nov 19, 2016 4:58 PM, "Mauro" <mauro...@runbox.com> wrote: > >> Julia 0.3.12, that's a stone-age version of Julia. You should move to 0.5! >> >> On Sat, 2016-11-19 at 16:42, Harish Kumar <harish.kuma...@gmail.com> >> wrote: >> >

Re: [julia-users] Updated performance tips?

2016-11-19 Thread Mauro
Julia 0.3.12, that's a stone-age version of Julia. You should move to 0.5! On Sat, 2016-11-19 at 16:42, Harish Kumar wrote: > I am using Version 0.3.12 calling from python (pyjulia). I do LME fit with > 2.8 M rows and 60-70 Variables. It is taking 2 hours just to model

Re: [julia-users] Project organization and variable scope question

2016-11-19 Thread Mauro
Welcome to Julia! Without having read your post in detail, your example looks like your using global variables to hold the state as you're not passing around anything. Apart from bad style in general, in Julia this is also bad for performance (read [1]). The compiler cannot work well with

Re: [julia-users] problem when include code in Julia

2016-11-17 Thread Mauro
After your cd(...) command run: julia> readdir() It will give a list of files in the directory. Check that your file is there. If not then that is rather strange. On Thu, 2016-11-17 at 11:50, Monica Deng wrote: > I kept meeting this problem when try to include codes

Re: [julia-users] Re: Syntax sugar for composite type decomposition?

2016-11-16 Thread Mauro
On Wed, 2016-11-16 at 14:02, FANG Colin <colinf...@gmail.com> wrote: > Macro seems to have answered this in a different thread > https://github.com/mauro3/Parameters.jl lol: Yes that package contains "macros" but my name is Mauro :-) > On Wednesday, November 16, 201

Re: [julia-users] Good way to organize constants?

2016-11-16 Thread Mauro
Checkout my package: https://github.com/mauro3/Parameters.jl. Maybe of use. On Wed, 2016-11-16 at 13:18, FANG Colin wrote: > Say, I have a few constants > > const VTYPE_BINARY = 'B' > const VTYPE_INTEGER = 'I' > const VTYPE_CONTINUOUS = 'C' > > What's a good way to have a

Re: [julia-users] Handling non-convergence in roots.jl

2016-11-10 Thread Mauro
On Thu, 2016-11-10 at 18:54, Joaquim Masset Lacombe Dias Garcia wrote: > I am running a sequence of root finding functions in a loop. > For my problem the basic fzero always work. > > However, using Newtons method is very useful because it is very fast when > it

Re: [julia-users] most generic way to request iterable type as input

2016-11-08 Thread Mauro
There is no proper way to do this. But note that your suggestion below is not any more performant than just not typing the field. You could check in the constructor whether the type can be iterated on: immutable Test{T} a::T function Test(a) @assert eltype(a)<:Integer tmp = [aa in

Re: [julia-users] Re: How to built an array with some keys of a dictionary ?

2016-11-07 Thread Mauro
On Mon, 2016-11-07 at 15:27, Fred wrote: > Hi Steven, > > > I also tried a = Array{String}() unfortunately it produces errors as well. Array{String}(0) works. The other creates a zero-dimensional vector (just like a scalar) to which you cannot push. > julia> a =

Re: [julia-users] Multiple dispatch algorithm.

2016-11-04 Thread Mauro
Have a read of: https://github.com/JeffBezanson/phdthesis/blob/master/main.pdf (Note that multiple dispatch is not a 1.0 thing, it was there from the beginning.) On Fri, 2016-11-04 at 16:22, Ford O. wrote: > Hi, > > I have watched the Julia 1.0 video where Stefan briefly

Re: [julia-users] Re: Cost of @view and reshape

2016-11-01 Thread Mauro
Cool! On Tue, 2016-11-01 at 10:09, Alexey Cherkaev wrote: > The package is available at https://github.com/mobius-eng/RadauBVP.jl > > I haven't put it into METADATA yet. I would like to improve documentation > and add some tests before doing this. > > However, it is

Re: [julia-users] Profile.print() options for easier reading of profile output data

2016-10-27 Thread Mauro
Lars and I once put a tool together which writes the info into a .pro file, similar to memory profiling with a .mem file. Never made it into a PR but maybe of use: https://github.com/mauro3/ProfileFile.jl On Tue, 2016-10-25 at 23:36, Angel de Vicente wrote: >

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Mauro
you must have missed Julia 0.4 which told you: _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.7

Re: [julia-users] Base.take deprecated

2016-10-26 Thread Mauro
`take` is deprecated on Julia master but not 0.5. Unless you have a good reason to run Julia-master, you should use the current stable release Julia-0.5 where `take` is not deprecated. Also note that packages will likely not keep up to date with Julia-master. Thus if you do use Julia-master

Re: [julia-users] Trait for exactness of numbers

2016-10-25 Thread Mauro
You can use SimpleTraits.jl for this: using SimpleTraits # Using Jeffrey's function, define good defaults: function isexact{X}(::Type{X}) if X<:Integer || X<:Rational true elseif X<:Complex isexact(real(X)) else false end end @traitdef IsExact{X}

Re: [julia-users] Arrays with custom indices examples?

2016-10-24 Thread Mauro
I think you have to make your own type. You can't just request that ordinary arrays use different indexing. On Mon, 2016-10-24 at 20:34, Angel de Vicente wrote: > Hi, > > Isaiah Norton writes: >> mg = zeros(Int,(0:4,0:4)) >> >>

Re: [julia-users] Named for loops?

2016-10-24 Thread Mauro
On Mon, 2016-10-24 at 15:49, Milan Bouchet-Valat wrote: > Le lundi 24 octobre 2016 à 08:05 -0400, Isaiah Norton a écrit: >> >> >> On Monday, October 24, 2016, Angel de Vicente > gmail.com> wrote: ... >> > Is it possible now (or in the near future) to

Re: [julia-users] use macros like a preprocessor directive?

2016-10-24 Thread Mauro
0-24 at 11:47, Florian Oswald <florian.osw...@gmail.com> wrote: > Ok. any suggestions how to get close to the C preprocessor behaviour though? > > On Monday, 24 October 2016 11:13:18 UTC+2, Mauro wrote: >> >> On Mon, 2016-10-24 at 10:37, Florian Oswald <florian...@gmail.

Re: [julia-users] use macros like a preprocessor directive?

2016-10-24 Thread Mauro
On Mon, 2016-10-24 at 10:37, Florian Oswald wrote: > I have something that this in C++ I would write like > > double f(double x){ > // do something with x > #ifdef MACROVAR > // do something else with x > #endif > return(x) > } > > I was trying to

Re: [julia-users] Re: Does new "dot" syntax fuse?

2016-10-21 Thread Mauro
On Fri, 2016-10-21 at 09:51, Alexey Cherkaev wrote: > Ay, how many times I've done it! Still forget about global variables! > > OK, I see now about `.+` and friends. As a work-around until 0.6: If you use the functional form of binary operators then they get fused too:

Re: [julia-users] iterator trait

2016-10-19 Thread Mauro
sers to manually add or remove types from the IsIterable trait if method_exists hits 8959. Let me know if you need help. Mauro On Wed, 2016-10-19 at 19:57, David Anthoff <anth...@berkeley.edu> wrote: > Is there some way to find out whether a type can be iterated? I'm looking > fo

Re: [julia-users] product of Int64 and Float64 is Int64

2016-10-19 Thread Mauro
On Wed, 2016-10-19 at 13:11, Michele Zaffalon wrote: > I am confused by the type of the result of `1.*80`, which is `Int64`, despite > the fact that `1.` is `Float64`, and that `Float64(1)*80` is a `Float64`: No this is parsed as 1 .* 80. Try 1.0*80 > julia>

Re: [julia-users] Re: Any 0.5 performance tips?

2016-10-14 Thread Mauro
1, 1) > @time test6(A6, 1, 1, 1, 1, 1, 1) > @time test6_fast(A6, 1, 1, 1, 1, 1, 1) > > > test6 takes 0.01s in 0.4 and takes 15s in 0.5. Using a linear index fixes > the problem. > > On Friday, September 30, 2016 at 2:30:02 AM UTC-4, Mauro wrote: >> >> On Fri,

Re: [julia-users] list all methods on certain datatype

2016-10-14 Thread Mauro
Try: help?> methodswith search: methodswith methodswith(typ[, module or function][, showparents]) Return an array of methods with an argument of type typ. The optional second argument restricts the search to a particular module or function (the default is all modules, starting from

Re: [julia-users] Type stability of function in composite types

2016-10-14 Thread Mauro
For Julia to infer types it needs to know the exact type of the function. Try this: type Foo{F<:Function} f::F y::Array{Float64, 1} x::Array{Float64, 2} end On Fri, 2016-10-14 at 13:26, Giuseppe Ragusa wrote: > I am failing to understand why the following code

Re: [julia-users] shared array of user defined type

2016-10-14 Thread Mauro
On Fri, 2016-10-14 at 09:41, Alexandros Fakos <alexandrosfa...@gmail.com> wrote: > Thank you Mauro. If I understand correctly, this means that in SharedArrays > I cannot use immutable types whose fields contain arrays. Is that right? > Thanks a lot, > Alex Yes. You can

Re: [julia-users] shared array of user defined type

2016-10-14 Thread Mauro
On Fri, 2016-10-14 at 00:02, Alexandros Fakos wrote: > Hi, > > Is there a way to create a shared array of a user defined composite > type? Yes, but only for isbits types, i.e. immutables which do not contain non-immutable fields. Otherwise you could look into the new

Re: [julia-users] python-like generators?

2016-10-13 Thread Mauro
Isn't this the same as tasks in Julia? http://docs.julialang.org/en/release-0.5/stdlib/parallel/ Although, note that their performance is not on par with start-next-done iteration. On Thu, 2016-10-13 at 14:46, Neal Becker wrote: > julia-0.5 supports generator expressions,

Re: [julia-users] Question about type ambiguity

2016-10-12 Thread Mauro
On Wed, 2016-10-12 at 21:23, Mauro <mauro...@runbox.com> wrote: > On Wed, 2016-10-12 at 20:49, Yichao Yu <yyc1...@gmail.com> wrote: >> On Wed, Oct 12, 2016 at 2:41 PM, Mauro <mauro...@runbox.com> wrote: >>> However, somewhat similar, this does not error: &g

Re: [julia-users] Question about type ambiguity

2016-10-12 Thread Mauro
On Wed, 2016-10-12 at 20:03, Yichao Yu wrote: > On Wed, Oct 12, 2016 at 1:22 PM, esproff wrote: > >> Consider the code: >> >> abstract AbstractFoo >> >> type Foo <: AbstractFoo >> end >> >> f(x::AbstractFoo, y::Integer) = "method 1" >> f(x::Foo, y::Real) =

Re: [julia-users] collecting multiple vectors from infinite iterator

2016-10-12 Thread Mauro
Somewhat off topic, as you seem to be dealing with ragged arrays. Are you aware of https://github.com/mbauman/RaggedArrays.jl ? Also there are references to other, older implementations: https://github.com/mbauman/RaggedArrays.jl/issues/2 On Wed, 2016-10-12 at 16:16, Tamas Papp

Re: [julia-users] how to do push! on a fieldname?

2016-10-10 Thread Mauro
Try for fl in fieldnames(myt) push!(getfield(myt,fl), 0.) end `fieldnames` returns the name of the field as a symbol, thus your error. On Mon, 2016-10-10 at 16:41, K leo wrote: > I hope to expand all arrays in a type using something like the following: > >

Re: [julia-users] Generic Linux binaries for julia-0.4.6

2016-10-01 Thread Mauro
On Sat, 2016-10-01 at 10:38, amik...@gmail.com wrote: > Great, a bit ashamed I didn't even try that... Thank you Mauro. No worries, if I recall correctly, I know because I had asked too...

Re: [julia-users] Generic Linux binaries for julia-0.4.6

2016-09-30 Thread Mauro
Adapting the links found on http://julialang.org/downloads/oldreleases.html should work. E.g.: https://s3.amazonaws.com/julialang/bin/winnt/x64/0.4/julia-0.4.7-win64.exe to https://s3.amazonaws.com/julialang/bin/winnt/x64/0.4/julia-0.4.6-win64.exe On Fri, 2016-09-30 at 23:15,

Re: [julia-users] Re: eval in current scope

2016-09-30 Thread Mauro
On Fri, 2016-09-30 at 00:53, Marius Millea wrote: > I think there's at least once scenario where eval-in-a-macro is not a > mistake, mainly when you want to generate some code that depends on 1) some > passed in expression and 2) something which can only be known at

Re: [julia-users] Re: eval in current scope

2016-09-30 Thread Mauro
You could do it like so: A macro which defines a type-specific version @self_MyType of your @self macro at the definition of the type: @with_self type MyType x end Then use that generated macro when defining the function: @self_MyType function inc() x += 1 end This avoids any at little

Re: [julia-users] Re: Any 0.5 performance tips?

2016-09-30 Thread Mauro
On Fri, 2016-09-30 at 03:45, Andrew wrote: > I checked, and my objective function is evaluated exactly as many times > under 0.4 as it is under 0.5. The number of iterations must be the same. > > I also looked at the times more precisely. For one particular function call > in

Re: [julia-users] Error printing for too many ouputs

2016-09-29 Thread Mauro
On Thu, 2016-09-29 at 10:09, DNF wrote: > I recently spent an unreasonable amount of time figuring out what my error was > in a function analogous to the following: > too_many_outputs() = rand(100, 100), zeros(100, 100) > a, b, c = too_many_outputs() > The output from this is,

Re: [julia-users] Re: Broken PyPlot... need to revert to a previous version asap.

2016-09-29 Thread Mauro
Have you tried the latest master? Pkg.checkout("PyPlot", "master") Otherwise revert to an older version and try that. I think from within Julia you'd have to edit the REQUIRE file (or is there an easier way?). Probably ~/.julia/v0.5/REQUIRE or ~/.julia/v0.4/REQUIRE, modify the line with PyPlot.

Re: [julia-users] Re: help understanding different ways of wrapping functions

2016-09-28 Thread Mauro
On Wed, 2016-09-28 at 08:50, Gunnar Farnebäck wrote: > It's normal that manually inlined code of this kind is faster than wrapped > code unless the compiler manages to see the full inlining potential. In > this case the huge memory allocations for the wrapped solutions

Re: [julia-users] metaprogramming and encapsulation

2016-09-26 Thread Mauro
This macro might work for you https://github.com/JuliaLang/DataStructures.jl/blob/8422ca9f66bfaa0f257b2bbbc8637c844d49ea68/src/delegate.jl On Mon, 2016-09-26 at 16:31, Carlo Lucibello wrote: > Hi everybody, > I'm looking for a metaprogramming trick to solve the

Re: [julia-users] Why was a fundamental indexing inconsistency introduced in 0.5?

2016-09-25 Thread Mauro
This was discussed at length here: https://github.com/JuliaLang/julia/issues/5949 And is featured in NEWS.md: https://github.com/JuliaLang/julia/blob/master/NEWS.md#julia-v050-release-notes Many languages do drop scalar-indexed dimensions, for instance Python/Numpy. On Mon, 2016-09-26 at 00:32,

[julia-users] Julia 0.4 cannot infer types in Val{}-function

2016-09-16 Thread Mauro
Consider immutable A a::Int b::Float64 end aa = A(4,5) f{ab}(aa, ::Val{ab}) = getfield(aa, ab) @code_warntype f(aa, Val{:b}()) In Julia 0.5 the inferred return type is Float64, however, in 0.4 it's Union{Int,Float64}. Is there a way to make this type stable in 0.4?

Re: [julia-users] 'which' functionality, similar to applicable

2016-09-16 Thread Mauro
Do you mean @which sin(6) ? On Fri, 2016-09-16 at 03:13, Marco Cognetta wrote: > Hi all, > > I know about methods() and applicable(), but is there a way to tell, given a > multiple dispatch method name and a possible input, which method specifically > would be called (the line number and the

Re: [julia-users] keyword arguments are distinct from positional arguments?

2016-09-16 Thread Mauro
On Fri, 2016-09-16 at 13:45, Neal Becker wrote: > In read the julialang doc, I'm getting the impression that keyword arguments > are entirely distinct from positional arguments? Yes they are distinct. Also note that keyword arguments currently carry a performance penalty, although that should

Re: [julia-users] Advice on programs with large data types

2016-09-15 Thread Mauro
The first style is fine as objects are passed by reference, i.e. there are not copies made. On Thu, 2016-09-15 at 20:15, Nathan Smith wrote: > Hi > > I'm looking for some advice for some on writing methods on large (memory-wise) > data types. Is there an overhead difference in the following two

Re: [julia-users] Re: ANN: SimpleTraits.jl

2016-09-15 Thread Mauro
This is how it naturally happens with Tim's trick but also how it makes most sense (to me). > On Wednesday, September 14, 2016 at 6:04:04 AM UTC-4, Mauro wrote: >> >> There is --at times-- some interest on this list about traits, enough >> that I thought the noise to announce the regis

[julia-users] ANN: SimpleTraits.jl

2016-09-14 Thread Mauro
There is --at times-- some interest on this list about traits, enough that I thought the noise to announce the registration of this traits package is warranted. In brief, traits group types into sets independent of the type hierarchy and let functions dispatch on those traits instead of on types.

Re: [julia-users] default type parameter?

2016-09-12 Thread Mauro
On Mon, 2016-09-12 at 16:07, Yichao Yu wrote: > On Mon, Sep 12, 2016 at 9:52 AM, Neal Becker wrote: > >> Taking the following example: >> >> type Point{T<:Real} >> x::T >> y::T >> end >> >> I can construct a Point taking the type "T"

Re: [julia-users] Julia on Research Computing Podcast RCE

2016-09-12 Thread Mauro
RCE is a excellent podcast, would be cool the hear some core-devs talking there. On Sun, 2016-09-11 at 02:29, Brock Palen wrote: > I am one half of the HPC/Research Computing podcast http://www.rce-cast.com/ > > We would like to feature Julia on the show. This takes a

Re: [julia-users] Re: Rescuing abandoned package

2016-09-07 Thread Mauro
On Sat, 2016-09-03 at 20:35, Waldir Pimenta wrote: > One problem with forks (for the case where it can be assessed that the > author has indeed abandoned the project) is that existing issues, pull > requests, stars and watchers aren't transferred to the new repo; in

Re: [julia-users] memory allocation in matrix operations

2016-09-02 Thread Mauro
On Fri, 2016-09-02 at 13:34, Jong Wook Kim wrote: > Hi Yichao, what a nice idea :) > > But even if I write in the C++ way, @time sqrt(1) yields 5 allocations of 176 > bytes, and in inner loops this could be a bottleneck. Those are just allocations for the return value of sqrt.

Re: [julia-users] Clone git repo from dropbox

2016-08-25 Thread Mauro
Whilst people do it successfully, it's probably a bad idea to have a git repo on Dropbox (corruption could occur if it gets modified from several machines). You'd have to clone it from the file system though: Pkg.clone("/path/to/drobox-folder/repo"). Cloning over https means that there needs to

Re: [julia-users] { } vector syntax is discontinued?

2016-08-22 Thread Mauro
It used to mean Any[], but not anymore (so `Any[]` is the new syntax). It was still usable in 0.4 with a deprecation warning, now in 0.5 an error is thrown. It will get a new meaning in the 0.6 release, but it is not decided for what yet. See e.g.: https://github.com/JuliaLang/julia/issues/8470

Re: [julia-users] Parent type of a parametric type

2016-08-16 Thread Mauro
On Wed, 2016-08-17 at 05:04, Cedric St-Jean wrote: > Hi, I'm writing a function to recursively traverse a heterogeneous tree of > immutables and replace certain elements of it. So far I have: > > subst(x::Number, assoc::Associative) = x > subst(x::Variable,

Re: [julia-users] Help please: how to expand dictionary into (local ?) variables with the same name as the keys and the corresponding values

2016-08-16 Thread Mauro
a module like any other. Maybe have another read of http://docs.julialang.org/en/release-0.4/manual/variables-and-scoping/ which was overhauled half a year ago. > marți, 16 august 2016, 10:18:57 UTC+2, Mauro a scris: >> >> On Tue, 2016-08-16 at 09:00, Adrian Salceanu <adrian..

Re: [julia-users] Help please: how to expand dictionary into (local ?) variables with the same name as the keys and the corresponding values

2016-08-16 Thread Mauro
On Tue, 2016-08-16 at 09:00, Adrian Salceanu wrote: > Yichao, many thanks for taking so much time to help me through this, that's > very kind. > >> It has nothing to do with "compiling" a module. I'm just saying it's not > the right API. > I understand your point now,

Re: [julia-users] map(mean, zip(v...)) doesn't scale

2016-08-10 Thread Mauro
Whilst this does not explain your observation, note that splatting large vectors is bad for performance. On Wed, 2016-08-10 at 11:33, Tamas Papp wrote: > I was benchmarking code for calculating means of vectors, eg > > v = [rand(100) for i in 1:100] > > m1(v) = map(mean,

Re: [julia-users] Methods inside type definition, use of "self" ?

2016-08-10 Thread Mauro
Yes, this is correct. The difference to classic OO programming languages is that in Julia a method is not "owned" by a type. Instead it can be owned by several types as dispatch is on all arguments. In python and other OO dispatch is only on the first (usually implicit) argument. For your

Re: [julia-users] Re: Unexpected Performance Behaviour

2016-08-02 Thread Mauro
On Tue, 2016-08-02 at 14:07, Mauro <mauro...@runbox.com> wrote: > Oh, I see, this is in this issue: > https://github.com/JuliaLang/julia/issues/17751 It's not, after all, sorry! (a bit related though) And another wired thing, this seems to be dependent on using x^3. Running: fu

Re: [julia-users] Re: Unexpected Performance Behaviour

2016-08-02 Thread Mauro
Oh, I see, this is in this issue: https://github.com/JuliaLang/julia/issues/17751 On Tue, 2016-08-02 at 10:52, Mauro <mauro...@runbox.com> wrote: > Yes, test2 is slower on 0.4 (expected), test1 is slower on 0.5 (weird) > on my Linux (Intel) machine. Christoph is right, in 0.5

Re: [julia-users] Re: Unexpected Performance Behaviour

2016-08-02 Thread Mauro
Yes, test2 is slower on 0.4 (expected), test1 is slower on 0.5 (weird) on my Linux (Intel) machine. Christoph is right, in 0.5 these should preform the same. And certainly, no function should be 1000x slower on 0.5 than on 0.4. A quick search did not turn up a bug report:

Re: [julia-users] Re: accessing an expression's global scope from macro

2016-07-22 Thread Mauro
et instead: let @unpack aa: a sin(2pi/a*x) end (Or are you worried about performance? The extra bindings introduced are optimized away (I think).) > which seems slightly less hacky than what I'm doing but serves a similar > purpose. > > Marius > > > On Fri, Jul

Re: [julia-users] Re: accessing an expression's global scope from macro

2016-07-22 Thread Mauro
On Fri, 2016-07-22 at 01:02, Marius Millea wrote: >> FYI Mauro's package has something similar >> . >> > > Some interesting stuff in there, thanks! The problem with your `@self` and with Parameters.jl's

Re: [julia-users] Array of vectors in type definition

2016-07-18 Thread Mauro
Array{Float64}[] creates an instance of type Vector{Array{Float64}}. You need the type, probably Vector{Vector{Float64}}. On Mon, 2016-07-18 at 17:13, Ferran Mazzanti wrote: > Guys, > > today I've tried to include a vector of vectors as part of atype > definition,

Re: [julia-users] Re: JuliaCon schedule announced

2016-07-18 Thread Mauro
A request for a correction: in Keno's Gallium talk the bottom line of the screen is cut off. As most of his talk is a demo, where most things happen in the bottom line, this makes it hard to follow along. Is there any chance that this can be re-edited? On Sun, 2016-07-17 at 07:00, Tony Kelman

Re: [julia-users] Linear-Equation-System Solver("\") does not work reliably for the "Rational" Type

2016-07-15 Thread Mauro
On Fri, 2016-07-15 at 20:47, Kurolong wrote: > Hey Guys and Gals ^^ > I'm having trouble with Julia. Maybe one of you can help me out > The program i am writing requires the linear-equation-system-solver(command > "\") in the folder "Julia-0.4.5\share\julia\base\linalg". >

Re: [julia-users] New Package Looking for Contributors: VectorizedRoutines.jl

2016-07-15 Thread Mauro
e is no response from them then you should just use their useful bits in your package. M > On Friday, July 15, 2016 at 12:43:04 AM UTC-7, Mauro wrote: >> >> There is https://github.com/MatlabCompat/MatlabCompat.jl, which seems to >> have a similar aim (although sans R/Python support).

Re: [julia-users] Inherit from AbstractMatrix

2016-07-15 Thread Mauro
On Thu, 2016-07-14 at 22:53, Madeleine Udell wrote: > Convex.jl defines an abstract type AbstractExpr, from which all important > concrete types in the package are descended. We've defined a bunch of > functions that allow users to treat AbstractExprs as though they

Re: [julia-users] New Package Looking for Contributors: VectorizedRoutines.jl

2016-07-15 Thread Mauro
There is https://github.com/MatlabCompat/MatlabCompat.jl, which seems to have a similar aim (although sans R/Python support). Maybe join forces? On Fri, 2016-07-15 at 01:34, Chris Rackauckas wrote: > Hey, > After some discussion (and letting the idea hang around for a long

Re: [julia-users] Recover lost script from active command line session

2016-07-11 Thread Mauro
There might be better tricks, the best I know is that for any function which was defined you can get to its AST: julia> f() = sin(5)+7 julia> Base.uncompressed_ast(f.env.defs.func.code) :($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin # /tmp/t.jl, line 2: return (Main.sin)(5)

Re: [julia-users] Error involving LabelNode

2016-07-11 Thread Mauro
A LabelNode is a julia internal type: https://github.com/JuliaLang/julia/search?utf8=%E2%9C%93=labelnode I suspect this is a bug and you should file an issue if no-one has an answer for you. On Mon, 2016-07-11 at 11:47, Matthew Pearce wrote: > I've had a long-running job

Re: [julia-users] best practices for using Julia to generate+save Julia source code

2016-07-05 Thread Mauro
What about: immutable fromClibWithCfinalizer{ sizeofThisType, digitsofSignificand, Both } exponent ::NTuple{ Both, UInt32 ) ... end function fromClibWithCfinalizer( _ ) Both = fn( sizeofThisType, digitsOfSignificand ) fromClibWithCfinalizer{sizeofThisType, digitsOfSignificand, Both}(_)

Re: [julia-users] Only ODE, Plots

2016-06-30 Thread Mauro
The almost non-existent ODE.jl manual could sure use some love. However, your question could be answered by reading the readme or this example: http://nbviewer.jupyter.org/github/JuliaLang/ODE.jl/blob/master/examples/Simple_Differential_Equation.ipynb julia> oscillator(t, y) = [y[2], - 3* + y[1]

Re: [julia-users] New constructor syntax in 0.5

2016-06-30 Thread Mauro
Basically the transform is: move first argument to where `call` was (note that the function parameters stay): call{T,Y}(::Type{A{I,T}}, t::T, y::Y) = ... (::Type{A{I,T}}){T,Y}(t::T, y::Y) = ... On Wed, 2016-06-29 at 23:59, Yichao Yu wrote: > On Wed, Jun 29, 2016 at 5:46 PM,

Re: [julia-users] invalid redefinition of type even though the type is not redefined

2016-06-29 Thread Mauro
Also, you can put a guard around it: if !isdefined(:MyType) include("myfile.jl") end On Wed, 2016-06-29 at 21:33, Matthieu Gomez wrote: > I have a file myfile.jl with the following lines: > type MyType{T} >x::T > end > 1 + 1 > > Julia returns an error when I

Re: [julia-users] invalid redefinition of type even though the type is not redefined

2016-06-29 Thread Mauro
See https://github.com/JuliaLang/julia/issues/16424 Have a look at http://docs.julialang.org/en/release-0.4/manual/workflow-tips/ On Wed, 2016-06-29 at 21:33, Matthieu Gomez wrote: > I have a file myfile.jl with the following lines: > type MyType{T} >x::T > end > 1

Re: [julia-users] How to make a tree datastructure with vector data in JULIA ?

2016-06-29 Thread Mauro
I think you need to show us what you've tried so far. Also have a look at Datatstructures.jl for inspiration. On Wed, 2016-06-29 at 11:29, Ahmed Mazari wrote: > Hello , > > > I need to implement a tree in Julia with depth of l=3. Initially the root > node has a vector

Re: [julia-users] Re: Extending functions in Base (or another module)

2016-06-28 Thread Mauro
There is some discussion on invoke on github: https://github.com/JuliaLang/julia/pull/13123 maybe you want to weight in. On Tue, 2016-06-28 at 19:19, 'Bill Hart' via julia-users wrote: > You are a life saver. This is *precisely* what we need. Thank you for >

Re: [julia-users] vector of vectors to array

2016-06-28 Thread Mauro
julia> Vector[rand(3), rand(3), rand(3)] 3-element Array{Array{T,1},1}: [0.08082297930289717,0.4831571293164978,0.7227686419871842] [0.7376841239302636,0.6150435898281146,0.1474762464521686] [0.9699744293150396,0.19770809574045556,0.638619038137211] julia> hcat(ans...) 3x3 Array{Float64,2}:

Re: [julia-users] ODE.jl - backwards (negative in time) integration

2016-06-24 Thread Mauro
This is a bug, could you file an issue? Thanks! Note that some solvers, even some of the Runge-Kutta family work, for instance ode78, ode45_fe, ode21 or ode23s. On Fri, 2016-06-24 at 20:48, Chris <7hunderstr...@gmail.com> wrote: > Hello, > > I came across this issue (recreated here using example

Re: [julia-users] indexing over `zip(collection1, collection2)`

2016-06-24 Thread Mauro
On Fri, 2016-06-24 at 05:26, Rafael Fourquet wrote: >> My recollection is that part of the indexing interface in Julia (just by >> convention) is that indexing should be of O(1) (or close to that) >> complexity. > > As the OP suggested, this could still be the case, the

Re: [julia-users] indexing over `zip(collection1, collection2)`

2016-06-23 Thread Mauro
My recollection is that part of the indexing interface in Julia (just by convention) is that indexing should be of O(1) (or close to that) complexity. Iterable things, in general, have O(n) complexity to access the n-th element, because you have to traverse the data to get there (the classic

Re: [julia-users] Re: Help with a macro

2016-06-22 Thread Mauro
A REPL session of mine trying to figure out how to make that macro would look something like this: julia> ex = :(f(x, y, z, zz)) # this is what is passed into the macro :(f(x,y,z,zz)) julia> xdump(ex) # xdump is nice to get an overview of nested datastructures Expr head: Symbol call args:

Re: [julia-users] Re: Function in module templated on types defined later

2016-06-20 Thread Mauro
In that case, you need traits. In fact the motivating example I gave in my JuliaCon talk on this subject last year matches yours almost exactly: https://youtu.be/j9w8oHfG1Ic Anyway, probably you want to hand-code the Holy-traits. The example I give in my talk modified to fit your example:

Re: [julia-users] Function in module templated on types defined later

2016-06-20 Thread Mauro
On Mon, 2016-06-20 at 14:06, amik...@gmail.com wrote: > Hi, > > module M > function f{T1}(x::T1) return x.a end > function f{T2}(x::T2) return x.b + 1 end > export f > end This should probably read: module M function f(x::T1) return x.a end function f(x::T2) return x.b + 1 end export f end As

Re: [julia-users] error using getnodecount(m:: Model)

2016-06-20 Thread Mauro
Better post this to the julia-opt mailing list. On Mon, 2016-06-20 at 11:27, hililielal...@gmail.com wrote: > Hello, > > Does Cbc support the method getnodecount()? > I can use other methods, but when using getnodecount() I get the error: > LoadError: MethodError: 'getnodecount' has no method

Re: [julia-users] Re: Unexpected error on 1st order ODE using ODE package

2016-06-20 Thread Mauro
fore...) > On Monday, June 20, 2016 at 9:00:28 AM UTC+1, Mauro wrote: >> >> I'd say this is a bug. `sin(5)` works, so `ode23(f, 0, [0,1])` should >> work too by promoting `y0=0` and `tspan=[0,1]` to appropriate types. >> Note that `eltype(tspan)` needs to be promot

Re: [julia-users] A question of style: type constructors vs methods

2016-06-20 Thread Mauro
I think you should use the constructors if the user expects to construct a certain type, e.g. `Dict()`. Conversely if the user cares about the action then use a function, e.g.: julia> keys(Dict()) Base.KeyIterator for a Dict{Any,Any} with 0 entries here I don't care about the type, I just want

Re: [julia-users] Re: Unexpected error on 1st order ODE using ODE package

2016-06-20 Thread Mauro
I'd say this is a bug. `sin(5)` works, so `ode23(f, 0, [0,1])` should work too by promoting `y0=0` and `tspan=[0,1]` to appropriate types. Note that `eltype(tspan)` needs to be promoted to some kind of floating point number; I don't think rationals make sense for differential-equations. I pushed

Re: [julia-users] Re: ANN: Documenter.jl

2016-06-18 Thread Mauro
As others in this thread, I was confused by (and thus ignored) those documentation badges the first time I saw them, even though I was using the travis badges regularly. To help badges-challenged people like myself, maybe add a normal link too? In fact, I like the setup: all the badges along the

Re: [julia-users] Syntax for composite type constructors

2016-06-17 Thread Mauro
On Fri, 2016-06-17 at 18:19, Jacob Quinn wrote: > There's been a long-open issue for this here: > https://github.com/JuliaLang/julia/pull/6122 > > Not sure why it's never been implemented as I don't think anyone was really > opposed. I imagine if people make a big push for

Re: [julia-users] Conditional Definition of Functions?

2016-06-16 Thread Mauro
nd >> return f >> end >> f = g(true) >> f() # Returns 3 >> >> Even more interestingly, g(false) in another REPL session gives an error: >> "f not defined". So in this setup you either get the second function (if >> you ask for the

Re: [julia-users] Conditional Definition of Functions?

2016-06-16 Thread Mauro
On Thu, 2016-06-16 at 07:32, Chris Rackauckas wrote: > There seems to be an interesting change between v0.4.5 and v0.5. Take a > look at the following code: > > if largeFluctuations > function σ(y,t) > dσ = zeros(19) > dσ[1] = noiseLevel*1.5y[1] >

Re: [julia-users] eval() uses global name scope

2016-06-15 Thread Mauro
On Wed, 2016-06-15 at 20:37, Ford O. wrote: > vars() = (:x, :y, :z) > > foo(x, y, z) = eval(vars()[1]) + eval(vars()[2]) + eval(vars()[3]) > > x = y = z = 1 > > @show foo(10, 10, 10) > > > foo(10, 10, 10) = 3 > > > > Is this intended? Yes

Re: [julia-users] Re: Packages Distances problem with Distances.Jaccard : very slow

2016-06-13 Thread Mauro
> function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1}) > num = 0. > den = 0. > for I in 1:length(a) > @inbounds ai = a[I] > @inbounds bi = b[I] > num = num + min(ai,bi) > den = den + max(ai,bi) > end > 1. - num/den > end > > > > function

Re: [julia-users] Question in using JuMP

2016-06-13 Thread Mauro
Better repost this to julia-opt list. Mauro On Mon, 2016-06-13 at 04:27, JC <iky...@gmail.com> wrote: > I have been trying to use JuMP for an optimization problem and ran into > many issues. > > 1. I made my own function called myf and try to register that so that I can

  1   2   3   4   5   6   7   >