[julia-users] JSON parsing into Matrix (checkbounds error)

2014-03-26 Thread Collin Glass
Hi, I'm creating a TCP client for a bomberman game in Julia. I need to 
parse the current state of the gameboard (which is a lot of tiles).

Sample JSON,

{{["Name"=>"Wall"],["Name"=>"Wall"],["Name"=>"Wall"],["Name"=>"Rock"],...},{...,["Name"=>"Wall"],...},...}

I am new to Julia, as such I am intrigued to make use of the Array{Cell,2}. 
to represent my board.

The board is 23rowx51column.

I seem to be getting the following error.

MethodError(checkbounds,(51,{["Name"=>"Wall"],["Name"=>"Wall"],["Name"=>"Wall"],...})

I took a look at the abstractarray.jl in base, but didn't get any answers.

Is there a limit on the size of the array?


Re: [julia-users] worker/proc nomenclature

2014-03-26 Thread Amit Murthy
In a parallel environment, the thinking is that all computations are
performed in "worker" processes, with pid 1, usually being the driver
process that does not do any actual computations itself.

processors should probably be changed to processes to maintain consistency.


On Wed, Mar 26, 2014 at 5:24 PM, Ben Arthur  wrote:

> if "procs() Returns a list of all process identifiers."
>
> and "workers() Returns a list of all worker process identifiers."
>
> then why do we "rmprocs(pids...) Removes the specified workers." instead
> of rmworkers()? particularly since
>
> julia> rmprocs(1)
> WARNING: rmprocs: process 1 not removed
> :ok
>
> similarly, why do we "addprocs() Add processes on remote machines" and not
> addworkers()?
>
> the above terminology seems a bit odd in a language which puts so much
> emphasis on expressiveness.
>
>
> note that there is what i believe to be a typo in the current
> documentation.  these both should refer to *processes* i believe, not
> processors.
>
> "nprocs() Get the number of available processors."
> "nworkers() Get the number of available worker processors."
>
>


[julia-users] Pkg.publish broken?

2014-03-26 Thread Sheehan Olver
I'm trying to Pkg.publish() but get the following errors, even after 
remaking on the latest build and restarting my METADATA.jl:

*julia> **Pkg.publish()*

*INFO: Validating METADATA*

*INFO: No new package versions to publish*

*INFO: Submitting METADATA changes*

*INFO: Forking JuliaLang/METADATA.jl to dlfivefifty*

Enter host password for user 'dlfivefifty':

*ERROR: key not found: "token"*

* in getindex at dict.jl:586*

* in token at pkg/github.jl:53*

* in req at pkg/github.jl:61*

* in POST at pkg/github.jl:74*

* in fork at pkg/github.jl:87*

* in pull_request at pkg/entry.jl:290*

* in publish at pkg/entry.jl:355*

* in anonymous at pkg/dir.jl:28*

* in cd at file.jl:22*

* in cd at pkg/dir.jl:28*

* in publish at pkg.jl:57*


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

2014-03-26 Thread Luis Benet
Hi Jason,


> It looks like the scope of this is very similar to PowerSeries.jl. We 
> should do some benchmarking and API bikeshedding, and think about combining 
> efforts.
>
> Are there places your new package is obviously superior? I see 
> L'Hospital's rule for division: that's a nice idea.
>
>
Indeed there are a lot of similarities. I have not tested `PowerSeries.jl`, 
but from the readme-file it seems to me that the basic technique is 
somewhat different. We use automatic differentiation to obtain f( p(x) ) as 
a polynomial series, with p(x) is a given polynomial. This means using 
certain recurrence relations to calculate the coefficients of the 
expansion. You use the fundamental theorem of calculus. Our project began 
on an effort to learn `julia` (doing something concrete) and the lectures 
on advanced numerical methods we gave at UNAM last semester.

Do you have some concrete ideas for bechmarking? We certainly should 
combine efforts.

Luis


[julia-users] Interfaces like in Go

2014-03-26 Thread Dom Luna
I really like how interfaces work in Go and I was wondering if there's a 
similar way to express this in Julia. For those who are unfamiliar with Go 
interfaces they're essentially types defined by behaviour (functions) and 
not by fields.

So for example the ReadWriter interface implements the Read and Write 
method, other defined types that have a Read and Write method can be 
considered a ReadWriter.

Dom


[julia-users] current status of specialisation on function valued args

2014-03-26 Thread andrew cooke

hi,

did this - 
https://groups.google.com/d/msg/julia-dev/AP8AibF9Iuk/fMuMqBt5EfwJ - happen?

couldn't find an issue.

thanks,
andrew


[julia-users] imwrite ImageCmap

2014-03-26 Thread Yakir Gagnon
Stuck... Can someone give me an example of imwriting the output from 
ImageCmap? So this for instance does not work (taken from "Using Image.jl 
for false-color 
maps"
):

using Images, Color 

# build a sample image 
datafloat = reshape(linspace(0.5, 1.5, 6), 200, 300) 
# convert the raw 0.5:1.5 data to a integer type, so we can index 
dataint = iround(Uint8, 254*(datafloat - 0.5) + 1)  # ranges from 1 to 255 
# build our colormap 
b = RGB(0,0,1) 
w = RGB(1,1,1) 
r = RGB(1,0,0) 
cmaprgb = Array(RGB, 255) 
f = linspace(0,1,128) 
cmaprgb[1:128] = [(1-x)*b + x*w for x in f] 
cmaprgb[129:end] = [(1-x)*w + x*r for x in f[2:end]] 


img = ImageCmap(dataint, cmaprgb) 


imwrite(img,"image.jpg")


and results in: 

ERROR: no method scale(ScaleNone{Uint8},RGB)

I tried all sorts of tricks and changes to no avail... 

Thanks in advance!




[julia-users] Re: PySide QSizePolicy

2014-03-26 Thread j verzani
Try this for example, 

QtGui = PyCall.pyimport("PySide.QtGui") 
QtGui["QSizePolicy"]["Fixed"],

On Wednesday, March 26, 2014 5:20:11 PM UTC-4, Samuele Carcagno wrote:
>
> another PySide question, how to set `QSizePolicy`? for example how to 
> translate the following Python code 
>
>  loadParametersButton.setSizePolicy(QSizePolicy.Expanding, 
> QSizePolicy.Expanding) 
>
> I tried looking for `QSizePolicy` in Qt properties but didn't find it 
>
>  pyimport("PySide.QtCore")["Qt"][:QSizePolicy] 
>  ERROR: key not found: "QSizePolicy" 
>
>
> Sam 
>


Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Tim Holy
This is spelled out in the paper
   P. Thevenaz, T. Blu, and M. Unser (2000). "Interpolation Revisited."
   IEEE Transactions on Medical Imaging, 19: 739-758.
Basically, the idea is that interpolation computes values from a set of 
coefficients:
y(x) = sum_i coef_i * f_i(dx_i)
where dx_i comes from a displacement of x. For an "interpolating" function, 
the coefficients are the actual on-grid values of the function you're trying to 
interpolate. However, you can generalize the notion to "non-interpolating" 
expressions, where the coefficients are distinct from the on-grid values. You 
can pretty quickly convince yourself that this is necessary, for example, if 
you want to have 3-point quadratic interpolation with continuous derivatives. 
The coefficients turn out to be related to the on-grid values via a simple 
tridiagonal matrix equation (which is fast to invert).

Explicitly, for quadratic interpolation you can convince yourself that the 
only expression with continuous derivatives at the half-point between integers 
is
   y(alpha) = (alpha-0.5)^2*ym/2 + (.75-alpha)^2*y0 + (alpha+0.5)^2*yp/2
where |alpha| <= 0.5 and ym,y0,yp are the interpolation coefficients. Plug in 
alpha=0, and you can see that you don't recover y0. Hence it's "non-
interpolating."

--Tim

On Wednesday, March 26, 2014 05:00:36 PM Stefan Schwarz wrote:
> > Hello Tim,
> 
> this is maybe not the right place to ask this question,
> but may you elaborate on that matter, that interp_invert!
> compensates "the non-interpolating" issue of
> the quadratic?
> 
> Thanks in advance
> 
> Stefan


Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Stefan Schwarz

>
> Hello Tim,


this is maybe not the right place to ask this question,
but may you elaborate on that matter, that interp_invert!
compensates "the non-interpolating" issue of 
the quadratic?

Thanks in advance

Stefan


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

2014-03-26 Thread Jason Merrill
On Wednesday, March 26, 2014 12:47:47 PM UTC-7, Luis Benet wrote:
>
> Hi,
>
> I have followed the discussion, and would like to announce a package that 
> we are developing:
> https://github.com/lbenet/TaylorSeries.jl 
> since it does a bunch of things discussed above, though so far for 1 
> independent variable. It expands
> different functions (so far a limited number of basic functions) 
> considering them as Taylor polynomials
> around a given point, using automatic differentiation techniques. There is 
> still a bunch of things to
> do, among other to extend it to more independent variables.
>
> Your feedback will be appreciated.
>

Hi Luis,

It looks like the scope of this is very similar to PowerSeries.jl. We 
should do some benchmarking and API bikeshedding, and think about combining 
efforts.

Are there places your new package is obviously superior? I see L'Hospital's 
rule for division: that's a nice idea.

Jason
 

> Luis
>


Re: [julia-users] Re: Anonymous types

2014-03-26 Thread Jacques Rioux
jacques.ri...@outlook.com
On Jan 9, 2014 6:48 PM, "Patrick O'Leary"  wrote:

> On Thursday, January 9, 2014 4:37:42 PM UTC-6, Brian Nguyen wrote:
>>
>> Types are first class objects. How to write anonymous types in Julia?
>
>
> Never one to discourage bad ideas, I offer this old code (which I note
> didn't make the transition from extras/strpack.jl to StrPack.jl, the
> module):
>
> function gen_type(types)
> @gensym struct
> fields = gen_typelist(types)
> typedef = quote
> type $struct
> $(fields...)
> end
> $struct
> end
> eval(typedef)
> end
>
>
>


[julia-users] PySide QSizePolicy

2014-03-26 Thread Samuele Carcagno
another PySide question, how to set `QSizePolicy`? for example how to 
translate the following Python code


loadParametersButton.setSizePolicy(QSizePolicy.Expanding, 
QSizePolicy.Expanding)


I tried looking for `QSizePolicy` in Qt properties but didn't find it

pyimport("PySide.QtCore")["Qt"][:QSizePolicy]
ERROR: key not found: "QSizePolicy"


Sam


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

2014-03-26 Thread Luis Benet
Hi,

I have followed the discussion, and would like to announce a package that 
we are developing:
https://github.com/lbenet/TaylorSeries.jl 
since it does a bunch of things discussed above, though so far for 1 
independent variable. It expands
different functions (so far a limited number of basic functions) 
considering them as Taylor polynomials
around a given point, using automatic differentiation techniques. There is 
still a bunch of things to
do, among other to extend it to more independent variables.

Your feedback will be appreciated.

Luis

PS To show `TaylorSeries.jl` in action, let's take the example used above:

julia> using TaylorSeries

julia> f(x) = exp(x) / sqrt(sin(x)^3 + cos(x)^3)
f (generic function with 1 method)

julia> x(a) = Taylor( [a, 1], 5) ## (Taylor) polynomial of order 5 defining 
the independent variable at `a`
x (generic function with 1 method)

julia> y = f( x(1.5) )
Taylor{Float64}([4.49778,4.05343,4.73154,5.36132,4.06444,5.23141],5)

julia> y.coeffs[2]  ## 1st derivative is 2nd coefficient of polynomial 
yields the exact **exact**
4.053427893898621

julia> y = f( x(BigFloat("1.5")) );  ## works with extended precision

julia> y.coeffs[2]  ## 1st derivative is 2nd coefficient of polinomial
4.053427893898620657714187925608000714382656705202585322932424288003661237316682e+00
 
with 256 bits of precision

julia> factorial(5)*y.coeffs[6] ## 5th derivative at 1.5; note the 
`factorial(5)` to get the correct result
6.277689946559323997824589834578817604634018957684303411466508065816203247844982e+02
 
with 256 bits of precision




Re: [julia-users] Byte Order

2014-03-26 Thread Stephen Chisholm
That should do it. Thanks!

On Wed, Mar 26, 2014 at 3:48 PM, Jacob Quinn  wrote:
> Is this what you're looking for?
>
>
> On Wed, Mar 26, 2014 at 2:43 PM, Stephen Chisholm 
> wrote:
>>
>> Is there currently a way to specify network byte order when calling... ?
>>
>> read(io_stream, Uint16)
>
>


Re: [julia-users] Byte Order

2014-03-26 Thread Jacob Quinn
Is this  what
you're looking for?


On Wed, Mar 26, 2014 at 2:43 PM, Stephen Chisholm wrote:

> Is there currently a way to specify network byte order when calling... ?
>
> read(io_stream, Uint16)
>


[julia-users] Byte Order

2014-03-26 Thread Stephen Chisholm
Is there currently a way to specify network byte order when calling... ?

read(io_stream, Uint16)


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

2014-03-26 Thread Keith Mason

>
> I'll expand on my iphone post with some pseudo-code. 


This is interesting; not something I was aware was possible.  I'll dig into 
it a bit deeper, thanks!

On Tuesday, March 25, 2014 10:22:48 PM UTC-5, Jameson wrote:
>
> 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's value. 
>
> function atomic_action(callable, saveable) 
>old_row = copy(saveable) 
>lock_row(saveable) 
>try 
>  callable(saveable) 
>  save_row(saveable - old_row) 
>finally 
>  unlock_row(saveable) 
>end 
> end 
> function eager_atomic_action(callable, saveable) 
> old_saveable = get_current(saveable) 
> callable(saveable) 
> lock_row(saveable) 
> try 
>assert_that( old_saveable == get_current(saveable)) 
>save_row(saveable) 
> finally 
>unlock_row(savable) 
> end 
> end 
>
> atomic_action(a) do b 
>   b.x += 2 
> end # b.x is saved here, unless we threw an error 
>
>
> On Tue, Mar 25, 2014 at 10:57 PM, Stefan Karpinski 
> > 
> wrote: 
> > 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 – objects that are passed and assigned by reference/sharing – from 
> > value types, which are like C structs and are passed and assigned by 
> > copying. (If you think of reference types as pointers to objects, you're 
> > basically right). Rather than introducing two radically semantically 
> > different kinds of types, we opted for mutable versus immutable which 
> have 
> > the same semantics except for the obvious difference that you can't 
> mutate 
> > an immutable value. This distinction is much simpler to understand and 
> nice 
> > for lots of things, but it is occasionally limiting. 
> > 
> >> 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. 
> > 
> > 
> > Have you considered column-oriented storage where each column is 
> homogenous 
> > and can be mmapped? 
>


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

2014-03-26 Thread Keith Mason

>
> Have you considered column-oriented storage where each column is 
> homogenous and can be mmapped?
>
 
That is actually the direction I am going in.  It doesn't make sense for 
all of my tables, but I think it might be the right approach for most of 
them.

On Tuesday, March 25, 2014 9:57:08 PM UTC-5, Stefan Karpinski wrote:
>
> 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 – objects that are passed and assigned by reference/sharing 
> – from value types, which are like C structs and are passed and assigned by 
> copying. (If you think of reference types as pointers to objects, you're 
> basically right). Rather than introducing two radically semantically 
> different kinds of types, we opted for mutable versus immutable which have 
> the same semantics except for the obvious difference that you can't mutate 
> an immutable value. This distinction is much simpler to understand and nice 
> for lots of things, but it is occasionally limiting.
>
> 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.
>>
>
> Have you considered column-oriented storage where each column is 
> homogenous and can be mmapped?
>


Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Simon Kornblith
You could write a C interface to the C++ spline library and then ccall that 
from Julia. That's probably not too much work, but I can't promise that the 
interface plus the port to Julia would be less work than fixing the 
segfaults.

Simon

On Wednesday, March 26, 2014 10:30:52 AM UTC-4, Tomas Lycken wrote:
>
> I'd happily use quadratic interpolation if it weren't for that exact 
> limitation - I *do* need continuous second derivatives in the 2D 
> interpolation...
>
> I've never actually implemented spline interpolation myself, so I'd 
> probably have to spend quite a lot of time delving into the current code to 
> understand how it works and how to add to it. Might be good exercise, but 
> unfortunately not something I have time for at the moment. It's an 
> interesting learning project, though, so I'll definitely consider coming 
> back to it later =)
>
> The reason I started this thread was that I'm currently working on a quite 
> large project (my masters thesis project) in C++, but after realizing today 
> that my current codebase has some deeply nested memory management issues 
> that I'm having difficulties troubleshooting, I wanted to see if it would 
> be possible to port the project to Julia in a relatively short amount of 
> time. For that purpose, I wanted to see if all the stuff I'm doing through 
> external C++ libraries was implemented in Julia packages as well, so that I 
> wouldn't have to write any Julia code for stuff that I haven't had to write 
> C++ code for. Cubic splines was the only missing piece of the puzzle :P 
> However, implementing a cubic spline interpolation routine is, 
> unfortunately, well out of scope for my thesis, so it will have to wait 
> until I have time to spend on it. Until then, I'd better get back to those 
> segfaults...
>
> // T
>
> On Wednesday, March 26, 2014 2:54:55 PM UTC+1, Tim Holy wrote:
>>
>> I should also add that unless you need a continuous second derivative, 
>> quadratic (while not as popular) is IMO nicer than cubic in several 
>> ways---for 
>> example, by requiring fewer points (27 rather than 64 in 3 dimensions), 
>> it's 
>> faster to evaluate. I suspect the main reason quadratic isn't popular is 
>> that 
>> it's "non-interpolating" (in the terminology of P. Thevenaz, T. Blu, and 
>> M. 
>> Unser, 2000), but the infrastructure in Grid (based on interp_invert!) 
>> compensates for that. 
>>
>> --Tim 
>>
>> On Wednesday, March 26, 2014 06:26:12 AM Tomas Lycken wrote: 
>> > Hi, 
>> > 
>> > Is there a (maintained) package somewhere with cubic spline 
>> capabilities? I 
>> > need something that fulfills the following requirements: 
>> > 
>> > * Scalar-valued functions of one variable, f(x), specified on uniform 
>> or 
>> > non-uniform x-grids 
>> > * Scalar-valued functions of two variables, f(x,y), at least specified 
>> on 
>> > uniform grids that don't need to have the same spacing in x and y (i.e. 
>> > rectangular, but not necessarily quadratic, grid cells) 
>> > * Evaluation of function value and evaluate up to at least second order 
>> > derivatives, i.e. both f'x, f'y, f'xx, f'xy and f'yy in the 2D case 
>> > 
>> > The only packages I've found that seem to approach this functionality 
>> are 
>> > 
>> > * https://github.com/timholy/Grid.jl - only up to quadratic splines, 
>> as far 
>> > as I can tell from the readme; also unsure on if it can evaluate second 
>> > order derivatives 
>> > * https://github.com/gusl/BSplines.jl - only 1D interpolation, and 
>> base 
>> > splines rather than exact cubic splines 
>> > * https://github.com/EconForge/splines - Specifies Julia 0.2- in its 
>> > require and hasn't been touched in four months => I doubt it works with 
>> my 
>> > Julia installation which is at master. It would also probably take 
>> quite a 
>> > lot of work to learn to use it, since it has no documentation at all. 
>> > 
>> > Are there any others that I've missed? Is there any non-official effort 
>> > toward creating this functionality in Julia? 
>> > 
>> > Thanks in advance, 
>> > 
>> > // Tomas 
>>
>

Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Tomas Lycken
I'd happily use quadratic interpolation if it weren't for that exact 
limitation - I *do* need continuous second derivatives in the 2D 
interpolation...

