[julia-users] Re: JuliaOpt for nonlinear constrained optimization with around 500 variables

2016-05-10 Thread Jorge Fernández de Cossío Díaz
Also, how much RAM or time should I expect these computations to consume? On Tuesday, May 10, 2016 at 10:30:00 AM UTC-4, Jorge Fernández de Cossío Díaz wrote: > > I want to use JuliaOpt to solve a constrained optimization problem with > around 500 variables. There are around 200 constrains,

[julia-users] newbie questions (was undefined reference error)

2016-05-10 Thread Boylan, Ross
I'm puzzled that a type consisting only of 2 integers doesn't qualify as "bitstype". Further experiment shows that the array seems to be an array of references, I don't know how to implement zero, and generally that I'm a bit lost :) My goal is to get a densely packed array of data. I

[julia-users] Re: JuliaOpt for nonlinear constrained optimization with around 500 variables

2016-05-10 Thread Jorge Fernández de Cossío Díaz
Thanks for pointing out the julia-opt list, I will post this question there. On Tuesday, May 10, 2016 at 2:28:13 PM UTC-4, Miles Lubin wrote: > > Hi Jorge, > > Gurobi is a state of the art solver. If your problem falls into a class > supported by gurobi (e.g., convex quadratic), then you can

[julia-users] How fast is appending an element to an array?

