[julia-users] logical indexing... broadcasting

2014-05-14 Thread Héctor Fabio Satizábal Mejía
Hello I am trying to conduct some tests on machine learning algorithms with Julia but given that I am new to the language I am kind of stuck in a very simple thing. I am working with the Iris dataset, and I want to translate the species name into a code like this: "setosa" = [1 0 2] "versicol

[julia-users] confused by namespace resolution

2014-05-14 Thread David Gonzales
When converting my script into a Module, some problems cropped up accessing the isna(...) function from DataArrays. I managed to reduce the problem into a namespace resolution problem: When using a Module inside a Module definition, the recursivity of name search is not working. In the example b

[julia-users] Re: tree style

2014-05-14 Thread Abe Schneider
Just in terms of implementing trees, I would do something like: abstract Node; type Leaf <: Node value::Float64; end type Branch <: Node left::Node; right::Node; end This should allow you to write methods that target either branch or leafs accordingly: function sum(node::Branc

[julia-users] Re: confused by namespace resolution

2014-05-14 Thread David Gonzales
the dump from the REPL was a bit buggy, here is a fixup: julia> TestUsing.testisna1() ERROR: isna not defined in testisna1 at TestUsing.jl:6 julia> TestUsing.testisna2() ERROR: DataArrays not defined in testisna2 at TestUsing.jl:10 julia> TestUsing.testisna3() false On Wednesday, May 14,

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Samuel Colvin
Thanks a lot. I can see that this is what I should be using but can't find any documentation on how to call bytestring with a "Union(Ptr{Int8},Ptr{Uint8})" as the first argument, The code shows that implementation but there isn't even a sniff of an explanation about how to use it. I can't even

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Samuel Colvin
Ok again I've worked it after asking the question, sorry. Answer is: function print_key(key_::Ptr{Uint8}, key_length_::Ptr{Int8}) key_length = unsafe_load(key_length_) key = bytestring(key_, key_length*4) println("jlkey: ", key) return nothing end const print_key_c = cfunction(pri

[julia-users] Re: JuliaCon Question Thread

2014-05-14 Thread Luis Benet
Hi, can you post some information/recommendation about nearby hotels or other accommodation possibilities? Thanks, Luis

[julia-users] Re: JuliaCon Question Thread

2014-05-14 Thread James Porter
Hey all— As far as Patrick's question goes— It is true that a lot of the talks at the conference are going to be about fairly advanced topics (Julia internals, a prototype Julia typechecker, etc.). That said there will also be a number of talks that deal with using Julia to solve some sort of tec

Re: [julia-users] Trouble with Type Parameters

2014-05-14 Thread Toivo Henningsson
Yes, I think that you are right. What bothers me is that it silently uses :: in a different sense than anywhere else in the language, and that I didn't realize this after reading through the manual.

Re: [julia-users] Re: confused by namespace resolution

2014-05-14 Thread Isaiah Norton
One option is to explicitly import the DataArrays package. This should probably be filed as a bug against the Reexport.jl package used by DataFrames: https://github.com/simonster/Reexport.jl/issues On Wed, May 14, 2014 at 8:23 AM, David Gonzales wrote: > the dump from the REPL was a bit buggy, h

Re: [julia-users] Re: confused by namespace resolution

2014-05-14 Thread David Gonzales
updating DataFrames v0.5.3 -> 0.5.4 added reexport which should probably do the trick. nice to know I am walking on the road more traveled by.

[julia-users] Re: Fast, robust predicates with Julia

2014-05-14 Thread Toivo Henningsson
Very cool! I also dream of having a good Voronoi code in Julia. What I'm after in particular is dynamic construction (insertion and removal) of power diagrams(a generalization of Voronoi diagrams with weights on the generators). To that end, I starte

Re: [julia-users] Shared read-only memory?

2014-05-14 Thread Bob Quazar
Hi Tim, I liked your VectorLite idea---just collapse my ragged 2D array into a 1D SharedArray, and use additional 1D SharedArrays for offsets and lengths. Unfortunately, on the system where I need to deploy the code (a 32 core AMD server, 256 GB RAM), the amount of shared memory (/proc/sys/kern

[julia-users] Re: ODBC query: arrayset not defined

2014-05-14 Thread Jacob Quinn
Andrew, Sorry for not responding sooner (vacation tends to make you miss things!). I actually dug into this a little this afternoon and I think it should be fixed now (and the version bumped in METADATA). So if you run the following command, you should see the updates: Pkg.add("ODBC") Pkg.upda

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Steven G. Johnson
On Wednesday, May 14, 2014 9:06:52 AM UTC-4, Samuel Colvin wrote: > > The *4* is requied because the original string was Cwchar_t so 4 times > the size. I'm not sure of the legitimacy of changing the pointer type from > Ptr{Cwchar_t} to Ptr{Uint8} ??? but it seems to work > Probably a bad idea

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Samuel Colvin
Humm, turns out there's still a problem, using print was covering up some problems. function get_key(key_::Ptr{Uint8}, key_length_::Ptr{Cint}) key_length = unsafe_load(key_length_) key = bytestring(key_, key_length*4) show(key) println() return key end Gives an output of "T

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Samuel Colvin
Ok, the "UTF32String(pointer_to_array(key, key_length, false))" method didn't work because the pointer was still Uint8, but when i changed it to be Int32 it worked. So in summary i ended up with function get_key(key_::Ptr{Int32}, key_length_::Ptr{Cint}) key_length = unsafe_load(key_length_)

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Steven G. Johnson
On Wednesday, May 14, 2014 7:57:49 PM UTC-4, Samuel Colvin wrote: > function get_key(key_::Ptr{Int32}, key_length_::Ptr{Cint}) > key_length = unsafe_load(key_length_) > UTF32String(pointer_to_array(key_, int64(key_length), false)) > end > Change it to Ptr{Char} (Char is 4 bytes) instead

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Samuel Colvin
Ok now I'm really confused an I can see why a using Char pointers should work, but when i make that change the the julia object being editted (and passed back and forth between julia and c) get s messed up: all the strings are random characters. I have no idea why. The code is a (possible) beg

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Steven G. Johnson
On Wednesday, May 14, 2014 8:05:20 PM UTC-4, Steven G. Johnson wrote: > > > > On Wednesday, May 14, 2014 7:57:49 PM UTC-4, Samuel Colvin wrote: > >> function get_key(key_::Ptr{Int32}, key_length_::Ptr{Cint}) >> key_length = unsafe_load(key_length_) >> UTF32String(pointer_to_array(key_, in

Re: [julia-users] Re: get string from Cwchar_t in cfunction

2014-05-14 Thread Steven G. Johnson
On Wednesday, May 14, 2014 8:26:11 PM UTC-4, Samuel Colvin wrote: > > Ok now I'm really confused an I can see why a using Char pointers should > work, but when i make that change the the julia object being editted (and > passed back and forth between julia and c) get s messed up: all the strings

[julia-users] Re: performance of multiple julia sessions degrade

2014-05-14 Thread Steven G. Johnson
If you are using linear algebra routines (BLAS and LAPACK) then your Julia sessions may in fact be using multiple CPUs each, because OpenBLAS is multithreaded and defaults to using all available processors IIRC. This would explain the slowdown. Otherwise there could be some other contention f

[julia-users] Problem with BinDeps on OSX

2014-05-14 Thread João Felipe Santos
Hi, I have a build.jl file that worked correctly on Linux but I am having trouble to get it to work on OSX. These are the three ways I tested it: 1. If my build process puts a .dylib instead of an .so at deps/usr/lib, BinDeps complains that the .so does not exist and the build process fails. 2.

Re: [julia-users] A "Big Data" stress test

2014-05-14 Thread David
I'm glad you found this useful. We continue to host data from many of the older competitions so you might enjoy those as well. David On Apr 30, 2014 9:30 AM, "Douglas Bates" wrote: > It is sometimes difficult to obtain realistic "Big" data sets. A > Revolution Analytics blog post yesterday >

[julia-users] Re: logical indexing... broadcasting

2014-05-14 Thread Gunnar Farnebäck
If nothing else works you can solve it with a manual repmat. A different approach is to forgo the logical indexing entirely. species_codes = ["setosa" => [1 0 2], "versicolor" => [2 1 0], "virginica" => [0 2 1]] N = length(iris_data.columns[5]) iris_output = zer