I've never actually implemented spline interpolation myself, so I'd 
probably have to spend quite a lot of time delving into the current code to 
understand how it works and how to add to it. Might be good exercise, but 
unfortunately not something I have time for at the moment. It's an 
interesting learning project, though, so I'll definitely consider coming 
back to it later =)

The reason I started this thread was that I'm currently working on a quite 
large project (my masters thesis project) in C++, but after realizing today 
that my current codebase has some deeply nested memory management issues 
that I'm having difficulties troubleshooting, I wanted to see if it would 
be possible to port the project to Julia in a relatively short amount of 
time. For that purpose, I wanted to see if all the stuff I'm doing through 
external C++ libraries was implemented in Julia packages as well, so that I 
wouldn't have to write any Julia code for stuff that I haven't had to write 
C++ code for. Cubic splines was the only missing piece of the puzzle :P 
However, implementing a cubic spline interpolation routine is, 
unfortunately, well out of scope for my thesis, so it will have to wait 
until I have time to spend on it. Until then, I'd better get back to those 
segfaults...

// T

On Wednesday, March 26, 2014 2:54:55 PM UTC+1, Tim Holy wrote:
>
> I should also add that unless you need a continuous second derivative, 
> quadratic (while not as popular) is IMO nicer than cubic in several 
> ways---for 
> example, by requiring fewer points (27 rather than 64 in 3 dimensions), 
> it's 
> faster to evaluate. I suspect the main reason quadratic isn't popular is 
> that 
> it's "non-interpolating" (in the terminology of P. Thevenaz, T. Blu, and 
> M. 
> Unser, 2000), but the infrastructure in Grid (based on interp_invert!) 
> compensates for that. 
>
> --Tim 
>
> On Wednesday, March 26, 2014 06:26:12 AM Tomas Lycken wrote: 
> > Hi, 
> > 
> > Is there a (maintained) package somewhere with cubic spline 
> capabilities? I 
> > need something that fulfills the following requirements: 
> > 
> > * Scalar-valued functions of one variable, f(x), specified on uniform or 
> > non-uniform x-grids 
> > * Scalar-valued functions of two variables, f(x,y), at least specified 
> on 
> > uniform grids that don't need to have the same spacing in x and y (i.e. 
> > rectangular, but not necessarily quadratic, grid cells) 
> > * Evaluation of function value and evaluate up to at least second order 
> > derivatives, i.e. both f'x, f'y, f'xx, f'xy and f'yy in the 2D case 
> > 
> > The only packages I've found that seem to approach this functionality 
> are 
> > 
> > * https://github.com/timholy/Grid.jl - only up to quadratic splines, as 
> far 
> > as I can tell from the readme; also unsure on if it can evaluate second 
> > order derivatives 
> > * https://github.com/gusl/BSplines.jl - only 1D interpolation, and base 
> > splines rather than exact cubic splines 
> > * https://github.com/EconForge/splines - Specifies Julia 0.2- in its 
> > require and hasn't been touched in four months => I doubt it works with 
> my 
> > Julia installation which is at master. It would also probably take quite 
> a 
> > lot of work to learn to use it, since it has no documentation at all. 
> > 
> > Are there any others that I've missed? Is there any non-official effort 
> > toward creating this functionality in Julia? 
> > 
> > Thanks in advance, 
> > 
> > // Tomas 
>


Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Tim Holy
I should also add that unless you need a continuous second derivative, 
quadratic (while not as popular) is IMO nicer than cubic in several ways---for 
example, by requiring fewer points (27 rather than 64 in 3 dimensions), it's 
faster to evaluate. I suspect the main reason quadratic isn't popular is that 
it's "non-interpolating" (in the terminology of P. Thevenaz, T. Blu, and M. 
Unser, 2000), but the infrastructure in Grid (based on interp_invert!) 
compensates for that.

