Re: [julia-users] Immutable vs. Mutable composite types: Trying to understand performance and memory allocations

2016-01-25 Thread Nitin Arora
Thanks for the reply. I assume from mutate you mean not changing type of the sub-variable (e.g "vstate" above) ? I plan to change the values inside that vector but the vector itself, both in length and type, will remain constant. Nitin On Monday, January 25, 2016 at 10:23:21 PM UTC-8, Yichao

Re: [julia-users] Immutable vs. Mutable composite types: Trying to understand performance and memory allocations

2016-01-25 Thread Yichao Yu
On Tue, Jan 26, 2016 at 12:46 AM, Nitin Arora wrote: > I have couple of questions ( maybe dumb :-) ) regarding composite types: > > 1) For a vector of composite type defined as: > > immutable Point{T<:AbstractFloat} > vstate :: Vector{T} # is a vector of length 6 which will be updated > during

[julia-users] run(pipeline()) --> ERROR: failed process:

2016-01-25 Thread jda
*Running the following line on Julia 0.4.1:* *run(pipeline(`julia $path`, stdout=outputfilepath, stderr=errorfilepath))* *gives the error as follows:* *ERROR: failed process: Process(`julia '/Users/user/Google Drive/codefile.jl'`, ProcessExited(1)) [1]* * in pipeline_error at process.jl:

[julia-users] ERROR: LoadError: OutOfMemoryError()

2016-01-25 Thread jda
I've run into the following problem while running a simulation code (of a differential equation). Because of the nature of the problem, the matrices are dense. In particular one line of code that runs the backslash operator gives an OutOfMemory error on one computer but not on another computer

[julia-users] Immutable vs. Mutable composite types: Trying to understand performance and memory allocations

2016-01-25 Thread Nitin Arora
I have couple of questions ( maybe dumb :-) ) regarding composite types: 1) For a vector of composite type defined as: immutable Point{T<:AbstractFloat} vstate :: Vector{T} # is a vector of length 6 which will be updated during code execution ct :: Vector{T} # is a vector of length 4

[julia-users] Immutable vs. Mutable composite types

2016-01-25 Thread Nitin Arora
I have couple of questions regarding immutable types: 1. For "MyDataVector" data structure like this : immutable Foo data1::Vector{Float64} data1::Vector{Float64} end MyDataVector = Array{Foo, 1 } Is it useful or recommended to use

[julia-users] Profileview not working due to a bug in gtk.jl

2016-01-25 Thread Gabriel Goh
This is the error I am getting when I run import ProfileView ERROR: LoadError: BoundsError: attempt to access 157-element Array{Any,1}: Symbol Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64 Int128 ⋮ 24 25 26 27 28

Re: [julia-users] Function return dummy, à la MATLAB: [~, a] = f(x)

2016-01-25 Thread Yichao Yu
On Mon, Jan 25, 2016 at 8:28 PM, SrAceves wrote: > Hello, > > Is there an equivalent to matlab's "~" (function return dummy)? If not, any > plans to have one? https://github.com/JuliaLang/julia/issues/9343

[julia-users] RTVS

2016-01-25 Thread David Anthoff
Microsoft is going to release an open source plug-in for Visual Studio that turns it into an R environment: https://www.youtube.com/watch?v=Y1_0XN-p3Hs This is in addition to their existing (excellent) python plugin for VS. Would be great if we could somehow convince them to add julia suppo

[julia-users] Function return dummy, à la MATLAB: [~, a] = f(x)

2016-01-25 Thread SrAceves
Hello, Is there an equivalent to matlab's "~" (function return dummy)? If not, any plans to have one?

Re: [julia-users] What does `type X Int,Int end` do?

2016-01-25 Thread Erik Schnetter
I didn't know that you can write ```Julia type B i::Int b(x)=2x B(x)=new(b(x)) end ``` and thus get a very private function `b`... -erik On Mon, Jan 25, 2016 at 7:46 PM, Stefan Karpinski wrote: > Probably a good idea. But it does lead to the question of what exactly > should be allo

