Thanks a lot. That was helpful.
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
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
(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
http://docs.julialang.org/en/latest/manual/performance-tips/ that putting
your code in a function will make such a huge difference.
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
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
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 see
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?)
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()
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 are
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
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)
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 do
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 sjvoll...@gmail.com wrote:
Additional Remark
Removing the sleep(0.1) in the
dowork()
function results in an infinite loop. Why is that and what
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 javascript: wrote:
Hi,
Translating some of
Yes
Or use append! instead of push!
On Thursday, July 24, 2014, yaoismyh...@gmail.com 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
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
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
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
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
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
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 javascript: wrote:
Ah, gotcha. Splatting while
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
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
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
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
how to read data from a file to a new sparse matrix? date = readcsv (
data.txt)
Paul
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 =
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)]
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?
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)
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
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
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*
*end*
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
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 cnbiz...@gmail.com wrote:
I tested 2 ways of
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
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:
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}:
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/5T15:00:00
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 wrote:
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 cnbiz...@gmail.com wrote:
Thanks.
julia VA
3-element Array{ASCIIString,1}:
A
B
C
julia VA * T
ERROR: `*` has no method matching *(::Array{ASCIIString,1}, ::ASCIIString)
* 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 cnbiz...@gmail.com wrote:
julia VA
3-element
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 cnbiz...@gmail.com wrote:
julia VA
3-element Array{ASCIIString,1}:
A
B
C
julia VA * T
ERROR: `*` has no method matching *(::Array{ASCIIString,1},
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 cnbiz...@gmail.com wrote:
Well, * works with numerics
julia A = [1:5]
5-element Array{Int64,1}:
1
2
3
4
5
julia A *3
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
semantically equivalent
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 quite
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
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's
50 matches
Mail list logo