--Tim

On Wednesday, March 26, 2014 06:26:12 AM Tomas Lycken wrote:
> Hi,
> 
> Is there a (maintained) package somewhere with cubic spline capabilities? I
> need something that fulfills the following requirements:
> 
> * Scalar-valued functions of one variable, f(x), specified on uniform or
> non-uniform x-grids
> * Scalar-valued functions of two variables, f(x,y), at least specified on
> uniform grids that don't need to have the same spacing in x and y (i.e.
> rectangular, but not necessarily quadratic, grid cells)
> * Evaluation of function value and evaluate up to at least second order
> derivatives, i.e. both f'x, f'y, f'xx, f'xy and f'yy in the 2D case
> 
> The only packages I've found that seem to approach this functionality are
> 
> * https://github.com/timholy/Grid.jl - only up to quadratic splines, as far
> as I can tell from the readme; also unsure on if it can evaluate second
> order derivatives
> * https://github.com/gusl/BSplines.jl - only 1D interpolation, and base
> splines rather than exact cubic splines
> * https://github.com/EconForge/splines - Specifies Julia 0.2- in its
> require and hasn't been touched in four months => I doubt it works with my
> Julia installation which is at master. It would also probably take quite a
> lot of work to learn to use it, since it has no documentation at all.
> 
> Are there any others that I've missed? Is there any non-official effort
> toward creating this functionality in Julia?
> 
> Thanks in advance,
> 
> // Tomas


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