Re: [julia-users] What does `type X Int,Int end` do?

2016-01-25 Thread Stefan Karpinski
Probably a good idea. But it does lead to the question of what exactly should be allowed in type blocks. Obviously method definitions are necessary, but at least global variable declarations are also sometimes used. On Mon, Jan 25, 2016 at 7:39 PM, Tony Kelman wrote: > Were we going to deprecate

Re: [julia-users] What does `type X Int,Int end` do?

2016-01-25 Thread Tony Kelman
Were we going to deprecate that, or make it an error?

Re: [julia-users] What does `type X Int,Int end` do?

2016-01-25 Thread Stefan Karpinski
Any code in the type block that doesn't look like a field declaration is evaluated in the scope of the type block and has the effect of preventing default constructors from being provided. So X is a zero-field type with no default constructors. On Mon, Jan 25, 2016 at 7:00 PM, Erik Schnetter wrot

[julia-users] What does `type X Int,Int end` do?

2016-01-25 Thread Erik Schnetter
What does the syntax ```Julia type X Int,Int end ``` do? The resulting type `X` has a size of 0... -erik -- Erik Schnetter http://www.perimeterinstitute.ca/personal/eschnetter/

Re: [julia-users] Re: Adding another function to Cairo.jl

2016-01-25 Thread Tom Short
You should be able to test this out locally without modifying Cairo.jl. Your example code is probably close. You'll need to make sure you qualify everything that's not exported by Cairo.jl. For example, I think you'll need to use `Cairo._jl_libcairo` instead of `_jl_libcairo`. If `CairoContext` isn

Re: [julia-users] immutability, value types and reference types?

2016-01-25 Thread asynth
This posting answered my questions: http://julialang.org/blog/2013/03/efficient-aggregates/ On Friday, January 22, 2016 at 8:03:18 PM UTC-8, asy...@gmail.com wrote: > > > I'm trying to accomplish understanding what Julia does. > > On Friday, January 22, 2016 at 7:13:58 AM UTC-8, Stefan Karpins

Re: [julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Blake Johnson
In 0.5 you can write this as: function getindex(A::MyCustomArray, x) ix = round(Int, x) @boundscheck ix = clamp(ix, 1, length(A)) ... On Monday, January 25, 2016 at 2:13:41 PM UTC-5, Tomas Lycken wrote: > > Interesting read, thanks! > > I guess I'll hold off implementing this until 0.5 lands, the

[julia-users] Re: Adding another function to Cairo.jl

2016-01-25 Thread Josh Langsfeld
You should test it and decide what to put in it by modifying your own forked copy of Cairo.jl. This is what's great about open-source; you get to exactly see and control what impact the changes you want will have before they get added to the official software. On Monday, January 25, 2016 at 2:4

[julia-users] Re: Adding another function to Cairo.jl

2016-01-25 Thread cormullion
I'd like to open a pull request, but I wouldn't know exactly what to put in it... :) I was wondering whether I could test the syntax of such a new function first, without actually adding it to the Cairo module. It. It might not be possible, of course...

[julia-users] Advice on factorisation of sparse banded systems and solvers.

2016-01-25 Thread Tony Kelman
If it's also sparse within the band, then you should probably use normal sparse CSC and call cholmod. If the matrix is dense within the band, then we don't have types for banded matrices yet but the lapack band cholesky should be accessible.

