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] > dσ[18]= noiseLevel*6y[18]

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 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 > read it into my objective

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

2016-06-13 Thread Mauro
I am not sure I quite understand. But it looks like you know how to improve the Jaccard distance code, so why not make a pull request at Distances.jl? > function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1}) >num = 0 >den = 0 >for i in 1:length(a) >

Re: [julia-users] Re: Plotting lots of data

2016-06-13 Thread Mauro
I also found that GR is a lot faster than PyPlot, so give that a try. On Mon, 2016-06-13 at 09:57, Andreas Lobinger wrote: > Hello colleague, > > On Sunday, June 12, 2016 at 10:31:06 PM UTC+2, CrocoDuck O'Ducks wrote: >> >> Hi there! >> >> I have been experimenting a little with many plotting pac

Re: [julia-users] one lvl return kw

2016-06-10 Thread Mauro
You're probably looking for @goto ;-) Although break may be what you want: julia> for i=1:10 for j=1:10 if j==3 break end end println(i,j) end 13 23 33 43 53 63 73 83 93 103 On Fri, 2016-06-10 at 21:26, Ford O. wrote: > Why is there no keyword t

Re: [julia-users] Differential Equations Package

2016-06-10 Thread Mauro
On Fri, 2016-06-10 at 17:13, Chris Rackauckas wrote: ... > Thanks for helping me get more focus! Do you plan on moving to ODE.jl to > JuliaMath? When I hit the major release, I think we should be considering > bringing us together under some organization. Thanks for the good discussion! I don't

Re: [julia-users] Re: Status of FEM packages

2016-06-10 Thread Mauro
Thanks for the update, looks good! On Thu, 2016-06-09 at 23:18, Jukka Aho wrote: > Hi, > > JuliaFEM developer here. > > About performance. I recently measured FEM problem assembly time vs. solver > time to find out the performance of JuliaFEM. Point was to find out when > assembly time is less th

Re: [julia-users] Re: ArrayFire.jl - GPU Programming in Julia

2016-06-10 Thread Mauro
here a way around this? > > My computer/version details: > > Processor: 3,1 GHz Intel Core i7 > > Memory: 16 GB 1867 MHz DDR3 > > Graphics: Intel Iris Graphics 6100 1536 MB > OS: El Capitan, 10.11.3 (15D21) > > Thanks, > > Robert Feldt > > Den fredag 10 juni

Re: [julia-users] Re: ArrayFire.jl - GPU Programming in Julia

2016-06-10 Thread Mauro
You need to install the arrayfire library by hand: https://github.com/JuliaComputing/ArrayFire.jl#installation If done already, check the trouble shooting section. On Fri, 2016-06-10 at 12:10, Fred wrote: > Hi ! > > Thank you for this great package ! I tried to install it on Julia 0.4.5 but I >

Re: [julia-users] Differential Equations Package

2016-06-10 Thread Mauro
rised you guys don't have a DP78 method, but it > shouldn't take more than minutes to plop that tableau over there. Yes, we only had the Fehlberg 78. Not anymore though https://github.com/JuliaLang/ODE.jl/pull/101, thanks! >> A few more comments in-line below. Cheers! Mauro &

Re: [julia-users] Differential Equations Package

2016-06-09 Thread Mauro
st to just have your own package(s). However, if you code up more ODE/DAE solvers, it would be great if those are usable without all the machinery of DifferentialEquations.jl and if they eventually make into ODE.jl (or some other "standard" ODE package). A few more comments in-line below.

Re: [julia-users] Differential Equations Package

2016-06-08 Thread Mauro
s put in. > > Also I love your work especially mauro :) > > Anyway back to lurking. > > Gabriel

Re: [julia-users] Differential Equations Package

2016-06-08 Thread Mauro
On Wed, 2016-06-08 at 19:11, digxx wrote: > Since Im not really up to date can anyone in 2 sentences explain to me what > the > issue with the package ODE.jl is? > Is it the interface ppl dont like or what makes it so "redundant"? The issue is that ODE.jl has not moved quite at the pace many oth

Re: [julia-users] Differential Equations Package