2014-03-26 Thread Ivar Nesje
Cross linking the issue for removing the a.(b) syntax: 
#6268

Ivar

kl. 09:49:15 UTC+1 onsdag 26. mars 2014 skrev Andreas Lobinger følgende:
>
> I remembered something with 13 and mapped it to R2013x ...
>
> On Tuesday, March 25, 2014 10:47:39 PM UTC+1, Tony Kelman wrote:
>
>>
>> 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 R2008b.
>>
>

Re: [julia-users] Cubic spline interpolation

2014-03-26 Thread Tim Holy
Adding support for cubic splines to Grid should be fairly straightforward. 
Adding support for 2nd derivatives might be a bit harder, since in dimensions 
higher than 1 you really need the Hessian. If you're interested in 
implementing it, you'd basically need to create set_hessian_coordinates (like 
set_gradient_coordinate) and add an `hcoef1d` field to InterpGridCoefs.

--Tim

On Wednesday, March 26, 2014 06:26:12 AM Tomas Lycken wrote:
> Hi,
> 
> Is there a (maintained) package somewhere with cubic spline capabilities? I
> need something that fulfills the following requirements:
> 
> * Scalar-valued functions of one variable, f(x), specified on uniform or
> non-uniform x-grids
> * Scalar-valued functions of two variables, f(x,y), at least specified on
> uniform grids that don't need to have the same spacing in x and y (i.e.
> rectangular, but not necessarily quadratic, grid cells)
> * Evaluation of function value and evaluate up to at least second order
> derivatives, i.e. both f'x, f'y, f'xx, f'xy and f'yy in the 2D case
> 
> The only packages I've found that seem to approach this functionality are
> 
> * https://github.com/timholy/Grid.jl - only up to quadratic splines, as far
> as I can tell from the readme; also unsure on if it can evaluate second
> order derivatives
> * https://github.com/gusl/BSplines.jl - only 1D interpolation, and base
> splines rather than exact cubic splines
> * https://github.com/EconForge/splines - Specifies Julia 0.2- in its
> require and hasn't been touched in four months => I doubt it works with my
> Julia installation which is at master. It would also probably take quite a
> lot of work to learn to use it, since it has no documentation at all.
> 
> Are there any others that I've missed? Is there any non-official effort
> toward creating this functionality in Julia?
> 
> Thanks in advance,
> 
> // Tomas