Re: [julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Tomas Lycken
Interesting read, thanks! I guess I'll hold off implementing this until 0.5 lands, then. // T On Monday, January 25, 2016 at 7:56:15 PM UTC+1, Yichao Yu wrote: > > On Mon, Jan 25, 2016 at 1:49 PM, Tomas Lycken > wrote: > > On e.g. Arrays, I can index with @inbounds to avoid bounds checking. In

Re: [julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Yichao Yu
On Mon, Jan 25, 2016 at 1:49 PM, Tomas Lycken wrote: > On e.g. Arrays, I can index with @inbounds to avoid bounds checking. In my > own custom type, which also implements getindex, what is the correct way of > leveraging inbounds? > > For example, I have code now that looks something like this: >

[julia-users] What's the "correct" way to handle optional bounds-checking?

2016-01-25 Thread Tomas Lycken
On e.g. Arrays, I can index with @inbounds to avoid bounds checking. In my own custom type, which also implements getindex, what is the correct way of leveraging inbounds? For example, I have code now that looks something like this: function getindex(A::MyCustomArray, x) ix = clamp(round(

[julia-users] Re: Adding another function to Cairo.jl

2016-01-25 Thread hustf
> > > Isn't this what every package developer hopes for? Useful small additions in line with the original intent. Fork it, improve it and permit the owners to take it in if they like!I wonder sometimes where to put questions like this. Why don't you open an issue? (to be clear, I have nothing t

[julia-users] Re: Adding another function to Cairo.jl

2016-01-25 Thread Andreas Lobinger
Hello colleague, i agree, this is missing and should show up in a PR. Wishing a happy day, Andreas

[julia-users] Advice on factorisation of sparse banded systems and solvers.

2016-01-25 Thread Matthew Pearce
I have a problem which involves sparse, banded, symmetric, PD systems. In particular if A is such a matrix and A=LL' I need to solve L' x = z. The size of A prohibits using full matrices. So I am looking for advice on tactics for this problem, as there doesn't seem to be an out-of-the-box solu

[julia-users] Keras wrapper

2016-01-25 Thread Tom Breloff
Does anyone know of a wrapper of the Keras library in Julia?

[julia-users] Adding another function to Cairo.jl

2016-01-25 Thread cormullion
I noticed that Cairo offers a function called `cairo_paint_with_alpha`, that accompanies `cairo_paint`, (http://cairographics.org/manual/cairo-cairo-t.html#cairo-paint). At present Julia's Cairo.jl doesn't seem to have this defined. Is it possible to test it out by defining it using `ccall`, bu

Re: [julia-users] Re: optim stopping without reaching convergence

2016-01-25 Thread Brendan Tracey
We have an alternate implementation at gonum that's BSD. https://godoc.org/github.com/gonum/optimize#NelderMead Should be pretty easy to wrap your function through command line calls. I'm happy to help if you'd like it. On Monday, January 25, 2016 at 3:39:16 AM UTC-7, Tim Holy wrote: > > If you

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread Erik Schnetter
In Julia, variables have types, and the compiler uses this information to generate optimized code. The Python pattern of adding a variable or field at run-time is thus uncommon in Julia. A straightforward translation of the Python pattern would be to use a dictionary. (In Python, objects are impli

Re: [julia-users] UTF8String in embedded julia

2016-01-25 Thread Stefan Karpinski
What is the type of xmlString? Is it a C string? I.e. a NUL-terminated char* pointer? If so, that code is going to crash very quickly. On Mon, Jan 25, 2016 at 10:32 AM, Ján Adamčák wrote: > Thanks. > > My first idea use demo function println(x::UTF8String) at julia side: > > jl_function_t *func

Re: [julia-users] UTF8String in embedded julia

2016-01-25 Thread Ján Adamčák
Thanks. My first idea use demo function println(x::UTF8String) at julia side: jl_function_t *func = jl_get_function(jl_base_module, "println"); jl_call1(func, (jl_value_t*) xmlString); but in my second idea i plan return UTF8String back to C/C#... jl_function_t *func = jl_get_function(jl_curr

Re: [julia-users] randperm run time is slow

2016-01-25 Thread Stefan Karpinski
The algorithm was fine, the issue was that sampling from a range of integers was heavily optimized for the case of sampling repeatedly from the same interval, rather than from different intervals. Since the Fisher-Yates shuffle changes the interval for every sample, it was effectively a worst case

Re: [julia-users] UTF8String in embedded julia

2016-01-25 Thread Stefan Karpinski
Wrapping the array of bytes in a UTF8String object should do it. It's not quite clear what you mean by "transfer". On Monday, January 25, 2016, Ján Adamčák wrote: > Hi guys, > > Have you any idea, how to transfer utf8 string from C/C# code to Julia > code? > > I tried to find it in manual page >

[julia-users] UTF8String in embedded julia

2016-01-25 Thread Ján Adamčák
Hi guys, Have you any idea, how to transfer utf8 string from C/C# code to Julia code? I tried to find it in manual page http://docs.julialang.org/en/latest/manual/embedding/ but I haven't any information Thanks for your help ;)

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread amiksvi
Ok so basically what I want to do is impossible. I could remove the encapsulation inside the main() function I guess, but it's not ideal either.

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread Yichao Yu
On Mon, Jan 25, 2016 at 9:06 AM, wrote: > Yes but ideally I don't want the user to be forced to define this variable > in the files that are to be loaded. The less the better :) Just to be clear, `include` and `eval` all works in global scope and you can't add a local variable at runtime. > > L

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread amiksvi
Yes but ideally I don't want the user to be forced to define this variable in the files that are to be loaded. The less the better :) Le lundi 25 janvier 2016 14:41:42 UTC+1, Milan Bouchet-Valat a écrit : > > you could always define x, but make it a Nullable so that it doesn't > necessarily cont

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread amiksvi
I have a function main() in which I encapsulate my code, notably to use the @time macro, inside this main() I include files that load data from files to simulate some models that use a specific syntax (a variable p is defined for parameters of the model, etc.) and there are some models for which

Re: [julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread Milan Bouchet-Valat
Le lundi 25 janvier 2016 à 05:24 -0800, amik...@gmail.com a écrit : > Hi, > > I'd like this code: > > > function f1() >     x = 1 >     if !isdefined(:x) >         x = 2 >     end >     println(x) > end > > function f2() >     if !isdefined(:x) >         x = 2 >     end >     println(x) > end >

[julia-users] Declare default value for variable if it hasn't been declared yet in local scope

2016-01-25 Thread amiksvi
Hi, I'd like this code: function f1() x = 1 if !isdefined(:x) x = 2 end println(x) end function f2() if !isdefined(:x) x = 2 end println(x) end f1() # prints 2, ideally should print 1 f2() # prints 2, ideally should print 2 ideally to print: 1

Re: [julia-users] Re: problems reading a file

2016-01-25 Thread Milan Bouchet-Valat
The error is correct, as this file is neither encoded in ASCII nor in Unicode: it's in ISO-8859-15. If you really want to read it an preserve the ° signs, you can use my to-be-published-soon StringEncodings.jl package: Pkg.clone("https://github.com/nalimilan/StringEncodings.jl.git";) using String

[julia-users] Re: Running multiple scripts in parallel Julia sessions

2016-01-25 Thread michael . creel
It would be easy to do this using the MPI.jl package. That's what I would do, but only because I'm familiar with how it works. The native parallel methods of Julia may work just as well, though. On Saturday, January 23, 2016 at 5:08:11 AM UTC+1, Ritchie Lee wrote: > > Let's say I have 10 julia s

Re: [julia-users] Re: optim stopping without reaching convergence

2016-01-25 Thread Tim Holy
If you think there's a bug, one thing you can do is compare Julia's implementation to another implementation for the same problem and same starting point. You have to be careful not to read code that has an incompatible license (either proprietary or GPL), or you become "tainted" and can't cont

[julia-users] Re: optim stopping without reaching convergence

2016-01-25 Thread Patrick Kofod Mogensen
How did you verify that? Or are you guessing? Did you @show the iteration counter's increment? If not, how do you know it starts high? On Sunday, January 24, 2016 at 7:45:48 PM UTC+1, grande...@gmail.com wrote: > > thanks but that s not the issue. for some reasons. the number of > iterations is

[julia-users] Re: problems reading a file

2016-01-25 Thread Alberto
Hello Tomas, I tried to run f = open(filename) f_bytes = readbytes(f) text = UTF8String(f_bytes) but i get the same error I got for f = open(filename) text = readall(f) Thank you for the reply, Alberto Il giorno lunedì 25 gennaio 2016 07:00:45 UTC+1, Tomas Lycken ha scritto: > > Try conv