Re: [julia-users] Re: Debugging memory use

2014-03-15 Thread Tim Holy
See https://github.com/timholy/ProfileView.jl, or just inspect 
Profile.print(C=true) for calls to the garbage collector. This isn't perfect---
you're wondering about allocation, and this is gc---but since running gc is 
triggered by allocation, this can at least point you in the right direction.

A much more likely candidate for your underlying problem is a type-problem. 
code_typed or TypeCheck.jl may help you find it.

--Tim

On Friday, March 14, 2014 08:30:12 PM andrew cooke wrote:
 What would be nice is something that prints current heap size (without
 consuming any heap itself) that I could sprinkle through the code, so that
 I could see which statement allocates memory.
 
 On Friday, 14 March 2014 23:49:53 UTC-3, andrew cooke wrote:
  Any tips / pointers / docs on how to do this?
  
  I have some code that, according to @time, is using more memory than I
  expect.  How do I work out where the problem is, and reduce the memory
  use?
  
  Is there anything more efficient than writing small tests that focus on
  particular operations?
  
  I suspect my problem is that instances are being created on the heap when
  I expected them to be on the stack (the main data type hasa single field,
  which is an integer).
  
  Thanks,
  Andrew


[julia-users] How to change the array to Float64?

2014-03-15 Thread paul analyst
I imported an array of text and numbers. An array is a type of Any. I 
deleted the lines of text. The array is still type Any. How to change the 
array to Float64?
Paul


Re: [julia-users] How to change the array to Float64?

2014-03-15 Thread Andreas Noack Jensen
I think that float(Array) should do it.


2014-03-15 12:17 GMT+01:00 paul analyst paul.anal...@mail.com:

 I imported an array of text and numbers. An array is a type of Any. I
 deleted the lines of text. The array is still type Any. How to change
 the array to Float64?
 Paul




-- 
Med venlig hilsen

Andreas Noack Jensen


Re: [julia-users] How to change the array to Float64?

2014-03-15 Thread Mauro
if a is your array:
float(a)

On Sat, 2014-03-15 at 11:17, paul.anal...@mail.com wrote:
 I imported an array of text and numbers. An array is a type of Any. I 
 deleted the lines of text. The array is still type Any. How to change the 
 array to Float64?
 Paul



Re: [julia-users] How to change the array to Float64?

2014-03-15 Thread paul analyst
Thx friend!

W dniu sobota, 15 marca 2014 12:19:55 UTC+1 użytkownik Andreas Noack Jensen 
napisał:

 I think that float(Array) should do it.


 2014-03-15 12:17 GMT+01:00 paul analyst paul.a...@mail.com javascript:
 :

 I imported an array of text and numbers. An array is a type of Any. I 
 deleted the lines of text. The array is still type Any. How to change 
 the array to Float64?
 Paul




 -- 
 Med venlig hilsen

 Andreas Noack Jensen
  


[julia-users] Macro leads to slow code(?!)

2014-03-15 Thread andrew cooke

i have no idea what is happening here.  please can someone explain why 
these give such different results?  thanks, andrew

 cat Memory.jl

immutable Fast{U:Unsigned} 
i::U
end
+{U:Unsigned}(a::Fast{U}, b::Fast{U}) = Fast{U}(a.i $ b.i)