[julia-users] Cubic spline interpolation

2014-03-26 Thread Tomas Lycken
Hi,

Is there a (maintained) package somewhere with cubic spline capabilities? I 
need something that fulfills the following requirements:

* Scalar-valued functions of one variable, f(x), specified on uniform or 
non-uniform x-grids
* Scalar-valued functions of two variables, f(x,y), at least specified on 
uniform grids that don't need to have the same spacing in x and y (i.e. 
rectangular, but not necessarily quadratic, grid cells)
* Evaluation of function value and evaluate up to at least second order 
derivatives, i.e. both f'x, f'y, f'xx, f'xy and f'yy in the 2D case

The only packages I've found that seem to approach this functionality are

* https://github.com/timholy/Grid.jl - only up to quadratic splines, as far 
as I can tell from the readme; also unsure on if it can evaluate second 
order derivatives
* https://github.com/gusl/BSplines.jl - only 1D interpolation, and base 
splines rather than exact cubic splines
* https://github.com/EconForge/splines - Specifies Julia 0.2- in its 
require and hasn't been touched in four months => I doubt it works with my 
Julia installation which is at master. It would also probably take quite a 
lot of work to learn to use it, since it has no documentation at all.

Are there any others that I've missed? Is there any non-official effort 
toward creating this functionality in Julia?

