[julia-users] Adding Julia package to METADATA.jl

2014-09-05 Thread Samuel S. Watson
I have a package I put on GitHub that I'd like to request be added to METADATA.jl. My understanding is that I'm supposed to fork JuliaLang/METADATA.jl, add my package, and then submit a pull request. My problem is with the add-my-package step. When I try to push from my package directory, it

[julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Ivar Nesje
See the docs for package development http://docs.julialang.org/en/latest/manual/packages/#package-development You seem to be stuck at Pkg.register http://docs.julialang.org/en/latest/stdlib/pkg/?highlight=pkg.register#Base.Pkg.register (yourpackage) On Friday, September 5, 2014 8:41:54 AM

Re: [julia-users] Adding Julia package to METADATA.jl

2014-09-05 Thread Mauro
I think it should work like this: Fork METADATA.jl on github web interface, get address of your fork and do $ git clone g...@github.com:your-user-name/METADATA.jl.git $ cd METADATA.jl make a new branch: $ git branch mypack $ git checkout mypack add the stuff for your package in a folder, say

Re: [julia-users] Re: How quickly calculate the entropy for long vectors ? -sum(x-x*log(2,x), [count(x-x==c,s)/length(s) for c in unique(s)])

2014-09-05 Thread Paul Analyst
THX, work but: julia t=h5read(FMLo2_z_reversem.h5,FMLo2,(:,1)); julia eltype(t) Float64 julia t 5932868x1 Array{Float64,2}: 0.0181719 0.303473 -0.526979 ? -0.526979 0.912295 -0.0281875 julia entropy(t) NaN julia entropy(vec(t)) NaN Why ? julia s 100-element Array{Float64,1}:

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Einar Otnes
Sorry, I'm a bit slow. How do I look up a binding for a specific module? In other words, how would I explicitly get to call the fftfreq function in the DSP module from C/C++? Is this this documented anywhere in Julia docs? Thanks, Einar On Wednesday, September 3, 2014 3:10:59 PM UTC+2,

Re: [julia-users] Re: How quickly calculate the entropy for long vectors ? -sum(x-x*log(2,x), [count(x-x==c,s)/length(s) for c in unique(s)])

2014-09-05 Thread Gunnar Farnebäck
You get NaN because the binning has left some bin empty and x * log(2, x) for x = 0.0 results in 0.0 * -Inf which is NaN. You can avoid this particular problem by replacing x * log(2,x) with something that special cases x = 0.0 to return 0.0 rather than NaN. Note that the result you get from

[julia-users] Re: How quickly calculate the entropy for long vectors ? -sum(x-x*log(2,x), [count(x-x==c,s)/length(s) for c in unique(s)])

2014-09-05 Thread Sebastian Nowozin
Hi Paul, independent of the speed issue: it seems you are trying to estimate the discrete entropy from frequencies, as opposed to compute the entropy of a categorical distribution. The naive plugin frequency estimator you use is a bad estimator, and you may want to consider using an entropy

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Ivar Nesje
Sorry, the function is obviously called jl_symbol, not jl_sym On Friday, September 5, 2014 11:15:16 AM UTC+2, Ivar Nesje wrote: I would guess that something like module = jl_eval_global_var https://github.com/JuliaLang/julia/blob/6277015ee3d46f20149136d092525bec95b6e29d/src/julia.h#L917

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Ivar Nesje
I would guess that something like module = jl_eval_global_var https://github.com/JuliaLang/julia/blob/6277015ee3d46f20149136d092525bec95b6e29d/src/julia.h#L917 (jl_main_module, jl_sym https://github.com/JuliaLang/julia/blob/6277015ee3d46f20149136d092525bec95b6e29d/src/julia.h#L666 (MyModule))

[julia-users] Re: Matrix crossproduct by groups of rows

2014-09-05 Thread Giuseppe Ragusa
Hi Gray thank you very much. Yes, memory allocation is astonishing. This works great. On Friday, September 5, 2014 6:59:53 AM UTC+2, Gray Calhoun wrote: On Wednesday, September 3, 2014 6:46:07 PM UTC-5, Giuseppe Ragusa wrote: I have been struggling to find a fast and elegant way to

[julia-users] Range to Array with power functions fails

2014-09-05 Thread Földes László
This works fine: julia x = 1:5 1:5 julia y = [z^2 for z in x] 5-element Array{Any,1}: 1 4 9 16 25 and I can use similar solution with a simplified form: julia y = [x*2] 5-element Array{Int64,1}: 2 4 6 8 10 so I got brave and tried this, but it failed: julia x = 1:5 1:5

Re: [julia-users] Range to Array with power functions fails

2014-09-05 Thread Tim Holy
Try y = x.^2 --Tim On Friday, September 05, 2014 03:29:37 AM Földes László wrote: This works fine: julia x = 1:5 1:5 julia y = [z^2 for z in x] 5-element Array{Any,1}: 1 4 9 16 25 and I can use similar solution with a simplified form: julia y = [x*2] 5-element

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Einar Otnes
Thank you for your help on this. It seems that the 'jl_eval_global_var' function is local as I got the error undefined reference to `jl_eval_global_var' when linking. I replaced your suggestion with: jl_module_t* jl_dsp_module = (jl_module_t*) jl_get_binding(jl_main_module, jl_symbol(DSP));

[julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Samuel S. Watson
For the record, I tried Mauro's suggestion, and it worked but it wasn't the right thing to do. And the step where I'm stuck is Pkg.publish(), not Pkg.register(). That's the one that the documentation says often breaks, and it also doesn't take any arguments, which makes me think it's going to

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Jacob Quinn
wasn't the right thing to do... I don't think I'd say that. It's essentially what Pkg.publish() is doing underneath anyway (or tries to do). The steps he listed are actually how I bump packages all the time, since I've had troubles with Pkg.publish() as well. -Jacob On Fri, Sep 5, 2014 at 9:36

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Tim Holy
I haven't followed this thread, and these steps require a bit of git savvy, but: you probably need to go into the package METADATA directory, create a branch with all your registrations, then check out metadata-v2 again. Do a rebase on origin/metadata-v2 and edit it to keep just the

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Jacob Quinn
On Tim's point, I usually keep a totally separate METADATA.jl directory apart from the one installed in .julia/0.3 or .julia/0.4. I hate to be sharing all my manual package dev tips, but I will say I'm thoroughly looking forward to the much-mentioned Pkg overhaul. -Jacob On Fri, Sep 5, 2014 at

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Samuel S. Watson
OK, that's a fair point. What I should have said is that my interpretation of what he said wasn't the right thing to do. It hinges on what stuff is supposed to be added to the directory. I had assumed it was the package stuff, and in fact it's supposed to be a directory containing some version

Re: [julia-users] Adding Julia package to METADATA.jl

2014-09-05 Thread Kevin Squire
Hi Sam, Just for clarification, it sounds like you've registered other packages using Pkg.register, but don't intend for them to be included in METADATA.jl. Is this correct? Or are you concerned that packages that you have created (e.g., with Pkg.generate) would somehow be published by

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Leah Hanson
If you run `Pkg.register(YourPkgName)` at the Julia REPL, it will generate that folder for you (complete with the commit hashes). Does that work for you? On Fri, Sep 5, 2014 at 9:06 AM, Samuel S. Watson samuel.s.wat...@gmail.com wrote: OK, that's a fair point. What I should have said is that

Re: [julia-users] Re: Adding Julia package to METADATA.jl

2014-09-05 Thread Kevin Squire
Just to expand on Leah's answer, there's a nice section in the manual on Package development http://julia.readthedocs.org/en/latest/manual/packages/#package-development, which includes information about publishing to METADATA.jl. Cheers, Kevin On Fri, Sep 5, 2014 at 7:11 AM, Leah Hanson

[julia-users] Pkg.add(Cairo) fails

2014-09-05 Thread julio valdes
I am a new Julia user 'want to be'. On a computer that has never seen Julia before I made a fresh installation of Julia-0.3.0. I wanted to follow a hands on tutorial which included some plots that required the Cairo package. The very first instruction that I wrote on Julia's console was:

[julia-users] Full REPL Pager?

2014-09-05 Thread Rick Graham
I know there has been previous discussion about paging through data in the REPL, but I'd like to know if it is possible to turn on a *full* REPL pager. By full pager, I mean that the REPL is terminal aware and all output is paged. All output would even include such things as the methods

[julia-users] Re: Full REPL Pager?

2014-09-05 Thread Rick Graham
Help messages ⊂ All output On Friday, September 5, 2014 11:00:49 AM UTC-4, Rick Graham wrote: I know there has been previous discussion about paging through data in the REPL, but I'd like to know if it is possible to turn on a *full* REPL pager. By full pager, I mean that the REPL is

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Jake Bolewski
It's jl_eval_string located in jl_api.c in src. so you would do jl_value_t * func2 = jl_eval_string(DSP.hanning) The best way to play around with Julia's c-api is within julia itself. julia pkg_ptr = ccall(:jl_eval_string, Ptr{Void}, (Ptr{Cchar},), Base.Pkg.clone) Ptr{Void} @0x7fd11c1754a0

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Tobias Knopp
Yes, Jakes suggestion looks good. When I wrote the embedding doku I also played around with several internal functions and it turned out that jl_eval_string is very versatile and can be used in various circumstances. Einar: Would be great if you could test it and improve the embedding

Re: [julia-users] Embed julia in C/C++

2014-09-05 Thread Einar Otnes
I'm happy to help out. Einar On Fri, Sep 5, 2014 at 7:23 PM, Tobias Knopp tobias.kn...@googlemail.com wrote: Yes, Jakes suggestion looks good. When I wrote the embedding doku I also played around with several internal functions and it turned out that jl_eval_string is very versatile and

Re: [julia-users] exporting dynamically defined functions

2014-09-05 Thread Ben Arthur
sorry to resurrect this old post, but what is the definitive answer to whether it's possible to @eval export ...sure would be handy. On Monday, December 3, 2012 1:04:27 PM UTC-5, Stefan Karpinski wrote: I'm not sure if this is possible (Jeff will have to answer that), but I would say

Re: [julia-users] exporting dynamically defined functions

2014-09-05 Thread John Myles White
It is definitely possible. You just need to use toplevel, which is a magic that Jeff doesn't want people to know about. -- John On Sep 5, 2014, at 12:52 PM, Ben Arthur bjarthu...@gmail.com wrote: sorry to resurrect this old post, but what is the definitive answer to whether it's possible

Re: [julia-users] exporting dynamically defined functions

2014-09-05 Thread Stefan Karpinski
The @deprecate macro https://github.com/JuliaLang/julia/blob/517f87267468752b28490191d8e1f6b1a6da01c2/base/deprecated.jl#L5-L11 is a good example of how to do this. On Fri, Sep 5, 2014 at 4:06 PM, John Myles White johnmyleswh...@gmail.com wrote: It is definitely possible. You just need to use

[julia-users] Is it possible to manually set current module?

2014-09-05 Thread Andrei
In module.c in Julia sources I see jl_set_current_module() function. Is it somehow exposed to Julia API? To give you some context, in Common Lisp (as well as some other dialects) there are 2 separate macros for dealing with packages (analogue of modules in Julia): defpackage - defines new

[julia-users] Re: Is it possible to manually set current module?

2014-09-05 Thread Andrei
Sorry, last prompt in CL code should be cl-user, not foo. So full code should look like this: ;; initially working from cl-user package cl-user (defpackage foo (:use :common-lisp)) ;; automatically switched to new package foo (defvar x 1) X foo x 1 foo (in-package :cl-user) cl-user x ;;

[julia-users] ANN: revamped Images based on Color, FixedPointNumbers

2014-09-05 Thread Tim Holy
I'm pleased to announce a major overhaul of the Images package. The big change is deeper integration with other packages: Color and FixedPointNumbers. Integrating more closely with Color became possible with Color's recent transition to a parametric representation, so that it became possible to

[julia-users] Re: ANN: revamped Images based on Color, FixedPointNumbers

2014-09-05 Thread Jason Merrill
This looks amazing. Thanks for all the hard work on this package (and thanks also to the other contributors, I know there have been several). It seems like Images now sits on much better foundations than other image processing frameworks I've seen (e.g. matlab, or anything in the python

[julia-users] Re: ANN: revamped Images based on Color, FixedPointNumbers

2014-09-05 Thread Job van der Zwan
On Friday, 5 September 2014 23:07:05 UTC+2, Tim Holy wrote: Compared to other image-processing packages you may have used before, no longer do you have to retain a mental separation between integer-valued images (spanning 0 to 255, for example) and floating point- valued images (spanning

Re: [julia-users] Re: ANN: revamped Images based on Color, FixedPointNumbers

2014-09-05 Thread Tim Holy
Thanks for the kind words. I'll be even happier when we can base images on NamedAxesArrays---then, the most commonly-needed properties of the image will all be available in the type parameters. But indeed I do hope we're moving in the right direction. Best, --Tim On Friday, September 05, 2014

[julia-users] Set of tuples?

2014-09-05 Thread Sam L
I can't figure out how to make a set of tuples in a very clean way. This works: julia push!(Set{(Int, Int)}(), (1,2)) Set{(Int64,Int64)}({(1,2)}) but this doesn't: julia Set((1,2)) Set{Int64}({2,1}) because that calls Set{eltype(itr)}(itr). And this doesn't work: julia Set{(Int,

Re: [julia-users] Set of tuples?

2014-09-05 Thread John Myles White
How do you feel about using Set( [(1, 2)] )? — John On Sep 5, 2014, at 5:01 PM, Sam L sam.len...@gmail.com wrote: I can't figure out how to make a set of tuples in a very clean way. This works: julia push!(Set{(Int, Int)}(), (1,2)) Set{(Int64,Int64)}({(1,2)}) but this doesn't:

Re: [julia-users] Set of tuples?

2014-09-05 Thread Sam Lendle
Oh right, thanks! I forgot that works. I'd just used that like an hour ago for strings. On Fri, Sep 5, 2014 at 5:02 PM, John Myles White johnmyleswh...@gmail.com wrote: How do you feel about using Set( [(1, 2)] )? — John On Sep 5, 2014, at 5:01 PM, Sam L sam.len...@gmail.com wrote: I

[julia-users] Allocation sinking of immutable values in local functions

2014-09-05 Thread Peter Colberg
Hi, Given the following immutable type, immutable Point x::Float64 y::Float64 end the first code sinks allocations of values of that type, f() = Point(2.0, 3.0) let x = Array(Point, 100) @time for i = 1:length(x) x[i] = f() end end ## elapsed time:

Re: [julia-users] Re: ANN: revamped Images based on Color, FixedPointNumbers

2014-09-05 Thread Tim Holy
On Friday, September 05, 2014 03:37:10 PM Job van der Zwan wrote: This sounds like Julia magic that will greatly simplify a *lot* of code. I'm hopeful of that too, and I think there's already some preliminary evidence for that within Images itself. Hopefully more will come as people start to

[julia-users] problem in tuple assignment

2014-09-05 Thread Tatsuya Hirose
Hi all, I am a beginner for Julia. I am using the version 0.3.0. I have a question about tuple assignment. Following is an example: julia =(1, 2, 3, 4) (1,2,0,0) 3 and 4 is displayed 0, 0. But, in version 0.2.0 of Julia, julia z=(1, 2, 3, 4) (1,2,3,4) I guess, the output of version