[julia-users] Julia package style / learning

2014-03-24 Thread Ryan Gehring
Hey all, I decided to start learning Julia over the weekend and am having fun so far. I implemented the wikipedia single layer perceptron algorithm as well as kendall's tau to see what it would be like to develop a medium sized package in the language. Link to the repo is below (the title just

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Ted Fujimoto
Thanks John! Another reason why I brought up the last question is the fear that following an R-style implementation will produce a Julia package that is riddled with sub-optimal legacy code. But I guess Julia is not mature enough that one could make such conclusions. On Sunday, March 23, 2014

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Ted Fujimoto
Thanks Jake! I'll also ask if they are willing to participate in the Julia community by implementing a Julia version too! :) On Sunday, March 23, 2014 6:14:33 PM UTC-7, Jake Bolewski wrote: Another strategy is to contact the authors directly and ask them if they would consider relicensing

[julia-users] Re: Calculus2: A new proposed interface for Calculus

2014-03-24 Thread Miles Lubin
I like the unified interface for differentiation. My only qualm is with flattening out the hierarchy of packages by including DualNumbers. There was some discussion on this here: https://github.com/johnmyleswhite/Calculus.jl/pull/44 To start out, what is the intended scope of Calculus.jl? Once

[julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
Is this question not clear or just uninteresting?

Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread Tim Holy
On Monday, March 24, 2014 03:02:37 AM RecentConvert wrote: Is this question not clear or just uninteresting? You're not showing how you're actually calling the constructor. If I copy/paste your type definition, and then say Status([1:12]), it works just fine for me. What version of Julia are

[julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread Ivar Nesje
Sorry that you did not get any response, I did not comprehend what you were trying to do last time. The code you posted seems to work fine for me on 0.2.1 and 0.3-prerelease. How did you trigger the error? As a side note if efficiency is important, I would recommend that you use

[julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
Thanks for the quick replies. *Purpose:* Given a double, convert it to a collection of boolean values representing the statuses of various valves and settings. I'm still torn about whether I want to input an array of values and store arrays of statuses in one type or create an array of the

Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread Tim Holy
On Monday, March 24, 2014 03:56:08 AM RecentConvert wrote: statuses = Status(vector(Dstc[StatusW])) That's still not very helpful, because we have no idea what vector(Dstc[StatusW]) yields. Does Status([1:12]) work? If so, the problem is in the particular inputs you're supplying. If not, then

[julia-users] Re: Trying to understand how to structure parallel computation

2014-03-24 Thread yuuki
Maybe the pmap example from the doc can be useful, it feeds work to other processes: http://julia.readthedocs.org/en/latest/manual/parallel-computing/#synchronization-with-remote-references

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Tom Short
Instead of asking the package authors to do extra work, it might be better to offer to convert their package to a Julia package. Then, you can ask the authors if the converted package could be released with an MIT license. On Mon, Mar 24, 2014 at 2:18 AM, Ted Fujimoto tftur...@gmail.com wrote:

[julia-users] Constructing arrays with dim 2

2014-03-24 Thread Linus Mellberg
Hi! I'm trying to construct a 3 dimensional array from a number of 1 dimensional arrays. Essentially what i would like to do is a = [f(i, j) for i in 1:n, j in 1:m] where f(i, j) is a function that returns an array (note, f has to construct the entire array at the same time). The code above

Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread RecentConvert
The updated code works the same with Status([1:12]) as it does with vector(Dstc[StatusW]). type Status Valve1::Vector{Bool} Valve2::Vector{Bool} Valve3::Vector{Bool} Valve4::Vector{Bool} Valve5::Vector{Bool} Valve6::Vector{Bool} Valve7::Vector{Bool} Valve8::Vector{Bool}

[julia-users] Julia package style / learning

2014-03-24 Thread Ethan Anderes
I'm definitely not an expert but I thought I would chime in on your arrays of arrays vrs matrices question. I recently developed a project where I started out using: Array{Array{Float64,1},1} as a container for a set of state vectors in an ODE flow. This seemed most natural but I figured once

Re: [julia-users] Julia package style / learning

2014-03-24 Thread John Myles White
I think comparisons between those two will depend a lot on context. If you need to use linear algebra functions, the Array{Array{Float64, 1}, 1} approach won’t work at all, so it’ll be infinitely slow. If you’re constantly just grabbing columns stored that way, it might be faster since you

Re: [julia-users] Julia package style / learning

2014-03-24 Thread Ethan Anderes
Yep, that was my situation: no linear algebra but a lot of grabbing columns within for loops. Looking forward to non-copying array slices:) Thanks, Ethan

Re: [julia-users] Re: Terminate a task

2014-03-24 Thread Stefan Karpinski
Yes, we need this ability. Externally terminating and otherwise interacting with tasks is a good way to deal with things like timeouts and cancelling distributed work. On Mon, Mar 24, 2014 at 1:01 AM, Amit Murthy amit.mur...@gmail.com wrote: I think currently the only way to interrupt a task

Re: [julia-users] Julia package style / learning

2014-03-24 Thread Ivar Nesje
Just for the record. To convert from Array{Array{Float64, 1}, 1} to Array{Float64,2} you can use hcat(a...) Ivar kl. 15:50:36 UTC+1 mandag 24. mars 2014 skrev Ethan Anderes følgende: Yep, that was my situation: no linear algebra but a lot of grabbing columns within for loops. Looking

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Ted Fujimoto
I probably was not clear in my response to Jake but what I meant was that I would ask the authors if they wanted to use the GPL because they felt that license was most appropriate. If not, I would then give them the choice to *assist* me at any level they choose with a Julia version of their

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Ted Fujimoto
I probably was not clear in my response to Jake but what I meant was that I would ask the authors if they wanted to use the GPL because they felt that license was most appropriate. If not, I would then give them the choice to *assist* me at any level they choose with a Julia version of their

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread John Myles White
I think Tom’s point is that most people prefer that you assist them rather than offer them the chance to assist you. — John On Mar 24, 2014, at 8:58 AM, Ted Fujimoto tftur...@gmail.com wrote: I probably was not clear in my response to Jake but what I meant was that I would ask the authors

Re: [julia-users] Yet another licensing question: Building a Julia version of an R package

2014-03-24 Thread Ted Fujimoto
OK. How about asking if I could assist *them* on a Julia version under an MIT license? The result is the same but I guess language does make a difference... On Monday, March 24, 2014 9:08:23 AM UTC-7, John Myles White wrote: I think Tom’s point is that most people prefer that you assist them

Re: [julia-users] Terminate a task

2014-03-24 Thread Jameson Nash
Alternatively, might be fun to make a ccall_in_worker_thread intrinsic which handles all of the fiddly gc details and only blocks the local task (and/or returns a remoteref) On Monday, March 24, 2014, Stefan Karpinski ste...@karpinski.org wrote: Yes, we need this ability. Externally terminating

[julia-users] Re: Gauss quadrature package

2014-03-24 Thread sflp
Hallo Bill; could you please explain or post some reference about that specialised version you mention of the QL iteration to get directly the first components of the normalised eigenvectors. As I am working with complex, non-hermitian, symmetric eigenvalue problems it would be of great help.

[julia-users] Re: Constructing arrays with dim 2

2014-03-24 Thread Keith Campbell
This runs fine for me, running Version 0.3.0-prerelease (2014-02-28 04:44 UTC): f(i,j) = [i,j] n=3; m=2 a = [f(i, j) for i in 1:n, j in 1:m] Out[91]: 3x2 Array{Any,2}: [1,1] [1,2] [2,1] [2,2] [3,1] [3,2] On Monday, March 24, 2014 10:07:49 AM UTC-4, Linus Mellberg wrote: Hi! I'm

Re: [julia-users] Re: Build a constructor with fewer inputs than values

2014-03-24 Thread Tim Holy
I get julia x.Valve1 12-element Array{Bool,1}: true false true false true false true false true false true false I even went to the trouble to build Julia 0.2.1 and test it there, too; same result. So I can't replicate your problem. (I'm on Linux.) How are you getting Julia?

[julia-users] Re: Constructing arrays with dim 2

2014-03-24 Thread Antoine Chevalier
Hi, I guess you want a 3d array instead of a 2D array containing 1D arrays. I tried this: arrayLength = 10; matrixCols = 10; matrixSlices= 10; function arrayTest(arrayLength,i,j)singleArray = ones(1,arrayLength)*(i+j); #each array has a unique value i+jreturn singleArrayend

[julia-users] Re: Constructing arrays with dim 2

2014-03-24 Thread Antoine Chevalier
If you really want a 3d matrix and not a 2d array containing arrays, I would have tried this : arrayLength= 10 ; matrixCol = 10; matrixSlices= 10; function arrayTest(arrayLength,i,j) singleArray = ones(1,arrayLength)*(i+j); #each array has a unique value i+j return

[julia-users] Re: Constructing arrays with dim 2

2014-03-24 Thread Antoine Chevalier
Thinking about it, it is probably not so ... efficient. Le lundi 24 mars 2014 19:41:14 UTC+1, Antoine Chevalier a écrit : Hi, I guess you want a 3d array instead of a 2D array containing 1D arrays. I tried this: arrayLength = 10; matrixCols = 10; matrixSlices= 10; function

[julia-users] Re: Constructing arrays with dim 2

2014-03-24 Thread Gunnar Farnebäck
Ok, one might be less redundant if reading the thread properly before posting. Sorry about the noise. Den måndagen den 24:e mars 2014 kl. 23:12:03 UTC+1 skrev Gunnar Farnebäck: [f(i,j)[k] for k in 1:K, i in 1:n, j in i:m] Den måndagen den 24:e mars 2014 kl. 15:07:49 UTC+1 skrev Linus

Re: [julia-users] Embedding Julia in an app / calling from C++

2014-03-24 Thread Dibyendu Majumdar
The error message I got was: System image file C:\project\Debug\../lib/julia/sys.ji not found This occurred when I called jl_init() with NULL. It seems that it is trying to find files relative to the executable file location. I tried setting JULIA_HOME environment variable but that did not

Re: [julia-users] Embedding Julia in an app / calling from C++

2014-03-24 Thread Patrick O'Leary
This isn't really possible right now--large, essential parts of Julia are written in Julia, and there's not full differentiation between the core needed just to get the language running and the other components included in Base. Please see https://github.com/JuliaLang/julia/issues/5155 and

Re: [julia-users] ANN / RFC: SGEArray iterator

2014-03-24 Thread David van Leeuwen
Hello, On Friday, March 21, 2014 4:31:59 AM UTC+1, Jiahao Chen wrote: I wrote a similar package long ago for Python and remember SGE array jobs well. If ClusterManager's addprocs_sge function doesn't respect the current working directory in the worker processes, it would be nice to

[julia-users] Fastest method to create a matrix of random integers

2014-03-24 Thread David P. Sanders
Hi, What is the fastest way to create a matrix containing random integers: 1 or -1 with equal probability? I have tried the following options but was wondering if I am missing something. (I also need 1, 0 or -1 with different probabilities later, which is why I don't just use a boolean random

Re: [julia-users] Fastest method to create a matrix of random integers

2014-03-24 Thread Jacob Quinn
How about In [186]: @time rand(-1:2:1,1,1); elapsed time: 2.29940616 seconds (80224 bytes allocated) No need for an extra function. This uses a range from -1 to 1 with a step size of 2 so you only get those two numbers. -Jacob On Mon, Mar 24, 2014 at 7:21 PM, David P. Sanders

[julia-users] setting Qt properties in PySide

2014-03-24 Thread Samuele Carcagno
Hi, I can't figure out the syntax to set Qt graphics properties in PySide.jl For example, how to translate the following Python code: sizer.setAlignment(Qt.AlignTop) or pw.layout().setSizeConstraint(QLayout.SetFixedSize) or cw.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken) any help would

[julia-users] Re: Managing objects and state

2014-03-24 Thread andrew cooke
it's not completely clear to me what you're asking. julia isn't particularly object oriented (i just checked and there's no mention of objects or classes in the intro at http://julialang.org/) having said that, you can store and modify (unless the type is immutable) values in composite

[julia-users] Re: setting Qt properties in PySide

2014-03-24 Thread j verzani
It varies. qt_enum(AlignTop) will do the first, Qt.QVBoxLayout()[:SetFixedSize] the second, and Qt.QFrame()[:Sunken] the third. The qt_enum() function is basically pyimport(PySide.QtCore)[Qt][:property_name] which is needed to fish properties out of the Qt object, as @pyimport will

[julia-users] set parent to None in PySide

2014-03-24 Thread Samuele Carcagno
another PySide.jl question, how to set the parent to None after removing a widget? If I attempt it I get the following error: julia pw_prm_sizer_0[:removeWidget](wd[fieldLabel][1]) julia wd[fieldLabel][1][:setParent](None) ERROR: PyError (PyObject_Call) type 'exceptions.TypeError'

[julia-users] Re: set parent to None in PySide

2014-03-24 Thread j verzani
I don't really know. This of course is an issue, as it likely won't get garbage collected once removed. I thought setting the parent to `nothing` would work, but it doesn't. If you find something that does work please let me know. On Monday, March 24, 2014 9:00:13 PM UTC-4, Samuele Carcagno

[julia-users] Filling a long composite type

2014-03-24 Thread J Luis
Let's say I have this composite type julia type t aa::ASCIIString; bb::ASCIIString; end and try to fill it a la C (or Matlab) julia tt=t t (constructor with 1 method) julia tt.aa=AA ERROR: type DataType has no field aa so bad surprise. I can't. So I have to do for

Re: [julia-users] Filling a long composite type

2014-03-24 Thread Jameson Nash
tt = t( [ for i = 1:120]... ) On Mon, Mar 24, 2014 at 9:43 PM, J Luis jmfl...@gmail.com wrote: Let's say I have this composite type julia type t aa::ASCIIString; bb::ASCIIString; end and try to fill it a la C (or Matlab) julia tt=t t (constructor with 1 method)

Re: [julia-users] Filling a long composite type

2014-03-24 Thread J Luis
Thanks a lot It would be nice to have a kind of repository for tricks where this one would deserve a place Terça-feira, 25 de Março de 2014 1:55:32 UTC, Jameson escreveu: tt = t( [ for i = 1:120]... ) On Mon, Mar 24, 2014 at 9:43 PM, J Luis jmf...@gmail.com javascript: wrote: Let's

Re: [julia-users] Filling a long composite type

2014-03-24 Thread Tim Holy
On Monday, March 24, 2014 09:55:32 PM Jameson Nash wrote: tt = t( [ for i = 1:120]... ) You can also define an inner constructor and leave many/all of the fields uninitialized. --Tim On Mon, Mar 24, 2014 at 9:43 PM, J Luis jmfl...@gmail.com wrote: Let's say I have this composite type

[julia-users] Is a.(b) valid?

2014-03-24 Thread J Luis
The doc of getfield says getfield(*value*, *name::Symbol*) Extract a named field from a value of composite type. The syntax a.b calls getfield(a, :b), and the syntax a.(b) calls getfield(a, b). but when I try the a.(b) variation, it errors (or it's me who errors?) julia gmt_modules.write ?I,?O

Re: [julia-users] Is a.(b) valid?

2014-03-24 Thread Isaiah Norton
You need to pass a variable containing a Symbol. Try write = :write On Mon, Mar 24, 2014 at 10:46 PM, J Luis jmfl...@gmail.com wrote: The doc of getfield says getfield(*value*, *name::Symbol*) Extract a named field from a value of composite type. The syntax a.b calls getfield(a, :b), and

[julia-users] Re: Is a.(b) valid?

2014-03-24 Thread Sam L
After some experimentation, it looks like second way takes a symbol or variable who's value is a symbol. julia type MyType; a::Int; end julia x = MyType(3) MyType(3) julia x.a 3 julia x.(a) ERROR: a not defined julia x.(:a) 3 julia b = :a :a julia x.(b) 3 On Monday, March 24, 2014

[julia-users] Re: Is a.(b) valid?

2014-03-24 Thread J Luis
Thanks So this means we cannot do the dynamic names as in Matlab (where the b is the member name) BTW, I needed to extract the member name as a string to compare with another string and the only way I got it done was with julia nomes=names(MyType) 1-element Array{Symbol,1}: :a julia

Re: [julia-users] Re: Is a.(b) valid?

2014-03-24 Thread Jameson Nash
dynamic names can be handy, but they are also quite slow. symbol(string(nomes[1])) === nomes[1] On Mon, Mar 24, 2014 at 11:13 PM, J Luis jmfl...@gmail.com wrote: Thanks So this means we cannot do the dynamic names as in Matlab (where the b is the member name) BTW, I needed to extract the

[julia-users] Re: Calculus2: A new proposed interface for Calculus

2014-03-24 Thread Jason Merrill
On Sunday, March 23, 2014 11:29:37 PM UTC-7, Miles Lubin wrote: I like the unified interface for differentiation. My only qualm is with flattening out the hierarchy of packages by including DualNumbers. There was some discussion on this here:

[julia-users] Re: Julia package style / learning

2014-03-24 Thread Ryan Gehring
Thanks for the discussion and thanks to JMW for the pull request! On Sunday, March 23, 2014 9:42:19 PM UTC-7, Ryan Gehring wrote: Hey all, I decided to start learning Julia over the weekend and am having fun so far. I implemented the wikipedia single layer perceptron algorithm as well as