Thanks in advance,

// Tomas


[julia-users] Re: pycall error

2014-03-26 Thread Tang Ross
Thanks a lot.

It works.




[julia-users] worker/proc nomenclature

2014-03-26 Thread Ben Arthur
if "procs() Returns a list of all process identifiers."

and "workers() Returns a list of all worker process identifiers."

then why do we "rmprocs(pids...) Removes the specified workers." instead of 
rmworkers()? particularly since

julia> rmprocs(1)
WARNING: rmprocs: process 1 not removed
:ok

similarly, why do we "addprocs() Add processes on remote machines" and not 
addworkers()?

the above terminology seems a bit odd in a language which puts so much 
emphasis on expressiveness.


note that there is what i believe to be a typo in the current 
documentation.  these both should refer to *processes* i believe, not 
processors.

"nprocs() Get the number of available processors."
"nworkers() Get the number of available worker processors."



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

2014-03-26 Thread Andreas Lobinger
I remembered something with 13 and mapped it to R2013x ...

On Tuesday, March 25, 2014 10:47:39 PM UTC+1, Tony Kelman wrote:

>
> 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 R2008b.
>


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

2014-03-26 Thread Paul Analyst

Thx. It  is grate !
This is great! Does the panel does not have all the documentation packages?
Paul

W dniu 2014-03-25 18:14, Stefan Karpinski pisze:

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 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 other basic statistics of
the use of weight is not difficult to Julia. But how to
prepare/compute a set of weighted counting any statistics,
correlation, algebraic transformations, etc.
Paul






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

