[julia-users] DataFrames io error

2014-11-03 Thread K Leo
I have a small program that uses DataFrames to read in a file, does some 
simple computation and then plots some variables using Winston.  I run 
it with the following:


julia include(PlotBasics.jl)
PlotBasics (generic function with 1 method)

julia PlotBasics()

It runs fine the first time, but if I change the variables for plot and 
run it the second time, I got the following errors now (it used to run 
perfectly before).  If I restart julia and run it again, it runs fine 
the first time.


julia PlotBasics()
ERROR: `convert` has no method matching 
convert(::Type{Array{Float64,N}}, ::Array{Int64,1})

 in convert at base.jl:13
 in builddf at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:583
 in readtable! at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:783
 in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:868
 in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:935

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.2 (2014-10-21 20:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  x86_64-linux-gnu



Re: [julia-users] DataFrames io error

2014-11-03 Thread Tim Holy
I suspect the convert bug, which you can find in multiple instances by 
searching the issues. Try pinning the Color package at v0.3.9 or v0.3.6 and 
see if this works around the bug.

--Tim

On Monday, November 03, 2014 04:48:13 PM K Leo wrote:
 I have a small program that uses DataFrames to read in a file, does some
 simple computation and then plots some variables using Winston.  I run
 it with the following:
 
 julia include(PlotBasics.jl)
 PlotBasics (generic function with 1 method)
 
 julia PlotBasics()
 
 It runs fine the first time, but if I change the variables for plot and
 run it the second time, I got the following errors now (it used to run
 perfectly before).  If I restart julia and run it again, it runs fine
 the first time.
 
 julia PlotBasics()
 ERROR: `convert` has no method matching
 convert(::Type{Array{Float64,N}}, ::Array{Int64,1})
   in convert at base.jl:13
   in builddf at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:583
   in readtable! at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:783
   in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:868
   in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:935
 
 _   _ _(_)_ |  A fresh approach to technical computing
(_) | (_) (_)|  Documentation: http://docs.julialang.org
 _ _   _| |_  __ _   |  Type help() for help.
 
| | | | | | |/ _` |  |
| | |
| | |_| | | | (_| |  |  Version 0.3.2 (2014-10-21 20:18 UTC)
 
   _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
 
 |__/   |  x86_64-linux-gnu



[julia-users] Linear Algebra

2014-11-03 Thread write2jjones
I have several problems that are mix between Linear Algebra and 
Combinatorics and I recently started to use Julia. 

I am wondering what would be the shortest learning path to achieve my goal: 
 learn how to use Julia with Linear Algebra mixed with Combinatorics.

Maybe from the Julia manual I need to read only:
1) Functions (because I need to split the project into manageable parts) 
2) Methods  (the same as above)
3) Modules  (the same as above)
4) Metaprogramming  (because I might need it ... )
5) Multi-dimensional Arrays (I can use them as vectors right? ...)
6) Linear algebra (because this is the type of  my main problems) 
7)  Combinatorics (because I need combinatorics too)
8) The Standard Library = Parallel Computing  (because I need to solve big 
problems fast)
9) Parallel Computing (the same as above)

If you have some experience, please if you can tell me ...


Re: [julia-users] Identify bounds error

2014-11-03 Thread Nils Gudat
Sorry, I don't think I understand your suggestion. What exactly should I 
put into a function?


[julia-users] using filter function

2014-11-03 Thread Zahirul ALAM
The documentation says:

filter(function, collection)
Return a copy of collection, removing elements for which function is false. 
For associative collections,
the function is passed two arguments (key and value).

how to write the fucntion? I am trying to get elements which are nonzero. 
Any Help is much appreciated!


Re: [julia-users] using filter function

2014-11-03 Thread João Felipe Santos
You just need to write a function that returns false for the elements you want 
to filter out. Here’s an example that does what you want:

julia myfilter(x) = x != 0
myfilter (generic function with 1 method)

julia A = [1, 2, 0, 4, 5, 0]
6-element Array{Int64,1}:
 1
 2
 0
 4
 5
 0

julia filter(myfilter, A)
4-element Array{Int64,1}:
 1
 2
 4
 5

 On Nov 3, 2014, at 10:15 AM, Zahirul ALAM zahirul.a...@gmail.com wrote:
 
 The documentation says:
 
 filter(function, collection)
 Return a copy of collection, removing elements for which function is false. 
 For associative collections,
 the function is passed two arguments (key and value).
 
 how to write the fucntion? I am trying to get elements which are nonzero. Any 
 Help is much appreciated!



Re: [julia-users] DimensionalityReudction PCA error

2014-11-03 Thread Dahua Lin
DimensionalityReduction has been superseded by MultivariateStats. We 
purposely restrict the version range of DimensionalityReduction in order to 
prevent people from using it in future.

- Dahua


On Monday, October 20, 2014 12:37:14 AM UTC+8, John Myles White wrote:

 That package is abandoned. Use MultivariateStats instead.

  — John

 On Oct 19, 2014, at 9:36 AM, Stefan Karpinski stefan.k...@gmail.com 
 javascript: wrote:

 Looks like the package doesn't support Julia past 0.3.0, which is odd 
 because 0.3.1 is a bug-fix release. Unfortunately, John is not going to be 
 able to answer questions for a while. However, you can try filing an issue 
 with the DimensionalityReduction package repo.


 On Oct 19, 2014, at 12:13 PM, Arshak Navruzyan ars...@gmail.com 
 javascript: wrote:

 Thank you for the suggestion.  

 Pkg.checkout(DimensionalityReduction)
 INFO: Checking out DimensionalityReduction master...
 INFO: Pulling DimensionalityReduction latest master...
 WARNING: julia is fixed at 0.3.1 conflicting with requirement for 
 DimensionalityReduction: [0.1.0,0.3.0)
 INFO: No packages to install, update or remove

 What's strange is pca(rand(1000,30)) works just fine.  It must be 
 something with my data just not sure what it could be.

 On Sun, Oct 19, 2014 at 8:53 AM, Stefan Karpinski ste...@karpinski.org 
 javascript: wrote:

 It's possible that DimensionalityReduction isn't terribly up to date. 
 Does anyone know the status of that? You could also do 
 Pkg.checkout(DimensionalityReduction) and see if this is fixed on the 
 master branch of the package or not.

 On Sun, Oct 19, 2014 at 11:50 AM, Arshak Navruzyan ars...@gmail.com 
 javascript: wrote:

 Julia Version 0.3.1
 Commit c03f413* (2014-09-21 21:30 UTC)
 Platform Info:
   System: Darwin (x86_64-apple-darwin13.3.0)
   CPU: Intel(R) Core(TM) i7-3635QM CPU @ 2.40GHz
   WORD_SIZE: 64
   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
   LAPACK: libopenblas
   LIBM: libopenlibm
   LLVM: libLLVM-3.3



 On Sun, Oct 19, 2014 at 8:45 AM, Stefan Karpinski ste...@karpinski.org 
 javascript: wrote:
 
  What version of Julia are you using?
 
  On Sun, Oct 19, 2014 at 11:43 AM, Arshak Navruzyan ars...@gmail.com 
 javascript: wrote:
 
  I have a 1000x30 Array{Any,2} of floats
 
 
  when I do pca(matrix) I get 
 
 
  `zero` has no method matching zero(::Type{Any})
  while loading In[117], in expression starting on line 1
 
   in normalize at 
 /Users/arshakn/.julia/v0.3/DimensionalityReduction/src/pca.jl:11
   in pcasvd at 
 /Users/arshakn/.julia/v0.3/DimensionalityReduction/src/pca.jl:58
   in pca at 
 /Users/arshakn/.julia/v0.3/DimensionalityReduction/src/pca.jl:79
 
 
  pca(matrix; center=false, scale=false) gives me
 
 
  `one` has no method matching one(::Type{Any})
  while loading In[118], in expression starting on line 1
 
   in svdfact at linalg/factorization.jl:660
   in pcasvd at 
 /Users/arshakn/.julia/v0.3/DimensionalityReduction/src/pca.jl:60
   in pca at 
 /Users/arshakn/.julia/v0.3/DimensionalityReduction/src/pca.jl:79
 
 
 
 






[julia-users] Re: Linear Algebra

2014-11-03 Thread Ivar Nesje
This question really depends on your background.

My general recommendation to learn Julia would be to start with a deep 
study of the Differences from other languages section if you have 
experience in any of the languages listed. Then you should do a fast 
reading of the manual from the start so that you get an overview of the 
different parts. Stop reading when you feel you have what you need, and use 
search to find whatever you need later.

My usual search order (after google fails) is:

   1. docs.julialang.org
   2. julia-users
   3. github.com/JuliaLang/julia
   4. julia-devs
   5. stackoverflow [julia-lang]





kl. 08:52:34 UTC+1 mandag 3. november 2014 skrev write2...@gmail.com 
følgende:

 I have several problems that are mix between Linear Algebra and 
 Combinatorics and I recently started to use Julia. 

 I am wondering what would be the shortest learning path to achieve my 
 goal:  learn how to use Julia with Linear Algebra mixed with Combinatorics.

 Maybe from the Julia manual I need to read only:
 1) Functions (because I need to split the project into manageable parts) 
 2) Methods  (the same as above)
 3) Modules  (the same as above)
 4) Metaprogramming  (because I might need it ... )
 5) Multi-dimensional Arrays (I can use them as vectors right? ...)
 6) Linear algebra (because this is the type of  my main problems) 
 7)  Combinatorics (because I need combinatorics too)
 8) The Standard Library = Parallel Computing  (because I need to solve 
 big problems fast)
 9) Parallel Computing (the same as above)

 If you have some experience, please if you can tell me ...



Re: [julia-users] Identify bounds error

2014-11-03 Thread Ivar Nesje
Julia code run in global scope is generally slower, and gets worse 
backtraces and line numbers. If you just add

function main()
[your code]
end
main()

around your code, that should solve some problems. (note that using 
statements must be outside the function definition)

kl. 15:44:18 UTC+1 mandag 3. november 2014 skrev Nils Gudat følgende:

 Sorry, I don't think I understand your suggestion. What exactly should I 
 put into a function?



Re: [julia-users] using filter function

2014-11-03 Thread Ivar Nesje
Or you can use an anonymous function

julia filter(x-x!=0, A)
4-element Array{Int64,1}:
 1
 2
 4
 5

 the `do` syntax is exactly equivalent, but more convenient when you have a 
longer function body

julia filter(A) do x
   x != 0
   end
4-element Array{Int64,1}:
 1
 2
 4
 5

Regards Ivar

kl. 16:18:05 UTC+1 mandag 3. november 2014 skrev João Felipe Santos 
følgende:

 You just need to write a function that returns false for the elements you 
 want to filter out. Here’s an example that does what you want: 

 julia myfilter(x) = x != 0 
 myfilter (generic function with 1 method) 

 julia A = [1, 2, 0, 4, 5, 0] 
 6-element Array{Int64,1}: 
  1 
  2 
  0 
  4 
  5 
  0 

 julia filter(myfilter, A) 
 4-element Array{Int64,1}: 
  1 
  2 
  4 
  5 

  On Nov 3, 2014, at 10:15 AM, Zahirul ALAM zahiru...@gmail.com 
 javascript: wrote: 
  
  The documentation says: 
  
  filter(function, collection) 
  Return a copy of collection, removing elements for which function is 
 false. For associative collections, 
  the function is passed two arguments (key and value). 
  
  how to write the fucntion? I am trying to get elements which are 
 nonzero. Any Help is much appreciated! 



[julia-users] Cairo - PDF

2014-11-03 Thread cormullion
This is my Hello world for Cairo in Julia outputting to PNG:

using Cairo

imwidth = 200
imheight = 200

c = CairoRGBSurface(imwidth,imheight)
cr = CairoContext(c)

set_source_rgba(cr, 1, 0.7, 0.2, 0.9)
set_line_width(cr, 1)
circle(cr, 100, 100, 50)
stroke(cr)

select_font_face (cr, Helvetica, Cairo.FONT_SLANT_NORMAL, 
Cairo.FONT_WEIGHT_NORMAL)
set_font_size (cr, 12)
move_to(cr, 100,100)
show_text(cr,Hello world)

write_to_png(c,/tmp/helloworld.png)
run(`open /tmp/helloworld.png`)


But I prefer to output to PDF. I've got as far as finding this:

c = CairoPDFSurface(/tmp/helloworld.pdf, imwidth, imheight)


but there's isn't a write_to_pdf() function (obviously?). But I can't get 
any output.

Pkg.installed() gives:

 Cairo = v0.2.20

and I'm on version 0.3.0.




[julia-users] Re: using filter function

2014-11-03 Thread Zahirul ALAM
Thank You. Thank You. Thank You

On Monday, 3 November 2014 10:15:09 UTC-5, Zahirul ALAM wrote:

 The documentation says:

 filter(function, collection)
 Return a copy of collection, removing elements for which function is 
 false. For associative collections,
 the function is passed two arguments (key and value).

 how to write the fucntion? I am trying to get elements which are nonzero. 
 Any Help is much appreciated!



[julia-users] Non-allocating sparse matrix-vector product

2014-11-03 Thread federico . poloni
If I understand correctly, operations such as `v = A*v`, where A is a dense 
matrix and v is a vector, create temporaries and allocate memory; if one 
wishes to do the computation in place without allocation, the only solution 
is using directly `gemv!`.

What if `A` is a sparse matrix? Is there an in-place alternative to `v = 
A*v`?

Thanks,
--federico


Re: [julia-users] Identify bounds error

2014-11-03 Thread Nils Gudat
Wow, this is great! While I knew about the fact that wrapping things in 
functions is beneficial, I would have never thought of doing that to my 
entire code. I thought I had read quite a bit about Julia in the docs, but 
this had evaded me. Thanks!


Re: [julia-users] Non-allocating sparse matrix-vector product

2014-11-03 Thread Andreas Noack
In general, you cannot do an in place matrix multiplication of the form
x=Ax. This is only possible if A has special structure such as e.g.
triangular, Toeplitz or orthogonal. However, you can do a y = A*x + y,
which is what gemv does. For sparse matrices this is achievable with
A_mul_B!, i.e.

A = sprandn(10, 10, 0.3); x = randn(10); y = Array(Float64, 10);
A_mul_B!(y, A, x)

Med venlig hilsen

Andreas Noack

2014-11-03 8:58 GMT-05:00 federico.pol...@unipi.it:

 If I understand correctly, operations such as `v = A*v`, where A is a
 dense matrix and v is a vector, create temporaries and allocate memory; if
 one wishes to do the computation in place without allocation, the only
 solution is using directly `gemv!`.

 What if `A` is a sparse matrix? Is there an in-place alternative to `v =
 A*v`?

 Thanks,
 --federico



[julia-users] installing julia stable on ubuntu 14.10?

2014-11-03 Thread a. kramer
I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA 
(ppa:staticfloat/juliareleases) to install Julia 0.3.2.  

Upon upgrading to Ubuntu 14.10, there seem to be some dependency issues.  
In particular, the julia package depends on libcholmod1.7.1 and 
libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and 
libumfpack5.6.2.  Currently I've installed julia by downloading the .deb 
and using dpkg --force-all -i, but this screws up the dependencies in my 
package manager and is not the best solution.

Is anyone else using 14.10 with Julia?


[julia-users] Determining current memory usage

2014-11-03 Thread James Kyle
Is there a way to determine the current memory usage for individual 
variables in the current run time? Across julia processes?

For example, I'm running 32 julia processes (one for each core) on a 
machine with 250GB of memory. Top shows 160GB of memory allocated. I know 
for a fact I'm not using that much, but I do need to know how much I 
actually have available. E.g. how much has been allocated by julia and how 
much it's actually using.



[julia-users] Re: Julia looking for old gfortran after upgrade

2014-11-03 Thread James Kyle
Sometimes you have to recompile linked deps when the lib path changes in 
upgrade. For example:

% brew reinstall qrupdate

the stack error should provide hints on which one.

On Saturday, November 1, 2014 5:06:12 PM UTC-7, Sean Garborg wrote:

 I upgraded OSX from Mavericks to Yosemite and ran 'brew upgrade' which 
 brought a new version of gcc and friends. I'm not sure which action was to 
 blame, but Julia kept looking for 
 '/usr/local/lib/gcc/x86_64-apple-darwin13.x.x/4.8.x/libgfortran.3.dylib' 
 (old versions of Darwin and gcc). 'make cleanall' didn't help.

 I'm fine after cloning Julia anew, but that's slow. For future reference, 
 is there a quicker way?



Re: [julia-users] Re: Julia looking for old gfortran after upgrade

2014-11-03 Thread Elliot Saba
Specifically, you need to clean out arpack, suite-sparse, and openblas.
These guys use gfortran, which embeds absolute paths to libgfortran.  You
need to do this every time the gcc version changes.
-E

On Mon, Nov 3, 2014 at 11:23 AM, James Kyle li...@jameskyle.org wrote:

 Sometimes you have to recompile linked deps when the lib path changes in
 upgrade. For example:

 % brew reinstall qrupdate

 the stack error should provide hints on which one.

 On Saturday, November 1, 2014 5:06:12 PM UTC-7, Sean Garborg wrote:

 I upgraded OSX from Mavericks to Yosemite and ran 'brew upgrade' which
 brought a new version of gcc and friends. I'm not sure which action was to
 blame, but Julia kept looking for '/usr/local/lib/gcc/x86_64-
 apple-darwin13.x.x/4.8.x/libgfortran.3.dylib' (old versions of Darwin
 and gcc). 'make cleanall' didn't help.

 I'm fine after cloning Julia anew, but that's slow. For future reference,
 is there a quicker way?




[julia-users] Re: Getting Julia to emit an unrolled inner loop with SIMD instructions

2014-11-03 Thread Toivo Henningsson


On Sunday, 2 November 2014 22:27:28 UTC+1, Gunnar Farnebäck wrote:

 It might be possible to get further doing llvmcall with LLVM inline 
 assembly but my feeble attempts at that have only resulted in crashes 
 (well, sort of, getting dumped back to shell prompt without ceremony). 
 Getting good load/store instructions by default would be a lot better of 
 course but I would still be interested in knowing whether llvmcall with 
 inline assembly can be made to work, in order to access a wider range of 
 SIMD instructions.

 Yes, I agree on both.

I managed at least to generate the right kind of instructions with e.g.

julia typealias Uint64x2 NTuple{2, Uint64}
(Uint64,Uint64)

julia function innerloop5!(dest::Ptr{Uint64x2}, src::Ptr{Uint64x2})
   Base.llvmcall(%s  = load 2 x i64* %1, align 16
%d  = load 2 x i64* %0, align 16
%ds = xor  2 x i64  %s, %d
store 2 x i64 %ds, 2 x i64* %0, align 16
ret void,
Void, (Ptr{Uint64x2}, Ptr{Uint64x2}),
dest, src)
   end
innerloop5! (generic function with 1 method)

julia code_native(innerloop5!, (Ptr{Uint64x2}, Ptr{Uint64x2}))

which gives

.text
Filename: none
Source line: 2
pushRBP
movRBP, RSP
movapsXMM0, XMMWORD PTR [RSI]
xorps XMM0, XMMWORD PTR [RDI]
movapsXMMWORD PTR [RDI], XMM0
Source line: 2
popRBP
ret

But I haven't tried executing it yet :)

For more practical examples I'm getting massively bloat generated code 
though, which seems to be at least in part due to e.g.

+(x::Ptr, y::Integer) = oftype(x, uint(uint(x) + y))

in base/pointer.jl: Since conversion between signed and unsigned now checks 
for overflow, this will add a tax on all pointer arithmetic. I'm not sure 
that there's any point to have checked pointer arithmetic, might see if I 
can generate reasonable code for a bigger example if I make it unchecked. 
Will post back if I get more results.


[julia-users] Re: Cairo - PDF

2014-11-03 Thread Tobias Knopp
Maybe use the Julia wrapper for  cairo_surface_flush?

Am Montag, 3. November 2014 17:27:23 UTC+1 schrieb cormu...@mac.com:

 This is my Hello world for Cairo in Julia outputting to PNG:

 using Cairo

 imwidth = 200
 imheight = 200

 c = CairoRGBSurface(imwidth,imheight)
 cr = CairoContext(c)

 set_source_rgba(cr, 1, 0.7, 0.2, 0.9)
 set_line_width(cr, 1)
 circle(cr, 100, 100, 50)
 stroke(cr)

 select_font_face (cr, Helvetica, Cairo.FONT_SLANT_NORMAL, 
 Cairo.FONT_WEIGHT_NORMAL)
 set_font_size (cr, 12)
 move_to(cr, 100,100)
 show_text(cr,Hello world)

 write_to_png(c,/tmp/helloworld.png)
 run(`open /tmp/helloworld.png`)


 But I prefer to output to PDF. I've got as far as finding this:

 c = CairoPDFSurface(/tmp/helloworld.pdf, imwidth, imheight)


 but there's isn't a write_to_pdf() function (obviously?). But I can't get 
 any output.

 Pkg.installed() gives:

  Cairo = v0.2.20

 and I'm on version 0.3.0.




[julia-users] Re: installing julia stable on ubuntu 14.10?

2014-11-03 Thread Douglas Bates
Did you add the PPA for julia-deps in addition to juliareleases?  Elliot 
has versions of dependencies that are compatible with the Julia packages.

On Monday, November 3, 2014 11:20:53 AM UTC-6, a. kramer wrote:

 I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA 
 (ppa:staticfloat/juliareleases) to install Julia 0.3.2.  

 Upon upgrading to Ubuntu 14.10, there seem to be some dependency issues.  
 In particular, the julia package depends on libcholmod1.7.1 and 
 libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and 
 libumfpack5.6.2.  Currently I've installed julia by downloading the .deb 
 and using dpkg --force-all -i, but this screws up the dependencies in my 
 package manager and is not the best solution.

 Is anyone else using 14.10 with Julia?



[julia-users] Re: installing julia stable on ubuntu 14.10?

2014-11-03 Thread a. kramer
Sorry, I forgot to mention, yes, I have julia-deps added as well.

On Monday, November 3, 2014 4:22:11 PM UTC-5, Douglas Bates wrote:

 Did you add the PPA for julia-deps in addition to juliareleases?  Elliot 
 has versions of dependencies that are compatible with the Julia packages.

 On Monday, November 3, 2014 11:20:53 AM UTC-6, a. kramer wrote:

 I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA 
 (ppa:staticfloat/juliareleases) to install Julia 0.3.2.  

 Upon upgrading to Ubuntu 14.10, there seem to be some dependency issues.  
 In particular, the julia package depends on libcholmod1.7.1 and 
 libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and 
 libumfpack5.6.2.  Currently I've installed julia by downloading the .deb 
 and using dpkg --force-all -i, but this screws up the dependencies in my 
 package manager and is not the best solution.

 Is anyone else using 14.10 with Julia?



Re: [julia-users] Re: installing julia stable on ubuntu 14.10?

2014-11-03 Thread Elliot Saba
I think this is because the actual package names changed between Ubuntu
14.04 and 14.10.  I've added a suite-sparse package of the proper version
to the 14.10 PPA, can you please `apt-get update` and try again?

On Mon, Nov 3, 2014 at 1:22 PM, Douglas Bates dmba...@gmail.com wrote:

 Did you add the PPA for julia-deps in addition to juliareleases?  Elliot
 has versions of dependencies that are compatible with the Julia packages.


 On Monday, November 3, 2014 11:20:53 AM UTC-6, a. kramer wrote:

 I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA
 (ppa:staticfloat/juliareleases) to install Julia 0.3.2.

 Upon upgrading to Ubuntu 14.10, there seem to be some dependency issues.
 In particular, the julia package depends on libcholmod1.7.1 and
 libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and
 libumfpack5.6.2.  Currently I've installed julia by downloading the .deb
 and using dpkg --force-all -i, but this screws up the dependencies in my
 package manager and is not the best solution.

 Is anyone else using 14.10 with Julia?




Re: [julia-users] Re: installing julia stable on ubuntu 14.10?

2014-11-03 Thread a. kramer
Just updated -- looks like the dependency issues have been resolved.  
Thanks for maintaining the PPA!

On Monday, November 3, 2014 4:42:25 PM UTC-5, Elliot Saba wrote:

 I think this is because the actual package names changed between Ubuntu 
 14.04 and 14.10.  I've added a suite-sparse package of the proper version 
 to the 14.10 PPA, can you please `apt-get update` and try again?

 On Mon, Nov 3, 2014 at 1:22 PM, Douglas Bates dmb...@gmail.com 
 javascript: wrote:

 Did you add the PPA for julia-deps in addition to juliareleases?  Elliot 
 has versions of dependencies that are compatible with the Julia packages.


 On Monday, November 3, 2014 11:20:53 AM UTC-6, a. kramer wrote:

 I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA 
 (ppa:staticfloat/juliareleases) to install Julia 0.3.2.  

 Upon upgrading to Ubuntu 14.10, there seem to be some dependency 
 issues.  In particular, the julia package depends on libcholmod1.7.1 and 
 libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and 
 libumfpack5.6.2.  Currently I've installed julia by downloading the .deb 
 and using dpkg --force-all -i, but this screws up the dependencies in my 
 package manager and is not the best solution.

 Is anyone else using 14.10 with Julia?




Re: [julia-users] Fully Typed Function As Argument Type

2014-11-03 Thread Evan Pu
Nooo TT I was looking for it too today.
Hope it gets added soon, fingers crossed!

On Thursday, August 14, 2014 10:31:17 AM UTC-4, John Myles White wrote:

 Not possible in the current versions of Julia. Maybe one day. There are 
 bunch of us who’d like to have this functionality, but it’s a non-trivial 
 addition of complexity to the compiler.

  — John

 On Aug 14, 2014, at 4:59 AM, Chris Kellendonk chriske...@gmail.com 
 javascript: wrote:

 I'm new to the language so I may have missed something. But is there a way 
 to make sure a function passed as an argument is of a specific type 
 including it's arguments? It doesn't look like from the design of the 
 language this could be supported but I'm curious.

 For example I would like to be able to do:

 function callme(handler::Function(Int32, Float64))
 handler(12, 0.2)
 end

 And the compiler would guarantee the correct type of function is called.

 Thanks,




Re: [julia-users] Re: installing julia stable on ubuntu 14.10?

2014-11-03 Thread Elliot Saba
Great, glad it worked!
-E

On Mon, Nov 3, 2014 at 1:53 PM, a. kramer ak168...@gmail.com wrote:

 Just updated -- looks like the dependency issues have been resolved.
 Thanks for maintaining the PPA!

 On Monday, November 3, 2014 4:42:25 PM UTC-5, Elliot Saba wrote:

 I think this is because the actual package names changed between Ubuntu
 14.04 and 14.10.  I've added a suite-sparse package of the proper version
 to the 14.10 PPA, can you please `apt-get update` and try again?

 On Mon, Nov 3, 2014 at 1:22 PM, Douglas Bates dmb...@gmail.com wrote:

 Did you add the PPA for julia-deps in addition to juliareleases?  Elliot
 has versions of dependencies that are compatible with the Julia packages.


 On Monday, November 3, 2014 11:20:53 AM UTC-6, a. kramer wrote:

 I recently upgraded to Xubuntu 14.10.  On 14.04 I was using the PPA
 (ppa:staticfloat/juliareleases) to install Julia 0.3.2.

 Upon upgrading to Ubuntu 14.10, there seem to be some dependency
 issues.  In particular, the julia package depends on libcholmod1.7.1 and
 libumfpack5.4.0.  Instead I can only find libumfpack2.1.2 and
 libumfpack5.6.2.  Currently I've installed julia by downloading the .deb
 and using dpkg --force-all -i, but this screws up the dependencies in my
 package manager and is not the best solution.

 Is anyone else using 14.10 with Julia?





[julia-users] type confusions in list comprehensions (and how to work around it?)

2014-11-03 Thread Evan Pu
Consider the following interaction:

julia g(x) = 1 / (1 + x)
g (generic function with 1 method)

julia typeof(g(1.0))
Float64

julia xs = [1.0, 2.0, 3.0, 4.0]
4-element Array{Float64,1}:
 1.0
 2.0
 3.0
 4.0

julia gxs1 = [g(x) for x in xs]
4-element Array{Any,1}:
 0.5 
 0.33
 0.25
 0.2 

Why isn't gxs1 type of Array{Float64,1}?
How could I force the type of gxs1 to be of an array of Float64?

julia gxs2 = [convert(Float64,g(x)) for x in xs]
4-element Array{Any,1}:
 0.5 
 0.33
 0.25
 0.2   

somehow this doesn't seem to work...





[julia-users] Is there something similar to IPython's Audio display in IJulia?

2014-11-03 Thread João Felipe Santos
Hi,

I would like to add an HTML5 audio player to my IJulia notebooks, similarly to 
what is done in IPython notebooks. In IPython notebooks, there’s two 
possibilities: you can either pass the path to an audio file (which is easy) or 
a Numpy array (rendered as data:audio/wav;base64 straight into the HTML file).

Is there something similar in IJulia already? If negative, where can I find 
more info on how to add this to IJulia?

Cheers,

João

Re: [julia-users] type confusions in list comprehensions (and how to work around it?)

2014-11-03 Thread Miguel Bazdresch
 How could I force the type of gxs1 to be of an array of Float64?

The simplest way is:

gxs1 = Float64[g(x) for x in xs]

-- mb

On Mon, Nov 3, 2014 at 6:01 PM, Evan Pu evanthebou...@gmail.com wrote:

 Consider the following interaction:

 julia g(x) = 1 / (1 + x)
 g (generic function with 1 method)

 julia typeof(g(1.0))
 Float64

 julia xs = [1.0, 2.0, 3.0, 4.0]
 4-element Array{Float64,1}:
  1.0
  2.0
  3.0
  4.0

 julia gxs1 = [g(x) for x in xs]
 4-element Array{Any,1}:
  0.5
  0.33
  0.25
  0.2

 Why isn't gxs1 type of Array{Float64,1}?
 How could I force the type of gxs1 to be of an array of Float64?

 julia gxs2 = [convert(Float64,g(x)) for x in xs]
 4-element Array{Any,1}:
  0.5
  0.33
  0.25
  0.2

 somehow this doesn't seem to work...






[julia-users] inv(::Symmetric), slow

2014-11-03 Thread David van Leeuwen
Hello, 

I am struggling with the fact that covariance matrices computed from a 
precision matrix aren't positive definite, according to `isposdef()` (they 
should be according to the maths).  

It looks like the culprit is `inv(pd::Matrix)` which does not always result 
in a positive definite matrix if `pd` is one.  This is probably because 
`inv()` is agnostic of the fact that the argument is positive definite, and 
numerical details. 

Now I've tried to understand the support for special matrices, and I 
believe that `inv(factorize(Hermitian(pd)))` is the proper way to do this. 
 Indeed the resulting matrix is positive definite.  However, this 
computation takes a lot longer than inv(), about 5--6 times as slow.  I 
would have expected that the extra symmetry would lead to a more efficient 
matrix inversion. 

Is there something I'm doing wrong?

Cheers, 

---david


[julia-users] What's the relationship between a function and an anonymous function?

2014-11-03 Thread yfractal
They seem have similar code.

eg:

  function fun(x::Int)
   x
  end

  function fun(x)
  x
  end

  fun.env.defs.func.code

  AST(:($(Expr(:lambda, {:x}, {{},{{:x,:Any,0}},{}}, :(begin
return
end)

  func2 = (x) - x
  func2.code

  AST(:($(Expr(:lambda, {:(x::Any)}, {{},{{:x,:Any,0}},{}}, :(begin  # 
none, line 1:
return x
end)

 And function has sig(signature?)

 fun.env.defs.sig
 (Any,)

I guess, a function has one name and many defs(definition?). And Julia will 
do dispatch base on the sig. 

Is it right? Please correct me, if I made any mistakes. Please tell me more 
about Julia function!

But how Julia do dispatch base on the sig? Where is the function code 
in Julia source code?



[julia-users] Re: Is there something similar to IPython's Audio display in IJulia?

2014-11-03 Thread João Felipe Santos
Just in case it may be useful for anyone else, I ended up implementing this 
straight in Julia (code here: 
https://gist.github.com/jfsantos/a39ed69a7894876f1e04 
https://gist.github.com/jfsantos/a39ed69a7894876f1e04). 

I posted this to IJulia’s issue tracker in case the developers are interested 
in adding it to the module.

Cheers,

João 

 On Nov 3, 2014, at 6:04 PM, João Felipe Santos joao@gmail.com wrote:
 
 Hi,
 
 I would like to add an HTML5 audio player to my IJulia notebooks, similarly 
 to what is done in IPython notebooks. In IPython notebooks, there’s two 
 possibilities: you can either pass the path to an audio file (which is easy) 
 or a Numpy array (rendered as data:audio/wav;base64 straight into the HTML 
 file).
 
 Is there something similar in IJulia already? If negative, where can I find 
 more info on how to add this to IJulia?
 
 Cheers,
 
 João



Re: [julia-users] type confusions in list comprehensions (and how to work around it?)

2014-11-03 Thread K Leo
I found that I often have to force this conversion, which is not too 
difficult.  The question why comprehension has to build with type Any?



On 2014年11月04日 07:06, Miguel Bazdresch wrote:

 How could I force the type of gxs1 to be of an array of Float64?

The simplest way is:

gxs1 = Float64[g(x) for x in xs]

-- mb

On Mon, Nov 3, 2014 at 6:01 PM, Evan Pu evanthebou...@gmail.com 
mailto:evanthebou...@gmail.com wrote:


Consider the following interaction:

julia g(x) = 1 / (1 + x)
g (generic function with 1 method)

julia typeof(g(1.0))
Float64

julia xs = [1.0, 2.0, 3.0, 4.0]
4-element Array{Float64,1}:
 1.0
 2.0
 3.0
 4.0

julia gxs1 = [g(x) for x in xs]
4-element Array{Any,1}:
 0.5
 0.33
 0.25
 0.2

Why isn't gxs1 type of Array{Float64,1}?
How could I force the type of gxs1 to be of an array of Float64?

julia gxs2 = [convert(Float64,g(x)) for x in xs]
4-element Array{Any,1}:
 0.5
 0.33
 0.25
 0.2

somehow this doesn't seem to work...








Re: [julia-users] What's the relationship between a function and an anonymous function?

2014-11-03 Thread Isaiah Norton

 I guess, a function has one name and many defs(definition?). And Julia
 will do dispatch base on the sig.


Correct. See the Functions and Methods sections of the manual. Beyond that,
for a nice overview of multiple dispatch (and some consequences), see:

http://nbviewer.ipython.org/gist/StefanKarpinski/b8fe9dbb36c1427b9f22

For some lower-level details, I would suggest to start with Jeff's talk
from JuliaCon:

https://www.youtube.com/watch?v=osdeT-tWjzklist=PLP8iPy9hna6TSRouJfvobfxkZFYiPSvPdindex=10

(some other videos linked here: http://julialang.org/learning/)




On Mon, Nov 3, 2014 at 6:59 PM, yfrac...@gmail.com wrote:

 They seem have similar code.

 eg:

   function fun(x::Int)
x
   end

   function fun(x)
   x
   end

   fun.env.defs.func.code

   AST(:($(Expr(:lambda, {:x}, {{},{{:x,:Any,0}},{}}, :(begin
 return
 end)

   func2 = (x) - x
   func2.code

   AST(:($(Expr(:lambda, {:(x::Any)}, {{},{{:x,:Any,0}},{}}, :(begin  #
 none, line 1:
 return x
 end)

  And function has sig(signature?)

  fun.env.defs.sig
  (Any,)

 I guess, a function has one name and many defs(definition?). And Julia
 will do dispatch base on the sig.

 Is it right? Please correct me, if I made any mistakes. Please tell me
 more about Julia function!

 But how Julia do dispatch base on the sig? Where is the function code
 in Julia source code?




Re: [julia-users] What's the relationship between a function and an anonymous function?

2014-11-03 Thread yfractal
Thank you! :) 


Isaiah於 2014年11月4日星期二UTC+8上午11時16分20秒寫道:

 I guess, a function has one name and many defs(definition?). And Julia 
 will do dispatch base on the sig. 


 Correct. See the Functions and Methods sections of the manual. Beyond 
 that, for a nice overview of multiple dispatch (and some consequences), see:

 http://nbviewer.ipython.org/gist/StefanKarpinski/b8fe9dbb36c1427b9f22

 For some lower-level details, I would suggest to start with Jeff's talk 
 from JuliaCon:


 https://www.youtube.com/watch?v=osdeT-tWjzklist=PLP8iPy9hna6TSRouJfvobfxkZFYiPSvPdindex=10

 (some other videos linked here: http://julialang.org/learning/)




 On Mon, Nov 3, 2014 at 6:59 PM, yfra...@gmail.com javascript: wrote:

 They seem have similar code.

 eg:

   function fun(x::Int)
x
   end

   function fun(x)
   x
   end

   fun.env.defs.func.code

   AST(:($(Expr(:lambda, {:x}, {{},{{:x,:Any,0}},{}}, :(begin
 return
 end)

   func2 = (x) - x
   func2.code

   AST(:($(Expr(:lambda, {:(x::Any)}, {{},{{:x,:Any,0}},{}}, :(begin  # 
 none, line 1:
 return x
 end)

  And function has sig(signature?)

  fun.env.defs.sig
  (Any,)

 I guess, a function has one name and many defs(definition?). And Julia 
 will do dispatch base on the sig. 

 Is it right? Please correct me, if I made any mistakes. Please tell me 
 more about Julia function!

 But how Julia do dispatch base on the sig? Where is the function code 
 in Julia source code?




Re: [julia-users] type confusions in list comprehensions (and how to work around it?)

2014-11-03 Thread Jutho
This only happens in global scope, not inside a function? If you define
f(list) = return [g(x) for x in list]

then f(xs) will return an Array{Float64,1}. 

Op dinsdag 4 november 2014 03:23:36 UTC+1 schreef K leo:

 I found that I often have to force this conversion, which is not too 
 difficult.  The question why comprehension has to build with type Any? 


 On 2014年11月04日 07:06, Miguel Bazdresch wrote: 
   How could I force the type of gxs1 to be of an array of Float64? 
  
  The simplest way is: 
  
  gxs1 = Float64[g(x) for x in xs] 
  
  -- mb 
  
  On Mon, Nov 3, 2014 at 6:01 PM, Evan Pu evanth...@gmail.com 
 javascript: 
  mailto:evanth...@gmail.com javascript: wrote: 
  
  Consider the following interaction: 
  
  julia g(x) = 1 / (1 + x) 
  g (generic function with 1 method) 
  
  julia typeof(g(1.0)) 
  Float64 
  
  julia xs = [1.0, 2.0, 3.0, 4.0] 
  4-element Array{Float64,1}: 
   1.0 
   2.0 
   3.0 
   4.0 
  
  julia gxs1 = [g(x) for x in xs] 
  4-element Array{Any,1}: 
   0.5 
   0.33 
   0.25 
   0.2 
  
  Why isn't gxs1 type of Array{Float64,1}? 
  How could I force the type of gxs1 to be of an array of Float64? 
  
  julia gxs2 = [convert(Float64,g(x)) for x in xs] 
  4-element Array{Any,1}: 
   0.5 
   0.33 
   0.25 
   0.2 
  
  somehow this doesn't seem to work... 
  
  
  
  



[julia-users] Re: Cairo - PDF

2014-11-03 Thread cormullion
Thanks Tobias! Your clue led me to the point in the source where it goes:

for name in (:finish,:flush,:mark_dirty) 

@eval begin

$name(surface::CairoSurface) = 
ccall(($(string(cairo_surface_,name)),_jl_libcairo),  

Void, (Ptr{Void},), surface.ptr)

end

end
 
and finish(surface) appears to work well:

c = CairoPDFSurface(/tmp/helloworld.pdf,imwidth,imheight)
cr = CairoContext(c)
...
...
finish(c)



On Monday, November 3, 2014 9:03:10 PM UTC, Tobias Knopp wrote:

 Maybe use the Julia wrapper for  cairo_surface_flush?

 Am Montag, 3. November 2014 17:27:23 UTC+1 schrieb cormu...@mac.com:

 This is my Hello world for Cairo in Julia outputting to PNG:

 using Cairo

 imwidth = 200
 imheight = 200

 c = CairoRGBSurface(imwidth,imheight)
 cr = CairoContext(c)

 set_source_rgba(cr, 1, 0.7, 0.2, 0.9)
 set_line_width(cr, 1)
 circle(cr, 100, 100, 50)
 stroke(cr)

 select_font_face (cr, Helvetica, Cairo.FONT_SLANT_NORMAL, 
 Cairo.FONT_WEIGHT_NORMAL)
 set_font_size (cr, 12)
 move_to(cr, 100,100)
 show_text(cr,Hello world)

 write_to_png(c,/tmp/helloworld.png)
 run(`open /tmp/helloworld.png`)


 But I prefer to output to PDF. I've got as far as finding this:

 c = CairoPDFSurface(/tmp/helloworld.pdf, imwidth, imheight)


 but there's isn't a write_to_pdf() function (obviously?). But I can't get 
 any output.

 Pkg.installed() gives:

  Cairo = v0.2.20

 and I'm on version 0.3.0.