immutable Slow{I:Unsigned}  
i::I
end
for (name, op) in ((:+, $),)
@eval $name{U:Unsigned}(a::Slow{U}, b::Slow{U}) = Slow{U}($op(a.i, b.i
))
end

 julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+1998 (2014-03-13 01:20 
UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 9e0e3bd* (2 days old master)
|__/   |  x86_64-suse-linux

julia using Memory
Warning: requiring Memory did not define a corresponding module.

julia code_native(+, (Fast{Uint8}, Fast{Uint8}))
.text
Filename: /home/andrew/.julia/v0.3/IntModN/src/Memory.jl
Source line: 5
pushRBP
mov RBP, RSP
xor EDI, ESI
Source line: 5
mov AL, DIL
pop RBP
ret

julia code_native(+, (Slow{Uint8}, Slow{Uint8}))
.text
Filename: /home/andrew/.julia/v0.3/IntModN/src/Memory.jl
Source line: 11
pushRBP
mov RBP, RSP
pushRBX
sub RSP, 40
mov QWORD PTR [RBP - 40], 4
Source line: 11
movabs  RBX, 139916932623568
mov RAX, QWORD PTR [RBX]
mov QWORD PTR [RBP - 32], RAX
lea RAX, QWORD PTR [RBP - 40]
mov QWORD PTR [RBX], RAX
mov QWORD PTR [RBP - 16], 0
Source line: 11
mov QWORD PTR [RBP - 24], 13308928
movabs  RAX, 139916939396576
callRAX
movabs  RCX, 139916917454832
movzx   EDI, AL
callRCX
Source line: 11
lea RSI, QWORD PTR [RBP - 24]
Source line: 11
movabs  RCX, 139916917189328
mov QWORD PTR [RBP - 16], RAX
mov EDI, 29726432
mov EDX, 2
callRCX
mov AL, BYTE PTR [RAX + 8]
mov RCX, QWORD PTR [RBP - 32]
mov QWORD PTR [RBX], RCX
add RSP, 40
pop RBX
pop RBP
ret





[julia-users] How to find the position of the dot (another character) in the string

2014-03-15 Thread paul analyst
I have a dynamic file name in the variable x, such as 
Julia x 
namefile.txt 
How to find the position of the dot (another character)  in the string x
Paul


[julia-users] Re: How to find the position of the dot (another character) in the string

2014-03-15 Thread andrew cooke
julia search(abc.d, 
.)
4:4 



julia abc.d[4:4]
. 

 
http://julia.readthedocs.org/en/latest/stdlib/base/#strings

andrew
   


On Saturday, 15 March 2014 09:13:19 UTC-3, paul analyst wrote:

 I have a dynamic file name in the variable x, such as 
 Julia x 
 namefile.txt 
 How to find the position of the dot (another character)  in the string x
 Paul



Re: [julia-users] Re: Debugging memory use

2014-03-15 Thread andrew cooke

thanks.  i thought i had checked types by adding typed variables (and 
seeing no change), but i went back and pored over the details of 
code_typed() and turned up some weird behaviour that seems to be the cause 
of things.

andrew

On Saturday, 15 March 2014 07:41:31 UTC-3, Tim Holy wrote:

 See https://github.com/timholy/ProfileView.jl, or just inspect 
 Profile.print(C=true) for calls to the garbage collector. This isn't 
 perfect--- 
 you're wondering about allocation, and this is gc---but since running gc 
 is 
 triggered by allocation, this can at least point you in the right 
 direction. 

 A much more likely candidate for your underlying problem is a 
 type-problem. 
 code_typed or TypeCheck.jl may help you find it. 

 --Tim 

 On Friday, March 14, 2014 08:30:12 PM andrew cooke wrote: 
  What would be nice is something that prints current heap size (without 
  consuming any heap itself) that I could sprinkle through the code, so 
 that 
  I could see which statement allocates memory. 
  
  On Friday, 14 March 2014 23:49:53 UTC-3, andrew cooke wrote: 
   Any tips / pointers / docs on how to do this? 
   
   I have some code that, according to @time, is using more memory than I 
   expect.  How do I work out where the problem is, and reduce the memory 
   use? 
   
   Is there anything more efficient than writing small tests that focus 
 on 
   particular operations? 
   
   I suspect my problem is that instances are being created on the heap 
 when 
   I expected them to be on the stack (the main data type hasa single 
 field, 
   which is an integer). 
   
   Thanks, 
   Andrew 



Re: [julia-users] Re: GSOC-2014 Implement native julia ODE solver

2014-03-15 Thread Niluka Piyasinghe

I have posted some of my ideas about ODE solver in 
#18https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2FODE.jl%2Fissues%2F18sa=Dsntz=1usg=AFQjCNGKJXDal-ssZV4CCzlL1pBftf0YNQ(Nicksol
 in Github) .I am waiting for suggestions.

Thanks.


[julia-users] calendar , how to calculate the distance in time ?

2014-03-15 Thread paul analyst
I have data from a calendar like this: 
20130628.2 
20130701.3 
19970224.4 
19990230.5 
How to calculate the distance in time (in days) between dates and other 
similar treatments on the calendar?
Paweł


[julia-users] Re: Macro leads to slow code(?!)

2014-03-15 Thread andrew cooke

aha.

ok, so i was substituting $ rather than :$ for the function, which i 
guess means it's resolved to be $(::Any, ::Any) before substitution.  if i 
use the symbol :$ then things work correctly.

