Re: [julia-users] undefined reference

2014-07-24 Thread Ross Boylan
On Thu, 2014-07-24 at 22:29 -0700, Ross Boylan wrote: > Running julia built off git head a few days ago. > > julia> counts = Sim.go() > ERROR: access to undefined reference > in getindex at array.jl:246 > in go at /home/ross/UCSF/HIVRace/simpleMath.jl:108 > Perhaps julia has lost track of what'

[julia-users] undefined reference

2014-07-24 Thread Ross Boylan
Running julia built off git head a few days ago. julia> counts = Sim.go() ERROR: access to undefined reference in getindex at array.jl:246 in go at /home/ross/UCSF/HIVRace/simpleMath.jl:108 Here's the relevant function, with line 108 indicated function go() global time, actors

Re: [julia-users] Permutation data type for Julia

2014-07-24 Thread Kevin Squire
On Thu, Jul 24, 2014 at 4:52 PM, Ed Scheinerman < edward.scheiner...@gmail.com> wrote: > Thanks Kevin. > > Sure. I’d be happy to do so. In a sense, this was a little project for me > to learn how to work in Julia and practice for a more extensive package I’m > doing for SimpleGraphs (that is not q

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850
Just found it works on DataArray: julia> da = DataArray(["A", "B", "C"]) 3-element DataArray{ASCIIString,1}: "A" "B" "C" julia> da * "T" 3-element DataArray{Any,1}: "AT" "BT" "CT" On 2014年07月25日 11:57, cnbiz850 wrote: That sounds confusing. You just mentioned that "Vector{String} is sem

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread yi lu
I wonder if a string is a Vector of Chars. If so, what is "ABC" + 'D' or "ABC" * 'D'. On Fri, Jul 25, 2014 at 11:57 AM, cnbiz850 wrote: > That sounds confusing. You just mentioned that "Vector{String} is > semantically equivalent to Array{String, 1}". > > > On 2014年07月25日 11:53, John Myles Whi

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850
That sounds confusing. You just mentioned that "Vector{String} is semantically equivalent to Array{String, 1}". On 2014年07月25日 11:53, John Myles White wrote: Arrays of strings aren’t part of a vector space. There’s no reason you should be able to multiply them by a scalar. — John

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread John Myles White
Arrays of strings aren’t part of a vector space. There’s no reason you should be able to multiply them by a scalar. — John On Jul 24, 2014, at 8:45 PM, cnbiz850 wrote: > Well, * works with numerics > > julia> A = [1:5] > 5-element Array{Int64,1}: > 1 > 2 > 3 > 4 > 5 > julia> A *3 > 5-element

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850
Well, * works with numerics julia> A = [1:5] 5-element Array{Int64,1}: 1 2 3 4 5 julia> A *3 5-element Array{Int64,1}: 3 6 9 12 15 And for strings, the following works: julia> VA 3-element Array{ASCIIString,1}: "A" "B" "C" julia> VB = ["a", "b", "c"] 3-element Array{ASCIIString,

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread Keno Fischer
What do you want to do? If you want to append to the array you should use push!(VA,"T"), if you want to apply that to every element of the array, I'd recommend [x*T for x in VA]. I guess it might be reasonable to allow the multiplication, but maybe having to be explicit is an advantage. On Thu, Ju

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread Jacob Quinn
* only concatenates two Strings, here you have an Array of strings and a string. You could call join() on your array first or use push!(VA,"T") if you want to add an element to the VA array. -Jacob On Jul 24, 2014 11:14 PM, "cnbiz850" wrote: > julia> VA > 3-element Array{ASCIIString,1}: > "A" >

Re: [julia-users] string array concatenates with a string not working?

2014-07-24 Thread yi lu
"ABC" * "T" is valid, but "A" "B" * "T" "C" is not. I think you can use "push!" or something else. On Fri, Jul 25, 2014 at 11:14 AM, cnbiz850 wrote: > julia> VA > 3-element Array{ASCIIString,1}: > "A" > "B" > "C" > > julia> VA * "T" > ERROR: `*` has no method matching *(::Array{ASCIIS

[julia-users] string array concatenates with a string not working?

2014-07-24 Thread cnbiz850
julia> VA 3-element Array{ASCIIString,1}: "A" "B" "C" julia> VA * "T" ERROR: `*` has no method matching *(::Array{ASCIIString,1}, ::ASCIIString)

Re: [julia-users] Re: what is the easiest way to convert array type?

2014-07-24 Thread John Myles White
Vector{String} is semantically equivalent to Array{String, 1}. It's just more readable. Also worth noting that you basically never want to work with Vector{String}. You almost certainly want Vector{UTF8String}. -- John On Jul 24, 2014, at 7:47 PM, cnbiz850 wrote: > Thanks. Didn't know abou

Re: [julia-users] Re: what is the easiest way to convert array type?

2014-07-24 Thread cnbiz850
Thanks. Didn't know about that syntax. Now with it, I might prefer the following as Array{String,1} is exactly what I want. julia> dts1 = convert(Array{String,1},dt) 3-element Array{String,1}: "2010/1/4T15:00:00" "2010/1/5T15:00:00" "2010/1/6T15:00:00" On 2014年07月25日 10:40, Miles Lubin wr

[julia-users] Re: what is the easiest way to convert array type?

2014-07-24 Thread Miles Lubin
How about "convert(Vector{String},dt)"? On Thursday, July 24, 2014 8:39:02 PM UTC-6, K leo wrote: > > I have an Array{Any,1}, but I want to convert to Array{String,1}. The > only way I know is through comprehension. > > julia> dt > 3-element Array{Any,1}: > "2010/1/4T15:00:00" > "2010/1/5

[julia-users] what is the easiest way to convert array type?

2014-07-24 Thread cnbiz850
I have an Array{Any,1}, but I want to convert to Array{String,1}. The only way I know is through comprehension. julia> dt 3-element Array{Any,1}: "2010/1/4T15:00:00" "2010/1/5T15:00:00" "2010/1/6T15:00:00" julia> dts = [convert(String, dt[i]) for i=1:length(dt)] 3-element Array{String,1}:

[julia-users] Re: comparison operators and code introspection

2014-07-24 Thread Patrick O'Leary
On Thursday, July 24, 2014 5:58:33 PM UTC-5, vav...@uwaterloo.ca wrote: > > Regarding Steven Johnson's suggestion, I am unclear about a certain point. > Suppose, following Steven's suggestion, I define > > isless_eq(x,y) = !isless(x,y) && !isless(y,x) > > First question: this is equivalent to: >

Re: [julia-users] Package availability (HDF5) in parallel environment

2014-07-24 Thread Tim Holy
You can either say `HDF5.h5read` or say `@everywhere using HDF5`. It seems that `using` causes the package to be loaded on all processes, but it only brings it into Main's namespace in the main process. --Tim On Thursday, July 24, 2014 03:52:14 PM David Koslicki wrote: > Hi, > > I'm trying to

Re: [julia-users] confusion about Date comprehension types

2014-07-24 Thread Jacob Quinn
Odd that this wouldn't get the right type automatically, but I've fixed this in Dates.jl. If you have already added the Dates.jl package, you can just do a Pkg.update() to get the changes. -Jacob On Thu, Jul 24, 2014 at 6:45 PM, cnbiz850 wrote: > I tested 2 ways of constructing date array. Bu

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread Steve Kelly
In my package tests I normally run Lint.jl as the last thing with... # run lint println("Running Lint...") lintpkg("MyPkg") Maybe it would help if we put Lint into the default REQUIRE in package generation and the above lines into test/runtests.jl? On Thu, Jul 24, 2014 at 12:54 PM, John Myles

Re: [julia-users] Permutation data type for Julia

2014-07-24 Thread Ed Scheinerman
Thanks Kevin. Sure. I’d be happy to do so. In a sense, this was a little project for me to learn how to work in Julia and practice for a more extensive package I’m doing for SimpleGraphs (that is not quite ready for prime time). What do I need to do to be “in compliance”? Best, Ed On Jul 24

[julia-users] Package availability (HDF5) in parallel environment

2014-07-24 Thread David Koslicki
Hi, I'm trying to parallelize file I/O, but am running into a problem with package availability. In particular, I would like to do the following *@everywhere function my_func(i)* * file = h5read("file$(i).h5","/data");* * result = perform_some_computation(file)* * return result* *en

[julia-users] Re: comparison operators and code introspection

2014-07-24 Thread vavasis
Regarding Steven Johnson's suggestion, I am unclear about a certain point. Suppose, following Steven's suggestion, I define isless_eq(x,y) = !isless(x,y) && !isless(y,x) First question: this is equivalent to: isless_eq(x::Any,y::Any) = !isless(x,y) && !isless(y,x) correct? Now suppose I have

[julia-users] confusion about Date comprehension types

2014-07-24 Thread cnbiz850
I tested 2 ways of constructing date array. But I got two different types of the arrays from the two ways. How can I make them the same? What is the proper Date type? At least, I hope not to use the Any type. -- julia> dats = [date(2014, 7, ii) for ii=1:4] 4-element

Re: [julia-users] A couple tuple questions

2014-07-24 Thread Kevin Squire
Hi there, In regards to a), I keep on getting the error message with the second option > ERROR: type: apply: expected Function, got (Int64,Int64,Int64) > I'm guessing you accidentally redefined the symbol "tuple" to a tuple: julia> tuple(testtuple...,testvar) (1,2,3,4) julia> tuple = (1,2,3) W

Re: [julia-users] A couple tuple questions

2014-07-24 Thread yaoismyhero
Leah, thanks for your detailed response -- I will take your advice and try to rework the code to pre-allocate for b). In regards to a), I keep on getting the error message with the second option ERROR: type: apply: expected Function, got (Int64,Int64,Int64) Just making sure, are you using 0.3?

Re: [julia-users] A couple tuple questions

2014-07-24 Thread Leah Hanson
a) Your second option works for me: ~~~ julia> testtuple = (1,2,3) (1,2,3) julia> testvar = 4 4 julia> tuple(testtuple...,testvar) (1,2,3,4) ~~~ b) I'm not sure what the cleanest code for your example would be, but here's one possibility: ~~~ julia> tuplearray = [(1,2,3),(10,20,30),(100,200,300

[julia-users] A couple tuple questions

2014-07-24 Thread yaoismyhero
Hi all, I thought to just add to my previous thread, but created a new one because the topic is a bit different. Hope y'all don't mind. Anyhow: a) How would I concatenate two tuples? Or a tuple with a variable? Say I have testtuple = (1,2,3) testvar = 4 and want to get newtuple = (1,2,3,4)

[julia-users] Get dependencies (of a particular version) of a package?

2014-07-24 Thread Sam L
There doesn't appear to be a way to get the dependencies of a package from the API exposed in the Pkg module. I looked at the internals of the Pkg modules but didn't become enlightened. Specifically, I want to be able to get a list of dependencies for a given package and version. It would also

[julia-users] How to read data from a file to a new sparse matrix?

2014-07-24 Thread paul analyst
how to read data from a file to a new sparse matrix? date = readcsv (" data.txt") Paul

Re: [julia-users] Disable assertions?

2014-07-24 Thread Tim Holy
On Thursday, July 24, 2014 12:09:59 PM Magnus Lie Hetland wrote: > I saw a mention of a @debug macro somewhere on this list, > which I assume doesn't exist either? @debug is alive and well in Toivo's amazing Debug.jl package. But since debugging will change radically once Keno's work lands, I wo

Re: [julia-users] Disable assertions?

2014-07-24 Thread Magnus Lie Hetland
Tim: The startup option making @assert a no-op was what I had in mind, yes. Either specifically for this, or it could be linked to testing/debugging in general, perhaps? I saw a mention of a @debug macro somewhere on this list, which I assume doesn't exist either? Maybe both could be turned on b

Re: [julia-users] Disable assertions?

2014-07-24 Thread John Myles White
I'd love to have this functionality, but it's worth noting that some code (e.g. Optim) has assert being used for error handling right now. So there'd need to be a period where people transition away from using assertions for error-handling rather than for testing. -- John On Jul 24, 2014, at

Re: [julia-users] Disable assertions?

2014-07-24 Thread Tim Holy
I would bet it's just that no one has gotten around to implementing it yet. Feel free to take the reigns here. You could create a julia startup option that causes `@assert` to be defined as a no-op, which would completely eliminate any performance hit. --Tim On Thursday, July 24, 2014 05:43:07

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread yaoismyhero
Yes, now it works. Thanks! On Thursday, July 24, 2014 2:17:36 PM UTC-4, John Myles White wrote: > > That might be your problem. I only know how the release candidate for 0.3 > behaves. > > -- John > > On Jul 24, 2014, at 11:16 AM, yaois...@gmail.com wrote: > > Ah, gotcha. Splatting while using

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread John Myles White
That might be your problem. I only know how the release candidate for 0.3 behaves. -- John On Jul 24, 2014, at 11:16 AM, yaoismyh...@gmail.com wrote: > Ah, gotcha. Splatting while using push! produces a similar error message, > however. > > ERROR: no method push!(Array{Float64,1},Float64,Fl

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread yaoismyhero
Ah, gotcha. Splatting while using push! produces a similar error message, however. ERROR: no method push!(Array{Float64,1},Float64,Float64,Float64,Float64) I am using 0.2.1. On Thursday, July 24, 2014 2:13:58 PM UTC-4, John Myles White wrote: > > You must splat if you use push! > > You must _

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread John Myles White
You must splat if you use push! You must _not_ splat if you use append! -- John On Jul 24, 2014, at 11:10 AM, yaoismyh...@gmail.com wrote: > Even splatting does not seem to work. > My error message is now > ERROR: no method append!(Array{Float64,1},Float64,Float64,Float64,Float64) > Do I nee

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread yaoismyhero
Even splatting does not seem to work. My error message is now ERROR: no method append!(Array{Float64,1},Float64,Float64,Float64,Float64) Do I need to use a different sort of array? On Thursday, July 24, 2014 12:48:15 PM UTC-4, Jameson wrote: > > Yes > > Or use append! instead of push! > > > On

Re: [julia-users] Permutation data type for Julia

2014-07-24 Thread Kevin Squire
Dear Ed, Thank you for announcing this! I don't have any projects right now that need permutations, but I have in the past, and while there is some support for permutations in mainline Julia, permutations as a data type are definitely useful! I'm wondering if you're interested in creating an off

Re: [julia-users] comparison operators and code introspection

2014-07-24 Thread Kevin Squire
Hi Steve V., I would definitely suggest looking at base/sort.jl and base/order.jl to see how ordering is done in the current sorting framework. I'm hoping you'll submit your work to DataStructures.jl once you're comfortable, and it would be great if it worked with the existing sort infrastructure

[julia-users] Permutation data type for Julia

2014-07-24 Thread Ed Scheinerman
Dear all, I've created a Permutation data type for Julia. A Permutation object represents a permutation of a finite set of the form {1,2,...,n}. Operations include composition and inverses. Output is in disjoint cycle format. I hope someone finds this useful. It's available for download from g

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread John Myles White
I believe the main problem with the global scope isn't that it's called the global scope (rather than the scope of a let block), but that the scope is never terminated during a REPL session, preventing end-to-end analysis of types. -- John On Jul 24, 2014, at 7:14 AM, Arnaud Amiel wrote: > I

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread Jameson Nash
Yes Or use append! instead of push! On Thursday, July 24, 2014, wrote: > Ah, is ... equivalent to the * in Python? > > On Thursday, July 24, 2014 12:40:12 PM UTC-4, John Myles White wrote: >> >> You need to splat the tuple first: >> >> push!(tuplestorage,newtuple...) >> >> -- John >> >> On Ju

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread yaoismyhero
Ah, is ... equivalent to the * in Python? On Thursday, July 24, 2014 12:40:12 PM UTC-4, John Myles White wrote: > > You need to splat the tuple first: > > push!(tuplestorage,newtuple...) > > -- John > > On Jul 24, 2014, at 9:38 AM, yaois...@gmail.com wrote: > > > Hi, > > Translating some o

Re: [julia-users] Time constraint Julia computations

2014-07-24 Thread Jameson Nash
If you never call yield(), you never give the task an opportunity to see updates. (Sleep calls yield) On Thursday, July 24, 2014, Sebastian Vollmer wrote: > Additional Remark > Removing the sleep(0.1) in the > dowork() > function results in an infinite loop. Why is that and what can be done? > >

Re: [julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread John Myles White
You need to splat the tuple first: push!(tuplestorage,newtuple...) -- John On Jul 24, 2014, at 9:38 AM, yaoismyh...@gmail.com wrote: > Hi, > Translating some of my code from Python, I am trying to find a means of > concatenating and appending tuples to an array. > > In Python, I was able to

[julia-users] How to append tuples of floats to a Float64 array?

2014-07-24 Thread yaoismyhero
Hi, Translating some of my code from Python, I am trying to find a means of concatenating and appending tuples to an array. In Python, I was able to do this: def createtuplelist: tuplestorage = [] for i in range(iteration): newtuple = foo(i) tuplestorage.append(newtuple)

[julia-users] Re: comparison operators and code introspection

2014-07-24 Thread Steven G. Johnson
First, you should realize that == is defined for all types, but it may not do what you want for some types because it defaults to object equality. So checking whether == is defined is not helpful, even if it happens at compile time. (Currently, method_exists is evaluated at runtime, but it's

[julia-users] comparison operators and code introspection

2014-07-24 Thread vavasis
Dear Julia users, For my implementation of 2-3 trees (SortOrderDict{K,V}) under development, it is necessary for the keys to have a total order with the < operator. In many places in my code, I also want to compare keys using other comparison operators such as == or <=. It seems that there ar

[julia-users] Re: Time constraint Julia computations

2014-07-24 Thread Sebastian Vollmer
Additional Remark Removing the sleep(0.1) in the dowork() function results in an infinite loop. Why is that and what can be done? @everywhere function dowork(res,nZs) global toStop global steps while !toStop for j=1:steps localpart(res)[1]+=rand()

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread Arnaud Amiel
I believe this would solve my problem On Thursday, 24 July 2014 15:02:26 UTC+1, Tobias Knopp wrote: > So, question would be: Is it possible to have an include like command that > puts everthing into its own scope (using let?) >

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread Tobias Knopp
So, question would be: Is it possible to have an include like command that puts everthing into its own scope (using let?)? Am Donnerstag, 24. Juli 2014 15:48:26 UTC+2 schrieb Arnaud Amiel: > > Exactly my problem here, stuggling to understand what "global variables" > are in the context of what I

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread Arnaud Amiel
Exactly my problem here, stuggling to understand what "global variables" are in the context of what I see as a script which I assumed was running in its own context. I am new to Julia and hardly ever used dynamic languages before so lots of strange and magic behaviour here for me. Some of my p

[julia-users] Disable assertions?

2014-07-24 Thread Magnus Lie Hetland
If I read the code right, there's no standard way to disable assertions, right? Given that this is a rather common functionality in many languages, is this something you have explicitly decided not to support (in the default implementation)? It would be easy enough to roll my own – but if there

Re: [julia-users] Re: Help needed, running slow

2014-07-24 Thread Tomas Lycken
(Making an attempt at going back somewhat on topic...) I think some of the frustration here is also that it's not entirely obvious even from the performance tips that putting your code in a function will make such a huge difference.

[julia-users] Time constraint Julia computations

2014-07-24 Thread Sebastian Vollmer
I am trying to let Monte Carlo Code run until a time constraint is met. A simplified version of the code is below. I have two issues 1) I am trying to wait until a computation finishes but wait does not work so I currently use sleep which is crazy. What is wrong with wait. 2) I try to work with

Re: [julia-users] Confused on templated constructor idiom

2014-07-24 Thread Tim Holy
Does it work if you remove the {} from the inner constructor? I think inner constructors don't allow you to create any object type other than that of the containing type declaration. --Tim On Wednesday, July 23, 2014 09:26:23 PM Sheehan Olver wrote: > Hi, > > I'm trying to do the attached co

Re: [julia-users] Access to Distributed Arrays

2014-07-24 Thread Sebastian Vollmer
Thanks a lot. That was helpful.