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

2014-03-25 Thread Andreas Lobinger
Have you though about to replace this with a Dict (associative array)? The dynamic names for a field in a matlab struct is (btw: this is recent) seen as a sort-of dict implementation.

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

2014-03-25 Thread Linus Mellberg
Yes, this is sort of what I was looking for, there is one problem though. f(i,j) will be called K times but there is only need for one call. Maybe this is a little better (no redundant calls to f()), but there still is a lot of unnecessary copying, maybe it will be optimized away? tmp = [f(i, j)

[julia-users] Re: Managing objects and state

2014-03-25 Thread Bob Cowdery
Thanks. So the type instance is passed in as a parameter. My problem is that if this is a remote call I can't see how to handle the state without having a global instance of State. Something like this so I first remote call somefunction() which sets some state and then remote call anotherfuncti

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

2014-03-25 Thread Linus Mellberg
Found this now... Not sure if readable, though. cat(3,[cat(2,[f(i,j) for i=1:n]...) for j=1:m]...) Den tisdagen den 25:e mars 2014 kl. 09:50:56 UTC+1 skrev Linus Mellberg: > > Yes, this is sort of what I was looking for, there is one problem though. > f(i,j) will be called K times but there is on

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

2014-03-25 Thread Tim Holy
It's not obvious that there is/should be a better way to do this. Arrays can hold arbitrary objects, and can be created using the comprehension syntax. The vector returned by your function is an object; hence, it should be contained within the array, not a dimension of the array. I'm not saying

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

2014-03-25 Thread Samuele Carcagno
On 25/03/14 01:25, j verzani wrote: 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. thanks, setting the parent t

[julia-users] Re: using Images error

2014-03-25 Thread Yakir Gagnon
I'll gladly try it. ... Sorry, but how exactly do you update the whole of Julia? On Tuesday, March 25, 2014 4:56:25 PM UTC+10, Ivar Nesje wrote: > > I don't get this error on yesterdays Julia master on OSX. The prerelease > is a moving target, and we usually don't want to spend much time on > d

Re: [julia-users] Re: using Images error

2014-03-25 Thread Tim Holy
On Tuesday, March 25, 2014 04:51:14 AM Yakir Gagnon wrote: > I'll gladly try it. > ... Sorry, but how exactly do you update the whole of Julia? >From within your clone of julia: git pull && make --Tim > > On Tuesday, March 25, 2014 4:56:25 PM UTC+10, Ivar Nesje wrote: > > I don't get this error

Re: [julia-users] Re: using Images error

2014-03-25 Thread Yakir Gagnon
Ah.. I get it. Cool, but unfortunately ran into this: Submodule 'deps/Rmath' () registered for path 'deps/Rmath' Submodule 'deps/libuv' () registered for path 'deps/libuv' Submodule 'deps/openlibm' () registered for path 'deps/openlibm' Submodule 'deps/openspecfun' () registered for path 'deps/op

Re: [julia-users] Re: using Images error

2014-03-25 Thread Ivar Nesje
This might do the job: make -C deps clean-openlibm && make If not you might need to clean all dependencies with make -C deps cleanall. Ivar kl. 13:33:24 UTC+1 tirsdag 25. mars 2014 skrev Yakir Gagnon følgende: > > Ah.. I get it. > Cool, but unfortunately ran into this: > > Submodule 'deps/Rmat

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
Yeah, I get a "ERROR: no method Triangular{..." error, because my type doesn't subtype Number. If I do subtype number, then it wants a conversion function to convert it to a float, so it can use the LAPACK routines. -Jim On Tuesday, March 25, 2014 9:22:29 AM UTC-5, Andreas Noack Jensen wrote: >

[julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
I have a type I've defined. It's not a number, but it has all arithmetic operations defined for it. Is there a way to calculate the inverse of a matrix of a user defined type? For example, if I was to define: a = [mytype(1) mytype(2); mytype(3) mytype(4)] b = inv(a) Looking through base, there

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread Andreas Noack Jensen
Have you tried to invert it? Maybe it works already. There is a generic inv in base/linalg/generic.jl. You'll have to define a one method for you type and maybe also a zero method. 2014-03-25 15:14 GMT+01:00 James Crist : > I have a type I've defined. It's not a number, but it has all arithmetic

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

2014-03-25 Thread J Luis
Short answer - no A bit longer one. I am reasonably experienced Matlab and C user and too often I find myself in the position "how-do-I-port-this-ML(and-sometimes-C)-solution-to-julia". Unfortunately, concepts that are not so familiar to me tend to be left behind to a second round, a part of i

Re: [julia-users] GLM lm error

2014-03-25 Thread John Myles White
I think it might be best to wait until 0.3 to sort this out as there are several moving targets interacting here. — John On Mar 20, 2014, at 9:42 AM, Jason Solack wrote: > I found the nightlies, but i am still getting an error > > julia> using GLM, RDatasets > > julia> form = dataset("datas

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread Andreas Noack Jensen
I don't think you are right about LAPACK. The code tries to promote to a type which is stable under lu factorizing which is the intermediate step in the calculation. The problem could be that your matrix type is not inferred correctly. Please try to let your type by subtype of Number and then defin

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
I'm probably not. New to this language, still figuring things out. The matrix type seems to be inferred correctly though. I'll put a gist up in a bit to try and get some more relevant feedback. On Tuesday, March 25, 2014 9:54:53 AM UTC-5, Andreas Noack Jensen wrote: > > I don't think you are rig

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

2014-03-25 Thread John Myles White
I think that kind of splitting of functionality would out well. I made this change because I wanted to have a unified interface as soon as possible and the potential cyclical dependency between DualNumbers and Calculus2 was something I needed to avoid. But once you have such a unified interface

Re: [julia-users] Re: using Images error

2014-03-25 Thread Yakir Gagnon
Hmm, make cleanall didn't do it either. I'll just reinstall from scratch (in home - so not in root). Thanks anyways!!! On Tuesday, March 25, 2014 11:49:53 PM UTC+10, Ivar Nesje wrote: > > This might do the job: > > make -C deps clean-openlibm && make > > If not you might need to clean all depende

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread Andreas Noack Jensen
A gist would be helpful. By the way, which version of Julia are you running? 2014-03-25 16:19 GMT+01:00 James Crist : > I'm probably not. New to this language, still figuring things out. The > matrix type seems to be inferred correctly though. I'll put a gist up in a > bit to try and get some mo

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

2014-03-25 Thread Miles Lubin
> > But once you have such a unified interface, why call the result > Derivatives? What’s left for Calculus except the content of Derivatives? > Will Calculus just be a symbolic calculus system? > I don't have a strong opinion on the naming, but it seemed reasonable. Calculus also has simplificati

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
Here's the gist: https://gist.github.com/jcrist/ad663d6bdc4d82896176 I tried to simplify everything down to just the bare essentials, but there may be something I missed. Gives the same error as it did in the full code though, so I think I got it all. I'm running version 0.2.0. Thanks, -Jim O

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
I just realized that my test case is obviously singular, so not invertible. But I don't think it even gets to the actual inversion code before erroring, so I doubt that's the problem. -Jim On Tuesday, March 25, 2014 10:38:45 AM UTC-5, James Crist wrote: > > Here's the gist: https://gist.github.

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread Andreas Noack Jensen
Okay. Now I understand what is going on. I would like something like this to work. I'll have to go now, but will think about what to do. 2014-03-25 16:40 GMT+01:00 James Crist : > I just realized that my test case is obviously singular, so not > invertible. But I don't think it even gets to the

[julia-users] Re: Build Failure "undefined symbol: rl_signal_event_hook"

2014-03-25 Thread nicolas . carpi
Yes I can confirm that doing this will solve the problem :) On Saturday, March 22, 2014 11:29:50 AM UTC+1, Michael Hatherly wrote: > > Update on the problem: > If you add *USE_SYSTEM_READLINE=1* to your *Make.user* file and then run > *make > cleanall* it should resolve this issue. This is menti

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

2014-03-25 Thread David P. Sanders
El lunes, 24 de marzo de 2014 17:55:39 UTC-6, Jacob Quinn escribió: > > 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 ge

[julia-users] Winston colormap

2014-03-25 Thread Hisham Assi
For the command colormap (*name::String*[, *n=256*]) *, what values are available for name::string other than "jet" ?* *It would be for helpful to have density plot command like the one in Mathematica. **It would be something like the density(m x n Array{Float64,2}, n-element **Array{Float64,1},

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
Cool. Thanks a bunch. If there is some way this could be made to work without subtyping Number, that would be even better. While all numeric operators work on this type, they aren't really numbers, and treating them as such elsewhere may cause problems. -Jim On Tuesday, March 25, 2014 11:18:06

[julia-users] How to use weight in the data.

2014-03-25 Thread paul analyst
How to use weight in the data. Often in social research data are used in weight. It is one variable (column) indicates how much a given row in the data set is weighed (average weight = 1). Typical weights are numbers in the range 0.01 - 10.0 but can be any positive numbers. Sums, averages, and

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

2014-03-25 Thread Stefan Karpinski
This is a somewhat dubious feature borrowed from Matlab. I think we should deprecate and then drop it. On Mon, Mar 24, 2014 at 11:01 PM, Sam L wrote: > 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

Re: [julia-users] How to use weight in the data.

2014-03-25 Thread Stefan Karpinski
StatsBase provides extensive support for weights: http://statsbasejl.readthedocs.org/en/latest/ On Tue, Mar 25, 2014 at 12:51 PM, paul analyst wrote: > How to use weight in the data. Often in social research data are used in > weight. It is one variable (column) indicates how much a given row

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

2014-03-25 Thread J Luis
> This is a somewhat dubious feature borrowed from Matlab. I think we should > deprecate and then drop it. > That furthermore does not work like the Matlab one ... but would be nice if it did > > > On Mon, Mar 24, 2014 at 11:01 PM, Sam L >wrote: > >> After some experimentation, it looks

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

2014-03-25 Thread Stefan Karpinski
You just need to convert the string to a symbol first: julia> type Foo bar baz end julia> foo = Foo(1,2) Foo(1,2) julia> foo.("bar") ERROR: type: getfield: expected Symbol, got ASCIIString julia> foo.(symbol("bar")) 1 The feature is likely to be removed rather than ex

[julia-users] Re: Winston colormap

2014-03-25 Thread Alex
Hi Hisham, There is imagesc in Winston, which is similar to ListDensityPlot in Mathematica and uses the current colormap (set by Winston.colormap). AFAIK "jet" is the only colormap defined in Winston. However, you can use the colormaps

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

2014-03-25 Thread J Luis
Terça-feira, 25 de Março de 2014 17:47:28 UTC, Stefan Karpinski escreveu: > > You just need to convert the string to a symbol first: > > julia> type Foo > bar > baz >end > > julia> foo = Foo(1,2) > Foo(1,2) > > julia> foo.("bar") > ERROR: type: getfield: expected Symbol,

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

2014-03-25 Thread Stefan Karpinski
First, because it's a total gotcha that putting something in parentheses changes its meaning. In Matlab, things are so inconsistent in terms of where you can and can't use various syntaxes, that this is hardly the biggest issue, but Julia's pretty consistent and this is the *only* place in the lang

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

2014-03-25 Thread J Luis
Terça-feira, 25 de Março de 2014 18:15:28 UTC, Stefan Karpinski escreveu: > > First, because it's a total gotcha that putting something in parentheses > changes its meaning. In Matlab, things are so inconsistent in terms of > where you can and can't use various syntaxes, that this is hardly the

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

2014-03-25 Thread Patrick O'Leary
On Tuesday, March 25, 2014 1:27:47 PM UTC-5, J Luis wrote: > > Sure, sometimes you might *really* want to do this despite the drawbacks, >> but in that case using the getfield(foo,:bar) syntax for it is just fine. >> > > I'm perfectly fine with that but PLEASE, add to the manual that one can > al

Re: [julia-users] Re: Basic Operating System in Julia

2014-03-25 Thread Collin Glass
Thanks Julia! Great info. This is definitely interesting! At this time I'm learning! If anyone is doing this, I'd be glad to help! On Thursday, March 20, 2014 10:50:08 PM UTC-4, Julia Evans wrote: > > Amazing thread. > > Certainly writing an OS in Julia wouldn't be easy (for basically the same

[julia-users] function hook into variable changes

2014-03-25 Thread Keith Mason
I have a number of variables based on composite types. I want the fields of these variables synced to disk, so that every time I modify a field, the data is written to disk. Is there any way to do this with assignment notation? For example, type Foo x::Int32 y::Int16 z::Int16 function

[julia-users] Re: function hook into variable changes

2014-03-25 Thread Patrick O'Leary
On Tuesday, March 25, 2014 3:48:22 PM UTC-5, Keith Mason wrote: > > The docs state that there is a setfield! function that is called for a.b = > c, but the language disagrees. Apparently it's actually named setfield (no > exclamation point). > The change to `setfield!()` was about a month ago:

[julia-users] Re: function hook into variable changes

2014-03-25 Thread Patrick O'Leary
On Tuesday, March 25, 2014 3:48:22 PM UTC-5, Keith Mason wrote: > > I have a number of variables based on composite types. I want the fields > of these variables synced to disk, so that every time I modify a field, the > data is written to disk. Is there any way to do this with assignment > nota

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Stefan Karpinski
You're looking for #1974 . Once that's done, you will be able to do this, but not until then. On Tue, Mar 25, 2014 at 4:48 PM, Keith Mason wrote: > I have a number of variables based on composite types. I want the fields > of these variables synce

[julia-users] Re: function hook into variable changes

2014-03-25 Thread Keith Mason
I definitely understand that. I would honestly prefer to be able to memory map directly to the disk file and let the OS do the writes behind the scenes. Less potential for performance penalties that way. But I haven't found a way in Julia to do that. mmap_array obviously only takes arrays a

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

2014-03-25 Thread Steven G. Johnson
The analogue of Python's None in Julia is nothing (which will get converted to None on the Python side), whereas None in Julia is a completely different object (an empty type union, in fact). So, try just passing nothing (without the quotes) instead of None.

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Jameson Nash
Could you do all of the work in a finalizer ? On Tuesday, March 25, 2014, Keith Mason wrote: > I definitely understand that. I would honestly prefer to be able to > memory map directly to the disk file and let the OS do the writes behind > the scenes. Less potential for performance penalties t

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

2014-03-25 Thread Steven G. Johnson
On Tuesday, March 25, 2014 5:12:30 PM UTC-4, Steven G. Johnson wrote: > > So, try just passing nothing instead of None. > Oh, nevermind, I see that you did that. Regarding whether it is garbage-collected, you have to make sure that you aren't holding any references to the object. (Once a Python

[julia-users] Request to make peer address available

2014-03-25 Thread Bob Cowdery
I'm sending a UDP broadcast and getting a response using recv(). I need to now start a conversation with the other end. As far as I can tell the _uv_hook_recv(sock::UdpSocket, nread::Ptr{Void}, buf_addr::Ptr{Void}, buf_size::Int32, addr::Ptr{Void}, flags::Int32) which I believe is the read cal

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

2014-03-25 Thread j verzani
Thanks for that clarification, wasn't sure exactly how that happened. On Tuesday, March 25, 2014 5:16:24 PM UTC-4, Steven G. Johnson wrote: > > On Tuesday, March 25, 2014 5:12:30 PM UTC-4, Steven G. Johnson wrote: >> >> So, try just passing nothing instead of None. >> > > Oh, nevermind, I see that

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Jameson Nash
Or you could make a do block, to create a scope for an explicit finalization step On Tuesday, March 25, 2014, Stefan Karpinski wrote: > If you use an immutable type and replace whole records, then you can mmap > it: > > julia> immutable Foo > bar::Int > baz::Float64 >en

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Keith Mason
This is a database application, with a large number of rows per table. So probably not, for two reasons. One, in the event the application crashes, I would like the data to be updated to disk on a per transaction basis. I can deal with the problem of when to call flush() separately. Two, I wou

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Stefan Karpinski
If you use an immutable type and replace whole records, then you can mmap it: julia> immutable Foo bar::Int baz::Float64 end julia> foos = Array(Foo,10) 10-element Array{Foo,1}: Foo(0,0.0) Foo(0,0.0) Foo(0,0.0) Foo(0,0.0) Foo(0,0.0) Foo(0,0.0) Foo(0,0.0) Foo(0,0.0

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

2014-03-25 Thread Tony Kelman
> The dynamic names for a field in a matlab struct is (btw: this is recent) To pick a nit, dynamic field names for structs have been around since R13, not what I'd call recent: http://blogs.mathworks.com/loren/2005/12/13/use-dynamic-field-references/ The containers.Map version was added in R20

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Keith Mason
Why not foos[1].bar instead of the 'convert / unsafe_load' code? While my data really isn't immutable, this might be ok if there is a relatively cheap way to create a copy of an immutable object while changing one or two values. For example, immutable Foo x::Int y::Float64 Foo(old::Foo;

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread andrew cooke
something like this does work: julia> using IntModN julia> a = [GF2(1) GF2(1); GF2(0) GF2(1)] 2x2 Array{ZField{2,Int64},2}: 1 1 0 1 ulia> b = inv(a) 2x2 Array{ZField{2,Int64},2}: 1 1 0 1 julia> b * a 2x2 Array{ZField{2,Int64},2}: 1 0 0 1 that's all GF(2), not integers. i do subc

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Stefan Karpinski
On Tue, Mar 25, 2014 at 6:32 PM, Keith Mason wrote: > Why not foos[1].bar instead of the 'convert / unsafe_load' code? Because I wanted to show that the values are stored inline, rather than heap allocated. That may have been clear to me but perhaps not so clear to anyone else. Consider, for co

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread andrew cooke
references https://groups.google.com/forum/#!msg/julia-users/Ui977brdzAU/u4rWiDeJv-MJ https://github.com/andrewcooke/IntModN.jl On Tuesday, 25 March 2014 20:19:32 UTC-3, andrew cooke wrote: > > > something like this does work: > > julia> using IntModN > > julia> a = [GF2(1) GF2(1); GF2(0) GF2(1

Re: [julia-users] Inverse of a matrix of user defined type?

2014-03-25 Thread James Crist
Thanks for the tip! I knew this should be possible (even with a bit of work). Looking through the github issues and PRs, it looks like this functionality is slated for 0.3. I've been using 0.2. Suppose it's time to upgrade to the nightlies... :) -Jim On Tuesday, March 25, 2014 6:47:02 PM UTC-5

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Keith Mason
Got it, thanks. In these terms, I guess I wish that there was an option for mutable composite types to be stored inline rather than heap allocated. Anyway, this has been helpful, if only to confirm that there isn't a great way to do what I want. I need to rethink the problem space. > On Mar 25,

[julia-users] Julia optimization for mapping data classifications

2014-03-25 Thread Shaun Walbridge
Hello, I've been playing around with Julia for some data classifiers commonly used in mapping, such as the Jenks "natural breaks" algorithm. (For background and a Javascript implementation, I highly recommend Tom MacWright's literate

[julia-users] Re: Julia optimization for mapping data classifications

2014-03-25 Thread Simon Kornblith
Your algorithm looks fine. The problems are entirely in your testing script. The first issue is that JSON.parse returns a Vector{Any}, which deoptimizes everything. Try: f = open("test.json") data = convert(Vector{Float64}, JSON.parse(f)) The second issue is that you're including compilation ti

[julia-users] Help understanding types parameterized by constants

2014-03-25 Thread Glen Hertz
Hi, Perhaps I'm doing this the wrong way but I wanted to parameterize some types by a constant, Year, like so: abstract TaxForm{Year} type Form1{2013} <: TaxForm{2013} a b c Form1{2013}() = new(0.0, 0.0, 0.0) end type Form1{2012} <: TaxForm{2012} a b # no C field

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Stefan Karpinski
On Tue, Mar 25, 2014 at 8:11 PM, Keith Mason wrote: > Got it, thanks. In these terms, I guess I wish that there was an option > for mutable composite types to be stored inline rather than heap allocated. > That's often called a (mutable) value type. E.g. C# distinguishes reference types – object

Re: [julia-users] Help understanding types parameterized by constants

2014-03-25 Thread Jameson Nash
the short answer is: you can't do that the slightly longer answer is: make a unique type name for each and add functions that map from year to the form and vice versa. macros can be handy for this: macro tax_year(year, typ) typ.head == :type || error("bad type") typename = esc(typ.args[2])

Re: [julia-users] function hook into variable changes

2014-03-25 Thread Jameson Nash
I'll expand on my iphone post with some pseudo-code. do blocks make a convenient way to express the concept of a group of actions. using this, we can implement simple, behind-the-scenes atomic storage semantics. note that I'm (mis)treating saveable as both some reference into the database, and it'

[julia-users] Re: Gauss quadrature package

2014-03-25 Thread Bill McLean
Hello Santi Ponte, I am not any kind of expert on the QL iteration. All I can suggest is to check the references listed in the source file src/GaussQuadrature.jl at lines 65-71 and 303-306. Essentially, I just rewrote the original Fortran version gaussq.f first into Fortran 90 and then into Ju

[julia-users] Re: writedlm problem

2014-03-25 Thread Tanmay K. Mohapatra
Hi, Thanks for bringing it to attention. This should now be fixed in the master branch. - Tanmay On Saturday, March 22, 2014 12:30:28 AM UTC+5:30, Eythan Weg wrote: > > > Hi, > > I think this should work: > > julia> a=["a" "b"; "d" ""] > 2x2 Array{ASCIIString,2}: > "a" "b" > "d" "" > >