so this works fine:

immutable Fast{U:Unsigned}
i::U
end
+{U:Unsigned}(a::Fast{U}, b::Fast{U}) = Fast{U}(a.i $ b.i)

immutable Slow{I:Unsigned}
i::I
end
for (name, op) in ((:+, :$),)
@eval $name{U:Unsigned}(a::Slow{U}, b::Slow{U}) = Slow{U}(($op)(a.i, b.
i))
end





[julia-users] Re: calendar , how to calculate the distance in time ?

2014-03-15 Thread paul analyst


W dniu sobota, 15 marca 2014 13:53:42 UTC+1 użytkownik paul analyst napisał:

 I have data from a calendar like this: 
 20130628.2 
 20130701.3 
 19970224.4 
 19990230.5 
 How to calculate the distance in time (in days) between dates and other 
 similar treatments on the calendar? (dot is separtor )
 Paweł



[julia-users] Re: How do you unload a package?

2014-03-15 Thread Steven G. Johnson


On Friday, March 14, 2014 2:33:27 PM UTC-4, Ivar Nesje wrote:

 I think you should be able to use the fully qualified name

 Winston.plot(...)



Note also that if are intending to access the functions via the fully 
qualified names you should do

 import Winston

instead of using Winston

You can also define a shortcut via e.g.

 import Winston
 const W = Winston 
 W.plot()


Re: [julia-users] Re: How do you unload a package?

2014-03-15 Thread Mohammed El-Beltagy
I would like to know what is the difference between import and using?
When is it advantageous to use either of them?
On Mar 15, 2014 3:18 PM, Steven G. Johnson stevenj@gmail.com wrote:



 On Friday, March 14, 2014 2:33:27 PM UTC-4, Ivar Nesje wrote:

 I think you should be able to use the fully qualified name

 Winston.plot(...)



 Note also that if are intending to access the functions via the fully
 qualified names you should do

  import Winston

 instead of using Winston

 You can also define a shortcut via e.g.

  import Winston
  const W = Winston
  W.plot()



[julia-users] Re: Error while reading image

2014-03-15 Thread Siddha Ganju


https://lh3.googleusercontent.com/-UyyM8VY5puY/UyRYB11L-WI/Bcs/QVZ-mQfaPWg/s1600/Screenshot+from+2014-03-15+18%3A53%3A25.png

On Windows I had installed ImageMagick manually. ImageMagick is working 
fine, so I think. But with Julia, I get the same errors. 

Then on Ubuntu 12.04, while doing 

Pkg.build(ImageView)

I get the errors as in the image. I have installed ImageMagick on Ubuntu, 
and added and exported the path too. 

So the problem ultimately is the same I am unable to read any image, be it 
either on Windows or Ubuntu. Is it possible that this is hardware based?


[julia-users] Re: Error while reading image

2014-03-15 Thread Siddha Ganju
Sorry I forgot this part: 

Should I try building each package and all its dependencies independently?



Re: [julia-users] Re: How do you unload a package?

2014-03-15 Thread Mauro
On Sat, 2014-03-15 at 13:32, moham...@computer.org wrote:
 I would like to know what is the difference between import and using?
 When is it advantageous to use either of them?

https://groups.google.com/d/msg/julia-users/xbsdu8Ob4cw/FcJyBZQYfIwJ

there Kevin says:

Briefly:
1. using MyModule imports all of the exported functions of MyModule into the 
current namespace
2. import MyModule imports the module name; functions can be called with 
MyModule.fn(x,y)
3. import MyModule: fn1, fn2 imports the functions fn1 and fn2 into the 
current namespace
4. require(somefile.jl) loads a particular file.  This is useful when:

  a. you have a script or some bare function definitions you wish to 