2016-06-08 Thread Mauro
On Wed, 2016-06-08 at 18:50, Gabriel Gellner wrote: > I absolutely agree in general. I am terrified when julia code gets to fancy :) > I am largely a bear of little brain... (thos ODE.jl choice to send back array > of arrays kind of breaks this feeling for simplicity ... having to learn to do > hc

Re: [julia-users] Differential Equations Package

2016-06-08 Thread Mauro
On Wed, 2016-06-08 at 16:36, Gabriel Gellner wrote: > So much great news in this thread! I am crazy happy that ODE.jl is not dead. > As > an interested outsider it seemed like the community got gridlocked on the API > discussion. It is nice that this is not the case. I think it was more a case o

Re: [julia-users] Wrap fortran 90 interface code for DDE

2016-06-08 Thread Mauro
On Wed, 2016-06-08 at 12:02, Dupont wrote: > Thank you, that is a nice suggestion. I will try to wrap RETARD and RADAR. > > However, the structure of these fortran code seems much simpler than the > one I linked above which has kinda of a classe structure. Any idea in this > case? Are you aware o

Re: [julia-users] Differential Equations Package

2016-06-08 Thread Mauro
g Jacobians yet, but if that it planned coloring might be of interest: https://github.com/mauro3/MatrixColorings.jl Again, this has gone a bit stale (together with my PR https://github.com/JuliaLang/ODE.jl/pull/72 for which I made it) but I would be interested to revive it. Cheers, Mauro &

Re: [julia-users] Re: why not make the ternary operator into an optional binary operator?

2016-06-08 Thread Mauro
On Wed, 2016-06-08 at 11:37, Patrick Kofod Mogensen wrote: > But that is exactly what Forgy's code does > > expression && do_something Problem with this is that it is a bit cryptic. There is this related issue: https://github.com/JuliaLang/julia/issues/16389 @Anonymous: why don't you post your

Re: [julia-users] Wrap fortran 90 interface code for DDE

2016-06-08 Thread Mauro
Maybe this could give you inspiration: https://github.com/luchr/ODEInterface.jl It says in the readme: "If you want to compile the solvers yourself (perhaps with different options and/or a different compiler), then just call ODEInterface.help_solversupport for further informations (help topics) o

Re: [julia-users] Initializing a new array generates unexpected results

2016-06-06 Thread Mauro
On Tue, 2016-06-07 at 05:47, David Parks wrote: > Is there hidden logic behind this command that I don't see, or did I bump > into a genuine bug here? v0.4.5 Are you referring to the random value? help?> Array ... Array{T}(dims) constructs an uninitialized dense array with element type T. di

Re: [julia-users] Why is "collect" better than "[]"?

2016-06-06 Thread Mauro
This was discussed at length on github, have a look there. But essentially to make it easier to create vectors of vectors. On Mon, 2016-06-06 at 16:35, K leo wrote: > Why deprecate array concatenation with "[]" and suggest to use "collect"? > It requires more typing and makes code less elegant.

Re: [julia-users] Uniform syntax

2016-06-03 Thread Mauro
On Fri, 2016-06-03 at 21:23, Siyi Deng wrote: > I am neutral about 1 and 2. But I like suggestion 3. Note, suggestion 3 is currently valid syntax which is unlikely to go away: julia> (a, b, c) = [1,2,3] 3-element Array{Int64,1}: 1 2 3 julia> a 1 There is a reason for `->`.

Re: [julia-users] Re: Private Forks of Julia Repositories

2016-06-03 Thread Mauro
the github-fork as a remote: git remote add github ... git checkout my-feature-branch git push github Make PR on github. I hope this helps. > On Thursday, June 2, 2016 at 11:18:09 PM UTC-7, Mauro wrote: >> >> On Fri, 2016-06-03 at 07:58, Chris Rackauckas > > wrote: &

Re: [julia-users] Re: Private Forks of Julia Repositories

2016-06-02 Thread Mauro
On Fri, 2016-06-03 at 07:58, Chris Rackauckas wrote: > I think I will need both versions available, since the majority of the work > is public, while the private work will tend to sit around longer (i.e. > waiting to hear back from reviewers). So I'd want to be able to easily work > with the publi

Re: [julia-users] Re: Is Julia slow with large arrays?

2016-06-01 Thread Mauro
On Wed, 2016-06-01 at 14:37, DNF wrote: > Out of curiosity: My understanding has been that type instabilities are > related to the compiler not being able to predict the types of variables > based on input types, not variables simply (and predictably) changing types > during program execution. > >

Re: [julia-users] filter() function edge case, possible bug.

2016-06-01 Thread Mauro
Yes, this is a bug: ranges should behave as vectors in read-only situations. I suspect that this is on the radar of the devs already as there is quite a bit of work happening in this area. But still filing a bug report, if one does not exist yet, is probably the right thing to do. On Wed, 2016-0

Re: [julia-users] keyword arguments and anonymous function - ERROR: syntax: "begin args... kwargs... end" is not a valid function argument name

2016-05-31 Thread Mauro
esn't help > > > Le mardi 31 mai 2016 09:49:38 UTC+2, Mauro a écrit : >> >> This works on 0.5, where anonymous functions are almost like normal >> functions now. >> >> On Tue, 2016-05-31 at 09:26, Femto Trader > > wrote: >> > Hello, &g

Re: [julia-users] keyword arguments and anonymous function - ERROR: syntax: "begin args... kwargs... end" is not a valid function argument name

2016-05-31 Thread Mauro
This works on 0.5, where anonymous functions are almost like normal functions now. On Tue, 2016-05-31 at 09:26, Femto Trader wrote: > Hello, > > I'm trying to define an anonymous function > > > julia> (args...) -> begin >println("hello anonymous func with args") >end > (anonym

Re: [julia-users] doc fix: transposition operators in section highlighting difference to R

2016-05-29 Thread Mauro
It would be great if you can submit a pull request for this. It's easy: - log in on github - go to https://github.com/JuliaLang/julia/blob/master/doc/manual/noteworthy-differences.rst - click the pencil icon - edit, when finished a pull request is automatically generated. - there is some extr

Re: [julia-users] Strange behavior of sets with custom type

2016-05-27 Thread Mauro
I think you need to define hash for your type too as Set is based on Dict. Read up here: http://docs.julialang.org/en/release-0.4/stdlib/collections/?highlight=hash#associative-collections On Fri, 2016-05-27 at 09:40, Dario Prandi wrote: > Dear all, > > while experimenting with the Set collectio

Re: [julia-users] julia equivalent of python [] (aka list)

2016-05-25 Thread Mauro
On Wed, 2016-05-25 at 11:50, DNF wrote: > Is ::Array{Any, 1} the correct annotation? >>> hello(v::Vector{Any}) = println("Hello") >>> hello([2,'a']) > Hello >>> hello([2,2]) > ERROR: MethodError: no method matching hello(::Array{Int64,1}) > in eval(::Module, ::Any) at /usr/local/Cellar/julia/HEAD/

Re: [julia-users] "using PyPlot" generates many deprecations - how to proceed?

2016-05-23 Thread Mauro
I'm not sure I understand you question 100%. As Julia evolves towards a stable 1.0 version, bits of the language which change in a backward incompatible way are deprecated over two release cycles: in one release the old syntax will still work but generate the warning, in the following release the

Re: [julia-users] Re: Is it possible to use julia 0.4/0.5 on the same session ?

2016-04-22 Thread Mauro
It's fine to have several versions of julia installed. The different version don't share the packages, as you saw in those two directories. Note that not everything which works on one version, works on the other. Also the packages may be at different versions. On Fri, 2016-04-22 at 20:25, Henri

Re: [julia-users] extra constructor with optional, default value for second parameter?

2016-04-17 Thread Mauro
I wrote about this a few days ago: https://groups.google.com/d/msg/julia-users/jUMu9A3QKQQ/-ZShKvLXAwAJ It's inner vs outer constructors. Basically you have to pass in the type as a normal function argument, like e.g. `Array(Int,3)` does, or use `call` overloading: julia> Array{Int}(3) 3-element

Re: [julia-users] Re: Parametric types which add or delete fields.

2016-04-15 Thread Mauro
a string, and b and c are both integers, and then I want the > constructor to return: > > Car{Void, Void, Feature3, Void, Feature5, Feature6}(nothing, nothing, a, > nothing, b, c) > > On Friday, April 15, 2016 at 12:18:56 AM UTC-7, Mauro wrote: >> >> >> On Fr

Re: [julia-users] Re: Parametric types which add or delete fields.

2016-04-15 Thread Mauro
On Fri, 2016-04-15 at 07:28, Anonymous wrote: > OP here, > > So it looks like the consensus is to use a single type with un-used > features set to nothing. I've actually been playing around with this > approach since I posted this question. Here's what I've got: > > abstract AbstractCar > > abs

Re: [julia-users] Int or Int64

2016-04-13 Thread Mauro
Also, note that floats work the same on both 32 and 64 bit machines (and both default to making Float64). Concerning ints: use Int64 if you need them for your code to be correct, otherwise use Int. (Maybe best to just use Int64 to be on the save side?) This has been discussed on this list before

Re: [julia-users] const functions

2016-04-12 Thread Mauro
On Tue, 2016-04-12 at 13:47, Didier Verna wrote: > Mauro wrote: > >> yes, this just binds a function to a variable. This also works: >> >> julia> foo() = 1 >> foo (generic function with 1 method) >> >> julia> bar = foo >> foo (generic func

Re: [julia-users] Creating new globals

2016-04-12 Thread Mauro
On Tue, 2016-04-12 at 12:21, Didier Verna wrote: > Mauro wrote: > >> On Tue, 2016-04-12 at 11:10, Didier Verna wrote: >>> Hello, >>> >>> I'm wondering if anyone has ever seen an actual use for dynamically >>> creating a new global variable

Re: [julia-users] scoping wat

2016-04-12 Thread Mauro
Maybe you can be a bit more explicit in what you mean, examples would help too. The only bit of the scoping rules which I find a bit questionable is that functions in a local scope have soft-scope (otherwise they have hard-scope). This has been discussed on github, search for "nonlocal". On Tue

Re: [julia-users] const functions

2016-04-12 Thread Mauro
On Tue, 2016-04-12 at 11:40, Didier Verna wrote: > What's the rationale behind making "function" const? Is there a > performance reason? Yes, globals need to be const to be fast. > you can't do > > function foo() 0 end > foo = 10 > > but you can still change the function's definition (so it

Re: [julia-users] Creating new globals

2016-04-12 Thread Mauro
On Tue, 2016-04-12 at 11:10, Didier Verna wrote: > Hello, > > I'm wondering if anyone has ever seen an actual use for dynamically > creating a new global variable by using the "global" keyword from within > a local scope? https://github.com/JuliaLang/julia/blob/6b5a05eb1a029aef93f77b60bb1d745c7

Re: [julia-users] Modules and r/o

2016-04-12 Thread Mauro
On Tue, 2016-04-12 at 11:03, Didier Verna wrote: > What is the rationale behind module state being read-only from the outside? Encapsulation? Seems good to me. > Is this only be default (i.e., is there a construct to still allow > writing)? Use a function julia> module A a = 1 m

Re: [julia-users] Re: [ANN] FixedSizeDictionaries

2016-04-12 Thread Mauro
On Mon, 2016-04-11 at 22:24, Erik Schnetter wrote: > On Mon, Apr 11, 2016 at 11:07 AM, Simon Danisch wrote: >> @Christoph: arbitrarily, of course :D Joke aside, it should also use zip for >> the (keys, values) constructor (like Base does). >> @tshort: >> It can have arbitrary isbits & immutables

Re: [julia-users] reversing each row of a matrix, in place

2016-04-11 Thread Mauro
I think this functionality is missing in Base. But you can help yourself by adapting the reverse! function: julia> @less reverse!(collect(1:4)) On Mon, 2016-04-11 at 10:48, Thomas Magnusson wrote: > The in place reverse! function works of vectors: > > julia> a = collect(1:4); > julia> reverse!

Re: [julia-users] use Julia coverage info with Emacs

2016-04-11 Thread Mauro
The poor man's solution: I just manually change to julia-mode and high-lighting seems to work fine. On Mon, 2016-04-11 at 09:37, Tamas Papp wrote: > Hi, > > I am just learning about coverage tools, sorry if the question is > basic. Is there a way to use the coverage information provided by Julia

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
On Sun, 2016-04-10 at 15:24, Fred wrote: > That's true ! But why a loop is faster in a function ? :) Check out: http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-global-variables >> >> I seem to recall that your example loop was not in a function(?) If so, >> that makes it

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
> I tested my loop monre than 2 times as it is written in my post and I have > always the same results. The function Tim Holy posted is much faster, I > posted the results above :) I seem to recall that your example loop was not in a function(?) If so, that makes it lots slower. >> Probably you

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
If your array is sorted, as your example suggests, there maybe faster methods, binary search comes to mind (implemented in searchsorted). Also, if the array is unsorted but you need to look up many values, it might be worth sorting it first. Mauro On Sun, 2016-04-10 at 13:40, Fred wrote: >

Re: [julia-users] Maximum variable name length

2016-04-09 Thread Mauro
524247 julia> s= symbol(randstring(524247)); julia> s= symbol(randstring(524248)); ERROR: ArgumentError: Symbol length exceeds maximum length in symbol(::ASCIIString) at ./expr.jl:8 in eval(::Module, ::Any) at ./boot.jl:243 On Sat, 2016-04-09 at 10:52, nael...@ic.ufal.br wrote: > Hello, > > Is

Re: [julia-users] How to initialize a Matrix{T}?

2016-04-08 Thread Mauro
On Thu, 2016-04-07 at 21:27, Lucas de Almeida Carotta wrote: > How I make this code works? > > function read_matrix( data::DataType=Any, spacing=" " ) > local line::Vector{ data } = Array( data, 1 ) > local matrix::Matix{ data } = Array( Array{ data, 1 }, 1 ) > > while !eof( STDIN ) >

Re: [julia-users] state of Winston

2016-04-07 Thread Mauro
https://github.com/tbreloff/Plots.jl wraps many of the plotting packages and thus allows to use all of them with a single syntax. Maybe you should give that a spin? On Thu, 2016-04-07 at 20:42, harven wrote: > Hi, I recently upgraded to the last stable version of julia (4.5). > > I noticed that

Re: [julia-users] assignment form function with empty body

2016-04-07 Thread Mauro
Use: foo(x) = nothing Note, you're suggestion also returns `nothing`. On Thu, 2016-04-07 at 13:04, Tamas Papp wrote: > Hi, > > What's the most compact form of writing a function in assignment form > with an empty body? Eg is > > foo(x) = begin end > > the shortest? > > (context: I am using a lo

Re: [julia-users] The manual about explicit types

2016-04-06 Thread Mauro
On Wed, 2016-04-06 at 16:24, Didier Verna wrote: > I think the section on functions in the user manual should be fixed in > two places: > > - it says "The types of keyword arguments can be made explicit as > follows" which is misleading because, IIUC, every function parameter > can have an

Re: [julia-users] Weird singleton varags display

2016-04-06 Thread Mauro
On Wed, 2016-04-06 at 16:17, Didier Verna wrote: > Mauro wrote: > >> It's a tuple. >> >> foo(1,2) >> (1,2) > > and foo(1,2,3) => (1,2,3) and so on. But I still don't understand :-) Did you find: http://docs.julialang.org/en/release-0.4/manual/fu

Re: [julia-users] Weird singleton varags display

2016-04-06 Thread Mauro
> Can somebody please explain this to me: > > julia> foo(args...) = args > foo (generic function with 1 method) > > foo(1) > (1,) > > i.e., why the trailing comma ? It's a tuple. foo(1,2) (1,2)

Re: [julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread Mauro
I made https://github.com/mauro3/Parameters.jl potentially for your use-case. So instead of const g=9.81 const rho=1000.0 pressure(h) = rho*g*h you write: using Parameters @with_kw type Para{R} g::R=9.81 rho::R=1000.0 end pressure(h,p::Para) = (@unpack p: g, rho; rho*g*h)

Re: [julia-users] Re: possibility to define a type that is subtype of more than one supertype

2016-04-04 Thread Mauro
My Traits.jl package hasn't seen much love recently. It should work fine (within its limitation of being experimental) for 0.4 but I'm not sure I'll find the time to update it to 0.5 when the time comes. There is also https://github.com/mauro3/SimpleTraits.jl which is (+/-) just macro-sugar for "

Re: [julia-users] why is there no colvals function for sparse matrices in base?

2016-04-01 Thread Mauro
ind = rows[j] # perform sparse wizardry... end end > On Friday, April 1, 2016 at 2:03:31 AM UTC-7, Mauro wrote: >> >> The reason rowvals exists is to access the vector of row-indices of a >> CSC-matrix, i.e. one of the internals of CSC, to allow efficient >> iteration ov

Re: [julia-users] why is there no colvals function for sparse matrices in base?

2016-04-01 Thread Mauro
The reason rowvals exists is to access the vector of row-indices of a CSC-matrix, i.e. one of the internals of CSC, to allow efficient iteration over the non-zeros. However, there is no equivalent colvals internal, so there is little reason to do this and even less reason to encourage it. Conside

Re: [julia-users] Defining part of a function outside its module

2016-03-31 Thread Mauro
Maybe like so: julia> module Myfunc export f f(x) = g(x) * g(x) function g end end julia> using Myfunc julia> f(4) ERROR: MethodError: `g` has no method matching g(::Int64) in f at none:3 julia> Myfunc.g(x) = 2x g (generic function with 1 method) julia> f(

Re: [julia-users] Cleaner way of using Val types?

2016-03-31 Thread Mauro
I think this is fine and idiomatic julia> type A{B} x::Float64 function A(x) B::Bool # asserts that B is indeed a Bool new(x) end end julia> A(x, b::Bool) = A{b}(x) A{B} julia> A(5, true) A{true}(5.0) julia> function dothing(

Re: [julia-users] Re: Is there a performance penalty for defining functions inside functions?

2016-03-30 Thread Mauro
t; inside helper.jl > > function helper() > do stuff > return something > end > > > > On Wednesday, March 30, 2016 at 1:26:22 PM UTC+1, Christopher Fisher wrote: >> >> There might be some cases where defining functions within functions can >&

Re: [julia-users] Is there a performance penalty for defining functions inside functions?

2016-03-29 Thread Mauro
In 0.4 it is slower but this is fixed in 0.5. So I think this style is fine unless you need fast on 0.4 now. On Tue, 2016-03-29 at 18:31, Evan Fields wrote: > To keep namespaces clear and to help with code readability, I might like to > do this: > > function mainFunc() > function helper() >

Re: [julia-users] Why does the warning go away? (Or: my first Julia WAT)

2016-03-29 Thread Mauro
> # WAT: A warning about using collect()? > > julia> a = [1:3] > WARNING: [a] concatenation is deprecated; use collect(a) instead > in depwarn at deprecated.jl:73 > in oldstyle_vcat_warning at > /Applications/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib > in vect at abstractarray

Re: [julia-users] Help needed regarding INERITANCE

2016-03-23 Thread Mauro
>>> >>> println("Calling Function C...") >>> m = number(4.5) >>> println(m.x) >>> >>> >>> typealias integer Union{number} >>> >>> println("integer inherits number ") >>> println("Entering

Re: [julia-users] Help needed regarding INERITANCE

2016-03-23 Thread Mauro
intln("Calling Function B...") > m = number(10) > println(m.x) > > println("integer inherits number Calling Function C...") > m = integer(5.6) > println(m.x) > > function integer(p::Float64) #Defining Function D > z = basic() > z.x = &quo

Re: [julia-users] Re: length of tuple type

2016-03-23 Thread Mauro
That interface is still up to debate, see https://github.com/mbauman/Tuples.jl On Wed, 2016-03-23 at 12:07, Tamas Papp wrote: > I think I found another way (looking at the source): > > length(mytupletype.parameters) > > Is this something I can rely on, or some internal API that may change? > > Al

Re: [julia-users] Help needed regarding INERITANCE

2016-03-22 Thread Mauro
hread:https://groups.google.com/forum/#!topic/ > julia-dev/eA4VkFAD-yQ. Still applies today. > > On Tue, Mar 22, 2016 at 11:30 AM, kunal singh wrote: > > > > On Tuesday, March 22, 2016 at 8:43:50 PM UTC+5:30, Mauro wrote: > > > Hi

Re: [julia-users] Tools for creating presentation slides with Julia code?

2016-03-22 Thread Mauro
> On Tuesday, March 22, 2016 at 11:00:13 AM UTC-5, Mauro wrote: > > I think you can do it with Jupyter notebooks, which also work with R. > > > Are you thinking of the RISE extension (https://github.com/damianavila/ > RISE.git) for Jupyter notebooks? I couldn't s

Re: [julia-users] Tools for creating presentation slides with Julia code?

2016-03-22 Thread Mauro
I think you can do it with Jupyter notebooks, which also work with R. On Tue, 2016-03-22 at 16:46, Douglas Bates wrote: > This issue comes up in various forms from time to time. I will be giving a > presentation in a few days about mixed-effects models in R and Julia. If it > was an R-only presen

Re: [julia-users] Help needed regarding INERITANCE

2016-03-22 Thread Mauro
> Hi Mauro , > > Can you show me any example ? > I am a beginner in Julia. It would of great help for me. In Julia the number types are defined here: https://github.com/JuliaLang/julia/blob/fdbcdf78bf0106e609a8d83b9e896d2d11bae594/base/boot.jl#L156 So there are the abstract type

Re: [julia-users] Help needed regarding INERITANCE

2016-03-22 Thread Mauro
You can only inherit from abstract types. Also, first defining type number ... end and then abstract number is not possible. It cannot be both abstract and concrete. (Also note that types are by convention Captialized). So build your hierarchy only with abstract types and make concrete type

Re: [julia-users] Questions about the garbage collector

2016-03-15 Thread Mauro
>> Can I ask how recent your Julia is. I see this with Julia 0.4 and Julia 0.5 > > 0.5.0-dev+3106 > I could try 0.4 later. Yes, that's it. I can see Bill's memory behavior on 0.4.3 (starts at 130MB, goes to ~1.4GB when running doit2) but not on yesterday's 0.5 (starts at 150MB, when running doit2

Re: [julia-users] Re: [julia-dev] Re: Google Summer of Code 2016 - Ideas Page

2016-02-27 Thread Mauro
x27;t know how to proceed. Whilst I did update the GSOC ODE.jl proposal, there may also be other suitable mentors. I guess that is something to be discussed. Cheers, Mauro @Ilya: Jorge is a PhD student of the authors of TaylorSeries.jl. On Fri, 2016-02-26 at 09:21, perez...@gmail.com wrote: >

Re: [julia-users] Re: deepcopy_internal and arrays

2016-02-26 Thread Mauro
> However, could you please explain to me what is involved in updating dict? > I understand an ObjectIdDict is a hash table whose keys are object ID's. > But the documentation doesn't tell me how to generate such a key for my > object, nor what value to insert in the dict when overloading > deepcop

Re: [julia-users] Re: eachindex is much slower than normal indexing for matrices

2016-02-25 Thread Mauro
On Thu, 2016-02-25 at 15:57, J Luis wrote: > Incidentally, this errors in 0.5 (but works fine in 0.4) > > julia> s=0.0; > > julia> m=rand(1,1000); > > julia> @time for el in m >s = s + el >end > ERROR: UndefVarError: s not defined > [inlined code] from .\none:2 > in anonymous a

Re: [julia-users] Adding the same functionality / variables into many functions

2016-02-24 Thread Mauro
> this is awesome > > thanks! A small word of caution: macros can make it harder for others (or your future self) to read the code, as essentially each macro introduces a new keyword. Just something to consider when introducing a macro; awesome as they are. > On Wednesday, February 24, 2016 at 3

Re: [julia-users] is Union type a preferred way in Julia?

2016-02-24 Thread Mauro
> I know in F# people encourage Discriminated Unions, what about in Julia? I would say that Julia does not encourage them, but it is fine to use them. > I would like to do the following: > > immutable B end > immutable C end > > typealias A Union{B,C} > > function A(x::Int) > if x > 0 >

Re: [julia-users] Data structure for a "tree" matrix, for 2D monomial expansion?

2016-02-24 Thread Mauro
There is also: - https://github.com/mbauman/RaggedArrays.jl which is being developed (I think) - https://bitbucket.org/maurow/ragged.jl/ which I abandoned. If I pick it up again, I'll probably use https://github.com/mbauman/RaggedArrays.jl See also: https://github.com/mbauman/RaggedArrays.jl/

Re: [julia-users] Passing variable number of arguments from one function to another one

2016-02-23 Thread Mauro
You also need to splat when calling boo. Adding and `@show` helps to see what's going on: julia> function foo(a, b, x...) @show x boo(x...) end foo (generic function with 1 method) julia> foo(1,2,z...) x = (3,4) 12 Below does not work as x is a tuple of one tuple, which bec

Re: [julia-users] Re: Unitful.jl for physical units

2016-02-18 Thread Mauro
Concerning exchange rates, this is a good read: http://www.mathstat.dal.ca/~selinger/accounting/tutorial.html#4 In particular the referenced section. On Thu, 2016-02-18 at 21:30, Jeffrey Sarnoff wrote: > I am thinking about how Currencies would fit with software for handling SI > and other physic

Re: [julia-users] ANN CustomREPLComepletions - custom string completions in function arguments (HDF5, NetCDF...)

2016-02-18 Thread Mauro
> Sounds very useful! I have a scenario that probably fits... When using > PyCall I always find myself pressing tab to see what methods are defined on > a python object: > > "obj[:get_something]()["... Crap... Gotta look at the docs... > > It would be awesome if you gave a quick how-to for somethin

Re: [julia-users] Re: Blog-post on how to make package documentation

2016-02-17 Thread Mauro
Actually, Mike, is there a way to sort the API docs? Alphabetical or to some given order? On Wed, 2016-02-17 at 17:44, Michael Hatherly wrote: > Thanks for writing that up Mauro and also the shout-out :) Worth noting > Mike Innes' important work in getting the docsystem integrated

Re: [julia-users] Re: Blog-post on how to make package documentation

2016-02-17 Thread Mauro
Mike and Tom, thanks! And yes, the other Mike needs mentioning too, I updated that footnote. On Wed, 2016-02-17 at 17:44, Michael Hatherly wrote: > Thanks for writing that up Mauro and also the shout-out :) Worth noting > Mike Innes' important work in getting the docsystem integrated

[julia-users] Blog-post on how to make package documentation

2016-02-17 Thread Mauro
/notes/documenting-a-julia-package.html (feedback welcome) Mauro

Re: [julia-users] Investigating instances of parametric types

2016-02-15 Thread Mauro
> I have an instance of a parametric type, is there a canonical way to get > the parameter values? > For example I could have some Array{T, d} and want to know whether T is > Float64 and what its dimension is. > The only way of doing this I am aware of is writing code like: > > dimension{T, dim}(ar

Re: [julia-users] Strange failure running test/unicode/utf8code.jl

2016-02-14 Thread Mauro
Reported here https://github.com/JuliaLang/julia/issues/15072 On Sat, 2016-02-13 at 22:33, Scott Jones wrote: > I'm seeing a very strange failure recently (within the last week), where > running "test/runtests.jl" seems to pass, but running the individual test > shows > a very different result.

Re: [julia-users] Creating closures referencing type parameters recently broken

2016-02-13 Thread Mauro
Here's the issue: https://github.com/JuliaLang/julia/issues/15068 On Sun, 2016-02-14 at 00:49, Jonathan Goldfarb wrote: > Ah, I do recall reading that thread but didn't make the connection. I thought > I'd built a version recent enough that it should have already broken due to > that, but I gue

Re: [julia-users] How to do multiple dispatch on different dimension of matrices?

2016-02-13 Thread Mauro
There are a few things you can do: - use the Vector and Matrix typealiases - the definition of those also shows how to do this in general: typealias Vector{T} Array{T,1} If it is just a one-off thing for any type: type A{T,S} end test{T}(a::A{T,1}) = -2 test{T}(a::A{T,2}) = 7 test(A{Int,2}()) #

Re: [julia-users] Adding a mtrix to the third dimension of a multi-dimensional array

2016-02-13 Thread Mauro
I think this is not possible. Instead use a Vector, append! to that and then reshape in the end. The reshape should result in a view and not a copy, thus will be fast. Mauro On Sat, 2016-02-13 at 10:51, Vishnu Raj wrote: > Hi, > > I have a three dimensional array (say '

Re: [julia-users] Re: Googling the functions I need in Julia is hard

2016-02-12 Thread Mauro
Also at the Julia REPL: julia> apropos("standard deviation") randn! stdm std randn help?> std search: std stdm STDIN STDOUT STDERR setdiff setdiff! hist2d hist2d! stride strides StridedArray StridedVector StridedMatrix StridedVecOrMat redirect_stdin std(v[, reg

Re: [julia-users] Calling a macro to generate functions

2016-02-11 Thread Mauro
Macros only work on syntax but not on values, as you noted in your post. Here again: julia> macro test(args...) @show args :() end julia> @test k[5] u[i] args = (:(k[5]),:(u[i])) () Macros are processed during parsing of the source, no values exists at that point. Jacob ha

Re: [julia-users] Re: [julia-dev] Re: Google Summer of Code 2016 - Ideas Page

2016-02-11 Thread Mauro
> I am interested in Ordinary Differential Equations package. But when I was > reading the conversations on the mailing list as well as on GitHub, someone > mentioned that quite a bit of work has already been done. So I want to know > the status as well as future prospects of the package ODE.jl . A

Re: [julia-users] usage of eachindex with Array type?

2016-02-11 Thread Mauro
> Thank you Mauro, CartesianRange(size(A)) seems to be what I am looking for. That should automatically be done for you by eachindex. In fact, eachindex will select the fastest method available for iterating over all indices. But if you need extras, as described in that blog post of Tim, t

Re: [julia-users] usage of eachindex with Array type?

2016-02-11 Thread Mauro
It works like so: julia> for i in eachindex(A) @show A[i] end ... I.e. the `i` is to be used as sole index into the array. What `i` is exactly depends on the type of the array. It's either just a Int or a `CartesianIndex` has a field `I`. But you should not access `I` directly

Re: [julia-users] let unpack

2016-02-10 Thread Mauro
I think this should work. You should file an issue if there is none yet. On Thu, 2016-02-11 at 02:18, vish...@stanford.edu wrote: > You can normally do > > z = (1,2,3) > (a,b,c) = z > > and it will unpack things from z into a,b,c. > However, if you do: > > let (a,b,c) = z; a end > > it's a synta

Re: [julia-users] Re: Computing a related concrete type

2016-02-10 Thread Mauro
rray example shows. > On Wednesday, February 10, 2016 at 2:38:28 PM UTC-5, Mauro wrote: > > `similar` does what you're looking for: >> >> ``` >> similar(array, [element_type=eltype(array)], [dims=size(array)]) >> >> Create an uninitialized mutable array

<    1   2   3   4   5   6   7   8   >