2014-03-26 Thread Andreas Noack Jensen
Its a good idea to upgrade to the nighlies. Things happen fast.
Unfortunately, your problem won't work yet. The problem is that the lu
factorization uses pivoting and this assumes more structure on the matrix
elements. More precisely, it assumes an order of the absolute values of the
elements. I think a solution could be to make pivoting optional and only
use pivoting when the element type is a subtype of Number.


2014-03-26 1:03 GMT+01:00 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, andrew cooke wrote:
>>
>>
>> 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)]
>>> 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 subclass Number (i can't remember why, but it's necessary).  i also
>>> have promotion *from* Int, so that you can add and compare against constant
>>> integers in the code (typically 0 and 1).
>>>
>>> andrew
>>>
>>>
>>> On Tuesday, 25 March 2014 13:18:06 UTC-3, Andreas Noack Jensen wrote:

 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 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.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
>>
>> On Tuesday, March 25, 2014 10:21:10 AM UTC-5, Andreas Noack Jensen
>> wrote:
>>>
>>> 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 more relevant feedback.


 On Tuesday, March 25, 2014 9:54:53 AM UTC-5, Andreas Noack Jensen
 wrote:

> 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 define your matrix by
>
> a = Mytype[mytype(1) mytype(2); mytype(3) mytype(4)]
>
> and see if it works.
>
>
> 2014-03-25 15:29 GMT+01:00 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:
>>
>>> 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 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 doesn't seem to be a way to find
>>