load/execute from another file or at the REPL
  b. a file defines a module with a different name than the filename (as in my 
answer to #1 above)


 On Mar 15, 2014 3:18 PM, Steven G. Johnson stevenj@gmail.com wrote:



 On Friday, March 14, 2014 2:33:27 PM UTC-4, Ivar Nesje wrote:

 I think you should be able to use the fully qualified name

 Winston.plot(...)



 Note also that if are intending to access the functions via the fully
 qualified names you should do

  import Winston

 instead of using Winston

 You can also define a shortcut via e.g.

  import Winston
  const W = Winston
  W.plot()




[julia-users] Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
Hi everyone,

I'm wondering if there are smart pointers like C++ in Julia.
Calling C functions often require managing raw pointers allocated in the C 
functions.
After allocating a pointer, I want to wrap it up with a smart pointer, 
which automatically frees the raw pointer when the smart pointer itself is 
removed with a garbage collector.
As for pointers to an array, the `pointer_to_array` method seems to be 
suitable in this case (
http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array).

More generally speaking, I want a functionality that is something like a 
destructor to manage resources more readily.
Is it possible to call a function just before a Julia object is destructed?

Thanks.


[julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Patrick O'Leary
Maybe finalizer() will do what you need? 
http://julia.readthedocs.org/en/latest/stdlib/base/#Base.finalizer

On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

 I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in the C 
 functions.
 After allocating a pointer, I want to wrap it up with a smart pointer, 
 which automatically frees the raw pointer when the smart pointer itself is 
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be 
 suitable in this case (
 http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like a 
 destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is destructed?

 Thanks.



Re: [julia-users] Re: Error while reading image

2014-03-15 Thread Tim Holy
Images and ImageView are separate. The easier case should be Linux, as my own 
platform is Ubuntu 12.04 and it works fine. So let's start there.

First, does Pkg.build(Images) work? Note: Images, not ImageView!

Second, Pkg.build(ImageView) is failing because Pkg.build(Tk) is failing. 
To me it looks like the build script (in $PKGDIR/Tk/deps/build.jl) is 
expecting to find a tk8.6 package, but on Ubuntu 12.04 the latest is tk8.5. I'd 
recommend manually doing
 sudo apt-get install tk8.5 tcl8.5

Then try Pkg.build(Tk). If that works, try Pkg.build(ImageView).

Let us know whether this works, so we know what to do to improve the build 
script.

--Tim 


On Saturday, March 15, 2014 06:54:56 AM Siddha Ganju wrote:
 Sorry I forgot this part:
 
 Should I try building each package and all its dependencies independently?


[julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
Thanks for your reply.

I didn't know finalizer(), and that seemed just to be the thing I wanted.
Sadly, I couldn't use it for freeing a pointer:

julia finalizer(c_malloc(1024), c_free)
ERROR: objects of type Ptr{None} cannot be finalized


And this also wouldn't work:

immutable SmartPointer{T}
pointer::Ptr{T}

function SmartPointer(p::Ptr{T})
smart_p = new(p)
finalizer(smart_p, p - c_free(p.pointer))
end
end

p = SmartPointer{Uint8}(convert(Ptr{Uint8}, c_malloc(1024)))

Am I doing something wrong?


On Sunday, March 16, 2014 12:12:31 AM UTC+9, Patrick O'Leary wrote:

 Maybe finalizer() will do what you need? 
 http://julia.readthedocs.org/en/latest/stdlib/base/#Base.finalizer

 On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

 I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in the 
 C functions.
 After allocating a pointer, I want to wrap it up with a smart pointer, 
 which automatically frees the raw pointer when the smart pointer itself is 
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be 
 suitable in this case (
 http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like a 
 destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is 
 destructed?

 Thanks.



Re: [julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Jameson Nash
The Julia GC doesn't track immutable types, so it can't finalize them. You
must use a regular type if you want it to be tracked by the GC.


On Sat, Mar 15, 2014 at 3:44 PM, Kenta Sato bicycle1...@gmail.com wrote:

 Thanks for your reply.

 I didn't know finalizer(), and that seemed just to be the thing I wanted.
 Sadly, I couldn't use it for freeing a pointer:

 julia finalizer(c_malloc(1024), c_free)
 ERROR: objects of type Ptr{None} cannot be finalized


 And this also wouldn't work:

 immutable SmartPointer{T}
 pointer::Ptr{T}

 function SmartPointer(p::Ptr{T})
 smart_p = new(p)
 finalizer(smart_p, p - c_free(p.pointer))
 end
 end

 p = SmartPointer{Uint8}(convert(Ptr{Uint8}, c_malloc(1024)))

 Am I doing something wrong?


 On Sunday, March 16, 2014 12:12:31 AM UTC+9, Patrick O'Leary wrote:

 Maybe finalizer() will do what you need? http://julia.readthedocs.org/
 en/latest/stdlib/base/#Base.finalizer

 On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

 I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in the
 C functions.
 After allocating a pointer, I want to wrap it up with a smart pointer,
 which automatically frees the raw pointer when the smart pointer itself is
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be
 suitable in this case (http://docs.julialang.org/en/
 latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like a
 destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is
 destructed?

 Thanks.




Re: [julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
You are quite right!
Changing `immutable` to `type` fixed the problem:

type SmartPointer{T}
pointer::Ptr{T}

function SmartPointer(p::Ptr{T})
smart_p = new(p)
finalizer(smart_p, p - c_free(p.pointer))
smart_p
end
end 

This seems to work perfectly, prevents the memory leak in my sample code.
Thanks a lot!


On Sunday, March 16, 2014 12:52:00 AM UTC+9, Jameson wrote:

 The Julia GC doesn't track immutable types, so it can't finalize them. You 
 must use a regular type if you want it to be tracked by the GC.


 On Sat, Mar 15, 2014 at 3:44 PM, Kenta Sato bicyc...@gmail.comjavascript:
  wrote:

 Thanks for your reply.

 I didn't know finalizer(), and that seemed just to be the thing I wanted.
 Sadly, I couldn't use it for freeing a pointer:

 julia finalizer(c_malloc(1024), c_free)
 ERROR: objects of type Ptr{None} cannot be finalized


 And this also wouldn't work:

 immutable SmartPointer{T}
 pointer::Ptr{T}

 function SmartPointer(p::Ptr{T})
 smart_p = new(p)
 finalizer(smart_p, p - c_free(p.pointer))
 end
 end

 p = SmartPointer{Uint8}(convert(Ptr{Uint8}, c_malloc(1024)))

 Am I doing something wrong?


 On Sunday, March 16, 2014 12:12:31 AM UTC+9, Patrick O'Leary wrote:

 Maybe finalizer() will do what you need? http://julia.readthedocs.org/
 en/latest/stdlib/base/#Base.finalizer

 On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

  I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in 
 the C functions.
 After allocating a pointer, I want to wrap it up with a smart pointer, 
 which automatically frees the raw pointer when the smart pointer itself is 
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be 
 suitable in this case (http://docs.julialang.org/en/
 latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like 
 a destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is 
 destructed?

 Thanks.




[julia-users] How to access to a generic bitstype?

2014-03-15 Thread J Luis
Hi,

I am trying to access to members of a structure 'imported' via ccall and 
where Clang.jl declared the types as being

bitstype int(WORD_SIZE/8)*sizeof(Cdouble)*2 Array_2_Cdouble
bitstype int(WORD_SIZE/8)*sizeof(Uint8)*80 Array_80_Uint8

But I now am incapable of accessing their contents. Below is an example of 
what I tried (also tried several other variations of this)


julia typeof(hdr.title)
Array_80_Uint8

julia typeof(hdr.inc)
Array_2_Cdouble

julia hdr.inc[1]
ERROR: no method getindex(Array_2_Cdouble, Int64)

How can access those guys?

Thanks


[julia-users] Re: GSOC-2014 Implement native julia ODE solver

2014-03-15 Thread Niluka Piyasinghe

I have extended 
SortingAlgorithms.jlhttps://github.com/JuliaLang/SortingAlgorithms.jlto 
support for selection sort .See 
https://github.com/JuliaLang/SortingAlgorithms.jl/pull/4Implement of 
Selection sort https://github.com/JuliaLang/SortingAlgorithms.jl/pull/4for 
details.I know selection sort is a very simple algorithms.But i will 
make some contributions in upcoming days.Also i  have posted  at my ideas 
about  GSOC ODE solver project in 
#18https://github.com/JuliaLang/ODE.jl/issues/18.

On Thursday, March 13, 2014 8:49:14 PM UTC+5:30, Ivar Nesje wrote:

 We look forward to see posted julia code. Pull Requests is a great way to 
 show your skills, whether they are accepted or not. Most of our sorting 
 algorithms have been moved to 
 SortingAlgorithms.jlhttps://github.com/JuliaLang/SortingAlgorithms.jl, 
 so I would expect that it would be hard get a new algorithm accepted into 
 base.

 ODE solvers will be developed in the 
 ODE.jlhttps://github.com/JuliaLang/ODE.jlpackage repository. We have just 
 tagged version 0.1.0, and made braking 
 changes to the 
 APIhttps://github.com/JuliaLang/ODE.jl/blob/master/doc/api.mdthat will be 
 effective when the next version is released, so if anyone who 
 has an interest in ODE solvers and APIs, could give their input, that would 
 be fantastic.

 I don't understand your question about Runge Kutta formulas, but I think 
 the guiding factor with regards to what algorithms we use is the interest 
 of our contributors. If the algorithm is sound, well implemented, useful, 
 and it does not fit better in one of the other packages, it will be 
 accepted in ODE.jl

 Regards
 Ivar

 kl. 10:09:16 UTC+1 torsdag 13. mars 2014 skrev Niluka Piyasinghe følgende:

 Hi everyone,

   This is about ODE solver project in the GSOC ideas page.I read  
 https://github.com/JuliaLang/julia/issues/75 
 and i want to know that  i could only make algorithms based on Runge 
 Kutta formulas or i could any use any methods also for this project.I would 
 like to contact a mentor to discuss about  ideas further.

 I have learned about julia over past months and  I am trying to 
 contribute to julia before GSOC project by extending 
 sort.jlhttps://github.com/JuliaLang/julia/blob/master/base/sort.jl package 
 to support for Bucket sort and some other sorting algorithms as well.I will 
 post my codes in few days.



  Thank you!

 Niluka Piyasinghe
 Department of computer engineering,
 University of Peradeniya. 



[julia-users] Re: Cairo build error

2014-03-15 Thread Laszlo Hars
Anyone? Any idea? This error prevents using Julia graphics. Does it mean 
that nobody uses graphics in Julia, or is there something wrong with my 
installation, which I could fix somehow?

On Sunday, March 9, 2014 11:35:26 AM UTC-6, Laszlo Hars wrote:

 forgot to say:
 Win7 x64
 Julia Version 0.3.0-prerelease+1400



Re: [julia-users] How to access to a generic bitstype?

2014-03-15 Thread Isaiah Norton
The current version of Clang.jl will create an immutable like:

immutable Array_2_Cdouble
  d1::Cdouble
  d2::Cdouble
end

which can be indexed numerically as expected.


On Sat, Mar 15, 2014 at 1:54 PM, J Luis jmfl...@gmail.com wrote:

 Hi,

 I am trying to access to members of a structure 'imported' via ccall and
 where Clang.jl declared the types as being

 bitstype int(WORD_SIZE/8)*sizeof(Cdouble)*2 Array_2_Cdouble
 bitstype int(WORD_SIZE/8)*sizeof(Uint8)*80 Array_80_Uint8

 But I now am incapable of accessing their contents. Below is an example of
 what I tried (also tried several other variations of this)


 julia typeof(hdr.title)
 Array_80_Uint8

 julia typeof(hdr.inc)
 Array_2_Cdouble

 julia hdr.inc[1]
 ERROR: no method getindex(Array_2_Cdouble, Int64)

 How can access those guys?

 Thanks



Re: [julia-users] Re: Cairo build error

2014-03-15 Thread Isaiah Norton
Is everything updated (Pkg.update())? There aren't a huge number of users
on Windows, but I know *some* people other than me are using Cairo.jl on
Windows. Are you using version 0.2, or a prerelease build?


On Sat, Mar 15, 2014 at 2:25 PM, Laszlo Hars laszloh...@gmail.com wrote:

 Anyone? Any idea? This error prevents using Julia graphics. Does it mean
 that nobody uses graphics in Julia, or is there something wrong with my
 installation, which I could fix somehow?


 On Sunday, March 9, 2014 11:35:26 AM UTC-6, Laszlo Hars wrote:

 forgot to say:
 Win7 x64
 Julia Version 0.3.0-prerelease+1400




Re: [julia-users] How to access to a generic bitstype?

2014-03-15 Thread Isaiah Norton
I've just created a new set of wrapper files against gmt 5.1 using the
latest version of Clang.jl, and gave you commit access to the repo.

https://github.com/ihnorton/GMT.jl

(I don't have a build of it though so I haven't tested anything)


On Sat, Mar 15, 2014 at 2:53 PM, Isaiah Norton isaiah.nor...@gmail.comwrote:

 The current version of Clang.jl will create an immutable like:

 immutable Array_2_Cdouble
   d1::Cdouble
   d2::Cdouble
 end

 which can be indexed numerically as expected.


 On Sat, Mar 15, 2014 at 1:54 PM, J Luis jmfl...@gmail.com wrote:

 Hi,

 I am trying to access to members of a structure 'imported' via ccall and
 where Clang.jl declared the types as being

 bitstype int(WORD_SIZE/8)*sizeof(Cdouble)*2 Array_2_Cdouble
 bitstype int(WORD_SIZE/8)*sizeof(Uint8)*80 Array_80_Uint8

 But I now am incapable of accessing their contents. Below is an example
 of what I tried (also tried several other variations of this)


 julia typeof(hdr.title)
 Array_80_Uint8

 julia typeof(hdr.inc)
 Array_2_Cdouble

 julia hdr.inc[1]
 ERROR: no method getindex(Array_2_Cdouble, Int64)

 How can access those guys?

 Thanks





Re: [julia-users] Re: Cairo build error

2014-03-15 Thread Laszlo Hars
Thanks, Isaiah, for your response. Below is what I see.

~~~
Version 0.3.0-prerelease+1400 (2014-02-05 19:14 UTC)
Commit 6f3a4b6* (37 days old master)
x86_64-w64-mingw32
~~~
julia Pkg.update()
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove
~~~
julia using Cairo
ERROR: could not open file ...\.julia\Cairo\src\../deps/deps.jl
while loading ...\.julia\Cairo\src\Cairo.jl, in expression starting on line 
3
~~~
julia Pkg.add(Cairo)
INFO: Nothing to be done
~~~

I even tried to build Cairo manually:
~~~
julia include(homedir() * \\.julia\\Cairo\\deps\\build.jl)
ERROR: i not defined
 in next at env.jl:127
 in merge! at dict.jl:77
while loading ...\.julia\Cairo\deps\build.jl, in expression starting on 
line 225
~~~

I also tried renaming the Cairo directory and add the Cairo package again. 
It used to get back to the previous state, but today I got:
~~~
julia Pkg.add(Cairo)
ERROR: unknown package Cairo
 in error at error.jl:21
 in anonymous at multi.jl:47
~~~

It looks like a mess...


Re: [julia-users] How to access to a generic bitstype?

2014-03-15 Thread J Luis
Thank you for doing this.
See my first issue there, which in fact is more a Clang.jl issue

Sábado, 15 de Março de 2014 19:33:54 UTC, Isaiah escreveu:

 I've just created a new set of wrapper files against gmt 5.1 using the 
 latest version of Clang.jl, and gave you commit access to the repo.

 https://github.com/ihnorton/GMT.jl

 (I don't have a build of it though so I haven't tested anything)


 On Sat, Mar 15, 2014 at 2:53 PM, Isaiah Norton 
 isaiah...@gmail.comjavascript:
  wrote:

 The current version of Clang.jl will create an immutable like:

 immutable Array_2_Cdouble
   d1::Cdouble
   d2::Cdouble
 end

 which can be indexed numerically as expected.


 On Sat, Mar 15, 2014 at 1:54 PM, J Luis jmf...@gmail.com 
 javascript:wrote:

 Hi,

 I am trying to access to members of a structure 'imported' via ccall and 
 where Clang.jl declared the types as being

 bitstype int(WORD_SIZE/8)*sizeof(Cdouble)*2 Array_2_Cdouble
 bitstype int(WORD_SIZE/8)*sizeof(Uint8)*80 Array_80_Uint8

 But I now am incapable of accessing their contents. Below is an example 
 of what I tried (also tried several other variations of this)


 julia typeof(hdr.title)
 Array_80_Uint8

 julia typeof(hdr.inc)
 Array_2_Cdouble

 julia hdr.inc[1]
 ERROR: no method getindex(Array_2_Cdouble, Int64)

 How can access those guys?

 Thanks





Re: [julia-users] Unexpected type behaviour in arithmetic operations

2014-03-15 Thread John Myles White
I don’t this would be a great way to handle 32-bit compatibility since the 
cases where you want 64-bit integers are cases where you don’t want wrapping to 
happen until you get all the way to 2^64 numbers.

 — John

On Mar 13, 2014, at 7:29 PM, Ben bber...@gmail.com wrote:

 Now that I think about it, can you do 32/64 bit compatability this way too?
 
 On Thursday, March 13, 2014 10:26:11 PM UTC-4, Ben wrote:
 Yes, that's what I meant. I just realized all you need to do % 2^32 or  
 0xff whenever you add... disregard that lol
 
 On Thursday, March 13, 2014 10:10:45 PM UTC-4, John Myles White wrote:
 By integer overflow, do you mean wrapping arithmetic like you’d get from 
 doing everything mod N for some integer N?
 
  — John
 
 On Mar 13, 2014, at 7:08 PM, Ben bbe...@gmail.com wrote:
 
 Sorry if this is hijacking the thread, but I'm wondering is there a way to 
 force integer overflow? I think it would be useful for things like sliding 
 window protocols.
 
 Also, is there a way to release julia code that works on both 32 bit and 64 
 bit machines? (it sounds like annotating types as 32-bit isn't enough)
 
 Great language by the way!
 
 On Saturday, March 1, 2014 6:30:00 PM UTC-5, Stefan Karpinski wrote:
 There's been many discussions of this before. The basic premise is simple: 
 all integer arithmetic is done in your native word size. When you store that 
 result somewhere, it is converted to the storage type. Since you can do most 
 operations on Int64s and then convert to Int32 and get the exact same 
 answer, this works out fine. I have yet to hear a really convincing argument 
 for why we shouldn't just do everything in native int size.
 
 
 On Sat, Mar 1, 2014 at 6:26 PM, Stefan Karpinski ste...@karpinski.org 
 wrote:
 On Fri, Feb 28, 2014 at 8:49 AM, andrew cooke and...@acooke.org wrote:
 defining
   Base.promote_rule(::Type{Int32}, ::Type{Int32}) = Int32
 doesn't help either, and i'm not sure why.
 
 Promotion only applies when the types don't already have the same type. When 
 you write int32(1) + int32(2) you call this method: 
 https://github.com/JuliaLang/julia/blob/master/base/int.jl#L16, which 
 explicitly converts the values to your native Int type and then does the 
 work.
 
 



Re: [julia-users] Re: Cairo build error

2014-03-15 Thread Laszlo Hars
I removed every piece of the Julia installation, and reinstalled in new 
directories the newest prerelease:
Version 0.3.0-prerelease+1897 (2014-03-07 09:35 UTC)

Now Cairo (and Tk) installs w/o errors. I just wish Julia gave more 
informative error messages. (I spent two days struggling with the seemingly 
impossible task to get Tk to work.)

Sorry for the noise! (The moral: if something fails, try to re-install 
everything.)


Re: [julia-users] Re: Cairo build error

2014-03-15 Thread Stefan Karpinski
That is the software installation version of turning it off and on again.

 On Mar 15, 2014, at 9:27 PM, Laszlo Hars laszloh...@gmail.com wrote:
 
 I removed every piece of the Julia installation, and reinstalled in new 
 directories the newest prerelease:
 Version 0.3.0-prerelease+1897 (2014-03-07 09:35 UTC)
 
 Now Cairo (and Tk) installs w/o errors. I just wish Julia gave more 
 informative error messages. (I spent two days struggling with the seemingly 
 impossible task to get Tk to work.)
 
 Sorry for the noise! (The moral: if something fails, try to re-install 
 everything.)


Re: [julia-users] Re: Error while reading image

2014-03-15 Thread Siddha Ganju
Yes, that works absolutely fine. But every-time I have to do using
ImageView I have to build it first. Pkg.build(Images) works
absolutely fine. Thank you for your help.

On 3/15/14, Tim Holy tim.h...@gmail.com wrote:
 Images and ImageView are separate. The easier case should be Linux, as my
 own
 platform is Ubuntu 12.04 and it works fine. So let's start there.

 First, does Pkg.build(Images) work? Note: Images, not ImageView!

 Second, Pkg.build(ImageView) is failing because Pkg.build(Tk) is
 failing.
 To me it looks like the build script (in $PKGDIR/Tk/deps/build.jl) is
 expecting to find a tk8.6 package, but on Ubuntu 12.04 the latest is tk8.5.
 I'd
 recommend manually doing
  sudo apt-get install tk8.5 tcl8.5

 Then try Pkg.build(Tk). If that works, try Pkg.build(ImageView).

 Let us know whether this works, so we know what to do to improve the build
 script.

 --Tim


 On Saturday, March 15, 2014 06:54:56 AM Siddha Ganju wrote:
 Sorry I forgot this part:

 Should I try building each package and all its dependencies
 independently?



-- 
Siddha Ganju
3rd Year Undergraduate Student
Computer Science and Engineering Department
National Institute of Technology, Hamirpur - 177005
E-mail Id : siddhaga...@gmail.com