2016-05-10 Thread Andrei Zh
>From performance perspective, how bad it is to use `push!(array, element)` compared to pre-allocating array and setting elements in it? More generally, how extending arrays works in Julia? (code in array.c is quite readable, but

Re: [julia-users] Re: static compilation

2016-05-10 Thread Jameson
The compile-all flag is only partially functional on v0.4. I think it's best to just leave it off. I tested on master and fixed a bug with emitting `@ccallable`, but that's unrelated. From the command line below, it looks like you are not adding any code to the system image (`--eval nothing`)

[julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Cedric St-Jean
"normal" types are by definition heap-allocated, and are always manipulated them through pointers. What you want is immutables immutable Stuff a::Int b::Int end # Also, for zeros to work, function

[julia-users] Re: Does rationalize ever round to zero?

2016-05-10 Thread Jeffrey Sarnoff
This appears to be a bug. The docs for rationalize say rationalize([*Type=Int*, ]*x; tol=eps(x)*) Approximate floating point number x as a Rational number with components of the given integer type. The result will differ from x by no more than

[julia-users] Re: JuliaOpt for nonlinear constrained optimization with around 500 variables

2016-05-10 Thread Jorge Fernández de Cossío Díaz
Also, how much RAM or time should I expect these computations to last? On Tuesday, May 10, 2016 at 10:30:00 AM UTC-4, Jorge Fernández de Cossío Díaz wrote: > > I want to use JuliaOpt to solve a constrained optimization problem with > around 500 variables. There are around 200 constrains, most

[julia-users] Re: JuliaOpt for nonlinear constrained optimization with around 500 variables

2016-05-10 Thread Miles Lubin
Hi Jorge, Gurobi is a state of the art solver. If your problem falls into a class supported by gurobi (e.g., convex quadratic), then you can rely on the results. Using Julia to specify the problem has a minimal effect on the solution time, specifically only in some preprocessing and generating

Re: [julia-users] Anonymous Function Behavior

2016-05-10 Thread Yichao Yu
On Tue, May 10, 2016 at 2:22 PM, wrote: > Watch this. > > We define an array: > a = collect(-1:0.001:1) > > Then map something over the aforementioned array for the first time: > @time map(x->10^x, a) > # 0.049258 seconds > > Do it again so that we don't capture JIT

[julia-users] Re: Does rationalize ever round to zero?

2016-05-10 Thread Jeffrey Sarnoff
You can post it as an issue. On Tuesday, May 10, 2016 at 4:21:18 PM UTC-4, Jeffrey Sarnoff wrote: > > This appears to be a bug. The docs for rationalize > say > rationalize([*Type=Int*, ]*x; tol=eps(x)*) Approximate floating point > number x

[julia-users] Re: Calling a function when type field changes.

2016-05-10 Thread Jameson
You shouldn't call `eval` in a macro. That's not how macros work or what they are for and you'll quickly find out it's not doing what you thought. On Monday, May 9, 2016 at 12:17:37 AM UTC-4, Yonghee Kim wrote: > > I've ended up creating this macro > > macro log(ex)

Re: [julia-users] How fast is appending an element to an array?

2016-05-10 Thread Yichao Yu
On Tue, May 10, 2016 at 4:24 PM, Andrei Zh wrote: > From performance perspective, how bad it is to use `push!(array, element)` > compared to pre-allocating array and setting elements in it? If you know the size ahead of time, always pre allocate it. Resizing the array

Re: [julia-users] How fast is appending an element to an array?

2016-05-10 Thread Ken B
There's an open issue somewhat related for growing an array with factor less than 2, in case you feel like an interesting read: https://github.com/JuliaLang/julia/issues/8269 On Tuesday, 10 May 2016 22:35:43 UTC+2, Yichao Yu wrote: > > On Tue, May 10, 2016 at 4:24 PM, Andrei Zh

[julia-users] Re: Specify format in writedlm?

2016-05-10 Thread Peter Simon
One way is to round the data prior to writing it: julia> a = rand(10,5) 10x5 Array{Float64,2}: 0.806913 0.010713 0.469981 0.419839 0.451575 0.584154 0.720939 0.444952 0.756981 0.0928572 0.204909 0.36935 0.122733 0.777961 0.291004 0.784125 0.490603 0.312298 0.0527099

RE: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Boylan, Ross
But if I make an array of immutables I won't be able to change them afterwards. Though I can replace them. With the old code except for immutable Stuff a::Int b::Int end I now have julia> v=Array(TT.Stuff, 2) 2-element Array{TT.Stuff,1}: TT.Stuff(140124021836848,140124000460928)

[julia-users] Re: Write immutable with variable-length array field to a stream

2016-05-10 Thread Jameson
I recommend going with a standard format such as ProtoBuf.jl, JSON.jl, or other similar product. On Saturday, May 7, 2016 at 2:31:59 PM UTC-4, Andrei Zh wrote: > > I work on implementing a binary protocol for a service. This protocol is > based on messages - structs that support integer

[julia-users] Re: Write immutable with variable-length array field to a stream

2016-05-10 Thread Andrei Zh
Ah, I should have been more explicit, sorry. This is a protocol for existing service (Apache Kafka, if it matters), so I can't actually choose a format. Anyway, the protocol turned to be quite specific, so I had to craft my own serialization routines. And, by the way, it turned to be quite

Re: [julia-users] How fast is appending an element to an array?

2016-05-10 Thread Andrei Zh
Very detailed explanation, thank you! On Tuesday, May 10, 2016 at 11:35:43 PM UTC+3, Yichao Yu wrote: > > On Tue, May 10, 2016 at 4:24 PM, Andrei Zh > wrote: > > From performance perspective, how bad it is to use `push!(array, > element)` > > compared to pre-allocating

Re: [julia-users] How fast is appending an element to an array?

2016-05-10 Thread Tim Holy
Since it hasn't been mentioned yet, I'll point out `sizehint!` which can eliminate the re-allocations. But this is still slower than setting the elements, because it needs to update the length of the array on each `push!`. Worth benchmarking yourself if it matters to how you design your code.

Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-10 Thread Tom Breloff
Excellent. I'll be a science fair legend. On Tue, May 10, 2016 at 8:57 PM, Scott Jones wrote: > Ok! Thanks! When I'd used PyPlot directly, it combined two plot() calls > into a single plot by itself, without me putting a ! anywhere. > > Works beautifully now! (and

[julia-users] Julia text editor on iPad?

2016-05-10 Thread Sheehan Olver
Anyone know of a text editor for the iPad that supports Julia syntax highlighting? I guess ideally this could link into JuliaBox (or another SSH server) so that code can be run in Safari/SSH. (Just got the iPad Pro + Smart Keyboard and it seems fairly useable for on-the-go programming...)

Re: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Cedric St-Jean
> It seems sort of odd that the type is immutable yet I can overwrite data of that type. I suppose that would only be prohibited if the array were immutable. It's not the array that's immutable, it's the values contained therein. I agree that it's a bit weird to have to replace the whole

Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-10 Thread Scott Jones
I'm still running into a problem with this, for some reason, it shows two separate windows, the first one with marked "Figure 1", with the error bars, labels, and the mean, and another one marked "Figure 2", with just the median, marked with the squares. I tried both with a checkout of master

Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-10 Thread Scott Jones
Ok! Thanks! When I'd used PyPlot directly, it combined two plot() calls into a single plot by itself, without me putting a ! anywhere. Works beautifully now! (and I had Alex cite you in his code ;-) ) On Tuesday, May 10, 2016 at 8:44:06 PM UTC-4, Tom Breloff wrote: > > Yup... You're missing a

RE: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Kristoffer Carlsson
Bitstypes are laid out contiguosly in memory. Your "workaround" way is a good way of doing it and will be fast.

Re: [julia-users] Re: newbie questions (was undefined reference error)

2016-05-10 Thread Tim Holy
The right way to think about it is that an immutable is like a number: you're used to being able to have an array of Float64 and replace those, right? You're not redefining the meaning of "5.2", you're overwriting the value stored in that slot. Arrays of immutables work exactly the same way:

Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-10 Thread Scott Jones
The code and input CSV file are now on GitHub as public gists: (the code is not as fancy as yours, Alex knows how to do for loops and ifs, and has learned about creating and pushing to vectors, but not all that fancy stuff that even I didn't know ;-) )

Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-10 Thread Tom Breloff
Yup... You're missing a exclamation point. 'plot' creates a new figure, and 'plot!' modifies a figure. If there's not a Plot object as the first argument it will implicitly insert the currently active figure, so the command is essentially 'plot!(current(), ...)' On Tuesday, May 10, 2016, Scott

[julia-users] working with julia in atom - any way to pop-out the console to a new window?

2016-05-10 Thread Alix
Hello, New user of julia and atom here: I've searched forums far and wide and still can't figure this out. Any way to pop-out the console to a new window? It seems to me whenever you create a new window, it creates a new process. While it is awesome to evaluate code inline, sometimes I

[julia-users] Re: for loop with multiple variables

2016-05-10 Thread Vishnu Raj
Thanks :) On Tuesday, May 10, 2016 at 4:44:18 PM UTC+5:30, Lutfullah Tomak wrote: > > for (i,j)=zip(0:5,6:10) > println(i+j) > end > On Tuesday, May 10, 2016 at 2:02:41 PM UTC+3, Vishnu Raj wrote: >> >> What if the equivalent of the C code below >> for( i=0, j=6; i<=5, j <=10; i++, j++ )

Re: [julia-users] Cannot pull with rebase...?

2016-05-10 Thread Andres Joaquin Calderon Vergara
Hey Alex, I dont have much experience with this, could you please point out the steps to add that patch to the METADATA git repo? Many thanks, Andres J. El jueves, 17 de marzo de 2016, 13:17:28 (UTC), Alex Cooper escribió: > > I got the same issue on julia-0.4.3-win64. It's a problem with

[julia-users] Re: IJulia- Failed to precompile IJulia to C:\Users\....\.julia\lib\v0.4\IJulia.ji in error at error.jl:21

2016-05-10 Thread ÜÖ
Dear Steven, I did - a "git reset --hard" and IJulia worked. Appreciate your kind help. You are right, when IJulia crashed first for some reason, I had done the following and most probably I did something wrong. > `` " If IJulia is crashing (e.g. it gives you a "kernel appears to have

Re: [julia-users] Re: Is there a function/macro that shows the line number where it is called?

2016-05-10 Thread FANG Colin
Thank you! On Tuesday, May 10, 2016 at 3:20:48 PM UTC+1, Isaiah wrote: > > Use `@__LINE__` and `@__FILE__`. > > (note, however, `@__LINE__` does not work when used within another macro, > see https://github.com/JuliaLang/julia/issues/9577) > > On Tue, May 10, 2016 at 6:25 AM, FANG Colin

[julia-users] JuliaOpt for nonlinear constrained optimization with around 500 variables

2016-05-10 Thread Jorge Fernández de Cossío Díaz
I want to use JuliaOpt to solve a constrained optimization problem with around 500 variables. There are around 200 constrains, most are linear, only a couple are nonlinear. I have Gurobi. I am looking for benchmarks of JuliaOpt/Gurobi on systems of this size, including nonlinear constrains, to

Re: [julia-users] Re: Newbie Question: Command Line Woes

2016-05-10 Thread Tom Breloff
Rich: The return values from the REPL are implicitly displayed. To do this in a script you have to call display(five()), or show/print. It would be really bad/annoying if every value was printed to the screen during a script... See: http://docs.julialang.org/en/release-0.4/stdlib/io-network/

[julia-users] Re: Newbie Question: Command Line Woes

2016-05-10 Thread rich2 . 7182
Cedric, Thanks very much. That works for the hello() function, but not exactly for the five() function. For instance, if I have function five() return 5 end five() Then I get no output when calling from the Command Line, while I do in the REPL. In fact, in the REPL I get the output after

Re: [julia-users] Re: Newbie Question: Command Line Woes

2016-05-10 Thread rich2 . 7182
Tom, That makes sense. Thanks. Rich On Tuesday, May 10, 2016 at 11:04:13 AM UTC-4, Tom Breloff wrote: > > Rich: The return values from the REPL are implicitly displayed. To do > this in a script you have to call display(five()), or show/print. It would > be really bad/annoying if every

Re: [julia-users] Re: Newbie Question: Command Line Woes

2016-05-10 Thread Yichao Yu
On Tue, May 10, 2016 at 11:04 AM, Tom Breloff wrote: > Rich: The return values from the REPL are implicitly displayed. To do this > in a script you have to call display(five()), or show/print. It would be > really bad/annoying if every value was printed to the screen during a

[julia-users] Re: using subscripts \_1, \_2, ... as field names

2016-05-10 Thread Tim Wheeler
I would love to see a₁ automatically call getindex(a, 1). It would make math easier. I'd love to be able to write: b = μ₂ + Σ₁₂*(a₁ - μ₁)/Σ₁₁ Λ = Σ₂₂ - Σ₁₂*Σ₁₂/Σ₁₁ for μ::Vector{F<:Real} and Σ::Matrix{F<:Real} Σ could be accessed via Σ₁₁ to get Σ[1,1]. Of course this breaks down with digits

Re: [julia-users] Re: Is there a function/macro that shows the line number where it is called?

2016-05-10 Thread Isaiah Norton
Use `@__LINE__` and `@__FILE__`. (note, however, `@__LINE__` does not work when used within another macro, see https://github.com/JuliaLang/julia/issues/9577) On Tue, May 10, 2016 at 6:25 AM, FANG Colin wrote: > Currently I am using > > macro markup(line_number) >

Re: [julia-users] using subscripts \_1, \_2, ... as field names

2016-05-10 Thread Eric Forgy
Maybe you could override getindex so that A[1,1] is the interior nxn matrix, A[1,2] and A[2,1] are the bounding vectors and A[2,2] is the scalar?

Re: [julia-users] Re: static compilation

2016-05-10 Thread Ján Adamčák
Hello guys, Thank you for your comments, though we were more optimistic... Dňa piatok, 6. mája 2016 16:27:28 UTC+2 Ján Adamčák napísal(-a): > > Sorry, my fault. > > During last week I created build_sysimg2.jl from julia 0.4.5 > build_sysimg.jl and when I run it, at line 86 (build_sysimg2.jl)

Re: [julia-users] Re: Newbie Question: Command Line Woes

2016-05-10 Thread Rich Scissors
Worth a lot. I had forgot what REPL stood for. Thanks On Tue, May 10, 2016 at 11:18 AM, Yichao Yu wrote: > On Tue, May 10, 2016 at 11:04 AM, Tom Breloff wrote: > > Rich: The return values from the REPL are implicitly displayed. To do > this > > in a script

[julia-users] undefined reference error

2016-05-10 Thread Boylan, Ross
julia 0.4: module TT type Stuff a::Int b::Int end v = Array(Stuff, 3) end Produces julia> TT.v[1].a = 5 ERROR: UndefRefError: access to undefined reference problem in getindex at array.jl:282 !julia> TT.v 3-element Array{TT.Stuff,1}: #undef #undef #undef Could anyone

[julia-users] Re: IJulia- Failed to precompile IJulia to C:\Users\....\.julia\lib\v0.4\IJulia.ji in error at error.jl:21

2016-05-10 Thread ÜÖ
Dear Steven, Thank you very much for your help . The respective part of output of Pkg.status() > `` GLVisualize 0.0.8 - Gadfly 0.4.2 - GaussianProcesses 0.1.4 - GraphViz 0.0.4 - HPAT

[julia-users] undefined reference error

2016-05-10 Thread Lutfullah Tomak
You need to initialize array entries if you don't have eltype as bitstype. Here, undefined reference means you had not initialize the entry. And, full type assignment works because it initializes the entry.

Re: [julia-users] Unpredictable copying of data structures

2016-05-10 Thread David Dill
Stephen, Thanks! The "let" translation below makes it clear. Is there an explanation of the semantics of Julia at that level of detail somewhere? I wasn't able to find anything like this in the manual. I like Julia a lot, but one of my concerns is a lack of precision in the documentation

[julia-users] Re: Is there a function/macro that shows the line number where it is called?

2016-05-10 Thread Scott Jones
Mike Innes just helped us come up with a neat little hack, that let me capture the file and line # info in a macro (it really *shouldn't* require a hack though, something needs to be done to fix #9577). _lin(a::Expr) = a.args[2].args[1].args[1] _fil(a::Expr) = string(a.args[2].args[1].args[2])

[julia-users] Specify format in writedlm?

2016-05-10 Thread Jorge Fernández de Cossío Díaz
Is it possible to specify format in writedlm? Specifically, I want to write a matrix of Floats to a file, but I am only interested in saving a few digits after the decimal point, anything else would take too much disk space for no good reason. Is there a way to do this?

[julia-users] Anonymous Function Behavior

2016-05-10 Thread yousef . k . alhammad
Watch this. We define an array: a = collect(-1:0.001:1) Then map something over the aforementioned array for the first time: @time map(x->10^x, a) # 0.049258 seconds Do it again so that we don't capture JIT compilation time: @time map(x->10^x, a) # *0.048793 seconds* -- didn't change much

[julia-users] for loop with multiple variables

2016-05-10 Thread Vishnu Raj
What if the equivalent of the C code below for( i=0, j=6; i<=5, j <=10; i++, j++ ) print( "%d", i+j ); in julia?

[julia-users] Re: for loop with multiple variables

2016-05-10 Thread Lutfullah Tomak
for (i,j)=zip(0:5,6:10) println(i+j) end On Tuesday, May 10, 2016 at 2:02:41 PM UTC+3, Vishnu Raj wrote: > > What if the equivalent of the C code below > for( i=0, j=6; i<=5, j <=10; i++, j++ ) print( "%d", i+j ); > in julia? >

[julia-users] Changing the version of Julia when needed

2016-05-10 Thread Tony Kelman
How did you install 0.5? If you're new to thr language things will be more stable on 0.4, but you can install both in parallel.

[julia-users] Is there a function/macro that shows the line number where it is called?

2016-05-10 Thread FANG Colin
I am debugging some code. I would like to insert some markup function/macro in my code, so that I know my code at least works fine until certain line number

[julia-users] Changing the version of Julia when needed

2016-05-10 Thread kleinsplash
Hi, How do I point to the version of Julia I would like to use? For example: I would like to use this package: FunctionalDataUtils but its only available on 0.4. How do I revert without having to uninstall 0.5 or use Compat.jl which looks

[julia-users] Re: Is there a function/macro that shows the line number where it is called?

2016-05-10 Thread FANG Colin
Currently I am using macro markup(line_number) println("compile time OK: #$(line_number)") quote x = $(esc(line_number)) println("run time OK: #$x") end end For example I want to debug a function "to_debug". function to_debug() @markup(1) end compile time OK:

Re: [julia-users] using subscripts \_1, \_2, ... as field names

2016-05-10 Thread Milan Bouchet-Valat
Le mardi 10 mai 2016 à 01:56 -0700, Davide Lasagna a écrit : > Hi,  > > I have a custom type representing a bordered matrix (a big square > matrix, bordered by two vectors and a scalar in the bottom right > corner), where the four blocks are stored in separated chunks of > memory. I would like to

[julia-users] using subscripts \_1, \_2, ... as field names

2016-05-10 Thread Davide Lasagna
Hi, I have a custom type representing a bordered matrix (a big square matrix, bordered by two vectors and a scalar in the bottom right corner), where the four blocks are stored in separated chunks of memory. I would like to call the fields of my type using subscripts \_1\_1, \_1\_2, ... so

Re: [julia-users] using subscripts \_1, \_2, ... as field names

2016-05-10 Thread Davide Lasagna
Thanks. Using a letter prefix was the first thing I did. Code looked like A.A11, and so on; so not really good looking. The only reasons to use subscripts rather than standard digits would be that for the former you do not need prefixes, so it is a bit cleaner. However, using subscripts

[julia-users] Re: Changing the version of Julia when needed

2016-05-10 Thread kleinsplash
I am stuck between a bit of a rock and a hard place. I would like to use PCL: https://github.com/JuliaPCL/PCL.jl but this does not install on 0.4 But I may be able to use the FunctionDataUtils package in its place. Juno/Atom doesnt seem to play nice with 0.5 either so best is to just revert

[julia-users] Re: Changing the version of Julia when needed

2016-05-10 Thread kleinsplash
I just removed that ppa and went back to juliareleases On Tuesday, 10 May 2016 13:42:19 UTC+2, kleinsplash wrote: > > I am stuck between a bit of a rock and a hard place. > > I would like to use PCL: https://github.com/JuliaPCL/PCL.jl but this does > not install on 0.4 > > But I may be able to

[julia-users] Re: IJulia- Failed to precompile IJulia to C:\Users\....\.julia\lib\v0.4\IJulia.ji in error at error.jl:21

2016-05-10 Thread Steven G. Johnson
On Tuesday, May 10, 2016 at 3:21:25 AM UTC-4, ÜÖ wrote: > > Dear Steven, Thank you very much for your help . The respective part of > output of Pkg.status() > > - IJulia1.1.9 a675ac5c (dirty) > "dirty" means you have edited a file there, and you