[julia-users] Re: Macros with multiple expressions - attempting to inject variable as each's first argument

2014-11-21 Thread Tony Fong
https://github.com/one-more-minute/Lazy.jl is your friend. In particular see '@>'. On Saturday, November 22, 2014 9:14:57 AM UTC+7, Tim McNamara wrote: > > I am attempting to write my first macro. Cairo.jl, following its C roots, > requires a context argument to be added at the start of many of

[julia-users] Macros with multiple expressions - attempting to inject variable as each's first argument

2014-11-21 Thread Tim McNamara
I am attempting to write my first macro. Cairo.jl, following its C roots, requires a context argument to be added at the start of many of its drawing functions. This results in lots of typing, which I think could be cleaned up with a macro. Here's a snippet from one of the examples[1]. using C

Re: [julia-users] Saving the results of a loop

2014-11-21 Thread Isaiah Norton
[Please don't cross-post on julia-users and StackOverflow within such a short interval -- most of the same people watch both. You will usually get a fairly quick response on one or the other] On Fri, Nov 21, 2014 at 7:24 PM, Pileas wrote: > Hello all, > > I have been trying to learn Julia for I

[julia-users] Saving the results of a loop

2014-11-21 Thread Steven G. Johnson
Use print, not write. The write function outputs the raw binary representation to the file, while print outputs text.

Re: [julia-users] Broadcasting variables

2014-11-21 Thread Madeleine Udell
My experiments with parallelism also occur in focused blocks; I think that's a sign that it's not yet as user friendly as it could be. Here's a solution to the problem I posed that's simple to use: @parallel + global can be used to broadcast a variable, while @everywhere can be used to do a comput

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Jason Morton
Also check out https://github.com/jasonmorton/Typeclass.jl Available from Pkg, which tries to do this.

[julia-users] Saving the results of a loop

2014-11-21 Thread Pileas
Hello all, I have been trying to learn Julia for I believe that it is a good alternative compared to the others that are in the "market" nowadays. However, since Julia is a new language---and because there is not even one book out there to help the novice---, I start this thread here, although

[julia-users] Re: Oddness in Graphs.jl

2014-11-21 Thread Dahua Lin
This is something related to the vertex indexing mechanism. Please file an issue on Graphs.jl. We may discuss how to solve this over there. Dahua On Saturday, November 22, 2014 6:39:47 AM UTC+8, Richard Futrell wrote: > > Hi all, > > Is this expected behavior? It was surprising to me. On 0.4.0-d

[julia-users] Oddness in Graphs.jl

2014-11-21 Thread Richard Futrell
Hi all, Is this expected behavior? It was surprising to me. On 0.4.0-dev+1745, pulled today, but I had noticed it previously. julia> using Graphs # make a graph and add an edge... julia> g1 = graph([1, 2], Edge{Int}[]) Directed Graph (2 vertices, 0 edges) julia> add_edge!(g1, 1, 2) edge [1]:

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Ben Arthur
there might be a way to fix this, but since i'm in a hurry, i decided to just modify the C++ so as to avoid mangling. thanks for the help.

Re: [julia-users] Segfault when passing large arrays to Julia from C

2014-11-21 Thread David Smith
Thanks for your reply. I think that fixed it, but I don't understand why. I played around with the code and used what I saw in julia.h to figure out that waiting until after the JL_GC_PUSH2 call to assign to the pointers worked. But I don't know why it worked. (Disclaimer: I know almost nothing

Re: [julia-users] Re: Shape preserving Interpolation

2014-11-21 Thread Tomas Lycken
(And I really need to stop writing markdown and forget to trigger the beautification of it...) On Friday, November 21, 2014 10:19:08 PM UTC+1, Tomas Lycken wrote: > > Hi Nils (and others), > > I just completed some work I've had lying around on [Interpolations.jl]( > https://github.com/tlycken/In

Re: [julia-users] Re: Shape preserving Interpolation

2014-11-21 Thread Tomas Lycken
Hi Nils (and others), I just completed some work I've had lying around on [Interpolations.jl](https://github.com/tlycken/Interpolations.jl), a package which is meant to eventually become `Grid.jl`s heir. The stuff I've done so far isn't even merged into master yet (but it hopefully will be qui

Re: [julia-users] Memory mapping composite type + fixed length strings

2014-11-21 Thread Joshua Adelman
Hi Tim, Thanks for pointing out my basic error. I can now get some test files read that don't contain any string components. Josh On Friday, November 21, 2014 3:11:32 PM UTC-5, Tim Holy wrote: > > You'll see why if you type `methods(mmap_array)`: the dims has to be > represented as a tuple.

[julia-users] Re: Contributing to a Julia Package

2014-11-21 Thread Tomas Lycken
Another slightly OT remark, that I believe many might find useful, is that the [github hub project](https://github.com/github/hub) is really worth checking out. It's basically a "super-set" of `git`, intended to be aliased (`alias git=hub` on e.g. ubuntu), and it forwards any regular `git` comm

[julia-users] capture STDOUT and STDERR from Julia REPL (without exiting)

2014-11-21 Thread Max Suster
In an effort to improve VideoIO.jl, we are trying to capture both STDOUT and STDERR output of a call to an external binary from the Julia REPL. I tried a few suggestions based on previous discussions (JuliaLang/julia#3823 , Capture the output of

Re: [julia-users] Memory mapping composite type + fixed length strings

2014-11-21 Thread Tim Holy
You'll see why if you type `methods(mmap_array)`: the dims has to be represented as a tuple. Currently, the only way I know of to create a fixed-sized buffer as an element of a "struct" in julia is via immutables with one field per object. Here's one example: https://github.com/JuliaGPU/CUDArt.

[julia-users] Memory mapping composite type + fixed length strings

2014-11-21 Thread Joshua Adelman
I'm playing around with Julia for the first time in an attempt to see if I can replace a Python + Cython component of a system I'm building. Basically I have a file of bytes representing a numpy structured/recarray (in memory this is an array of structs). This gets memory mapped into a numpy arr

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Sebastian Good
Ah, that I'm not sure of. There is no run-time reflection in Haskell, though I don't doubt that artifacts of frightful intelligence exist to do what you ask. Hoogle is a good place to start for that sort of thing. Though methodswith is of limited use for determine a minimal implementation. For ins

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Mauro
Yep, defining == is needed to implement Eq. But then is there a way to query what functions are constrained by Eq? For instance, give me a list of all functions which Eq provides, i.e. with type: Eq(a) => ... This would be similar to methodswith in Julia, although methodswith returns both the "i

Re: [julia-users] Dict performance with String keys

2014-11-21 Thread Stefan Karpinski
I expect we may be able to swap in a new String representation in a month and let the breakage begin. Any code relies on the internal representation of Strings being specifically Array{Uint8,1} will break, in particular using the mutability thereof will fail. The I/O stuff is going to take a lot mo

[julia-users] Re: iJulia notebooks, in a few clicks ...

2014-11-21 Thread cdm
additional sources for potential list elements: https://github.com/stevengj/Julia-EuroSciPy14 https://github.com/JuliaCon/presentations best, cdm On Friday, November 21, 2014 11:24:51 AM UTC-8, cdm wrote: > > > a respectable start to a "really good Julia notebook" list might include >

[julia-users] Re: iJulia notebooks, in a few clicks ...

2014-11-21 Thread cdm
a respectable start to a "really good Julia notebook" list might include this offering from the Julia 0.3 Release Announcement ... *Topical highlights* “The colors of chemistry ” notebook by Jiahao Chen

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Sebastian Good
I'm not sure I understand the distinction you make. You declare a typeclass by defining the functions needed to qualify for it, as well as default implementations. e.g. class Eq a where (==), (/=):: a -> a -> Bool x /= y= not (x == y) the typeclass 'Eq a' requir

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Mauro
Sebastian, in Haskell, is there a way to get all functions which are constrained by one or several type classes? I.e. which functions are provided by a type-class? (as opposed to which functions need to be implemented to belong to a type-class) On Fri, 2014-11-21 at 16:54, Jiahao Chen wrote: >>

Re: [julia-users] Broadcasting variables

2014-11-21 Thread Tim Holy
My experiments with parallelism tend to occur in focused blocks, and I haven't done it in quite a while. So I doubt I can help much. But in general I suspect you're encountering these problems because much of the IPC goes through thunks, and so a lot of stuff gets reclaimed when execution is don

Re: [julia-users] Segfault when passing large arrays to Julia from C

2014-11-21 Thread Jameson Nash
You are missing a gc root for x when you allocate y. I can't say if that is the only issue, since you seem to be unboxing a jl_array_t* using jl_unbox_voidpointer On Fri, Nov 21, 2014 at 1:51 PM David Smith wrote: > The following code works as posted, but when I increase N to 1000, I > get a

[julia-users] Segfault when passing large arrays to Julia from C

2014-11-21 Thread David Smith
The following code works as posted, but when I increase N to 1000, I get a segfault. I don't see why that would break anything, as the size_t type should be large enough to handle that. Can someone point me in the right direction? Thanks! #include #include int main() { size_t N

[julia-users] Re: iJulia notebooks, in a few clicks ...

2014-11-21 Thread Kyle Kelley
They're shared across users. What's reported by the system isn't accurate, as you get 1/64 of available RAM and CPUs. I'm thinking about how to allow for giving users extra capacity when there aren't many users. https://github.com/jupyter/tmpnb/issues/107 Note: https://github.com/jupyter/docker

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Jeff Waller
Oh yea. I cut-n-pasted the wrong line, well I'll just fix that and *echo __ZL7initGPUP9resamplerPKjS2_j|c++filt**initGPU(resampler*, unsigned int const*, unsigned int const*, unsigned int)* different symbol same comment. but if it has to be this way, hmm FUNC LOCAL DEFAULT ---> that func

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Erik Schnetter
This symbol is an object (maybe a lambda?) that is defined inside another function (init_GPU). However, this isn't what Ben is trying to call. -erik On Fri, Nov 21, 2014 at 10:59 AM, Jeff Waller wrote: > bizarro% echo __ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__01 |c++filt > initGPU(resampler*

Re: [julia-users] [ANN, x-post julia-stats] Mocha.jl Deep Learning Library for Julia

2014-11-21 Thread Chiyuan Zhang
Hi, About testing: it might be interesting to port Caffe's demo into Mocha to see how it works. Currently we already have two: MNIST and CIFAR10. In terms of performance: the Mocha CPU with native extension performs similarly to Caffe on my very rough test. On MNIST, both GPU backend performs

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Jeff Waller
*bizarro% echo __ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__01 |c++filt**initGPU(resampler*, unsigned int const*, unsigned int const*, unsigned int)::__FUNCTION__* I'm not entirely sure what that even means (virtual table?), but you know what? I bet you compiled this with clang because when

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Jiahao Chen
> If instead I want to say "this new type acts like an Integer", there's no canonical place for me to find out what all the functions are I need to implement. The closest thing we have now is methodswith(Integer) and methodswith(Integer, true) (the latter gives also all the methods that Integer in

[julia-users] Re: Mutate C struct represented as Julia immutable

2014-11-21 Thread Steven G. Johnson
On Thursday, November 20, 2014 5:37:22 PM UTC-5, Eric Davies wrote: > > (For context, I'm working on this issue: > https://github.com/JuliaOpt/ECOS.jl/issues/12 and dealing with these > structs: > https://github.com/JuliaOpt/ECOS.jl/blob/master/src/types.jl#L124-L216 ) > > I have a C struct use

[julia-users] Re: PyPlot.plot_date: How do I alter the time format?

2014-11-21 Thread Steven G. Johnson
If you post what you did in Python, we should be able to translate it to Julia.

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Ben Arthur
i should've mentioned i had tried removing the underscore already. didn't work.

[julia-users] Re: Simple Finite Difference Methods

2014-11-21 Thread Steven G. Johnson
I prefer to construct multidimensional Laplacian matrices from the 1d ones via Kronecker products, and the 1d ones from -D'*D where D is a 1d first-derivative matrix, to make the structure (symmetric-definite!) and origin of the matrices clearer. I've posted a notebook showing some examples f

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Erik Schnetter
Ben It could be that you need to leave out the leading underscore in the ccall expression. -erik On Fri, Nov 21, 2014 at 10:13 AM, Ben Arthur wrote: > i'm trying to use readelf and ccall as suggested for a C++ shared library, > and get the following error. any ideas? thanks. > > > $ readelf -sW

Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Ben Arthur
i'm trying to use readelf and ccall as suggested for a C++ shared library, and get the following error. any ideas? thanks. $ readelf -sW /path/to/lib/libengine.so | grep resampler | grep init 101: 3f10 832 FUNC LOCAL DEFAULT 11 _ZL7initGPUP9resamplerPKjS2_j 102: 4dc4

Re: [julia-users] Re: @printf with comma for thousands separator (also ANN: NumFormat.jl)

2014-11-21 Thread Tony Fong
Oh I see it now. https://github.com/dcjones/Showoff.jl It's a cool package! On Friday, November 21, 2014 9:30:24 PM UTC+7, Tony Fong wrote: > > I'm only aware of https://github.com/lindahua/Formatting.jl so I'd > welcome pointers about the other packages, so we can pool efforts and > ideas. >

Re: [julia-users] InPlace function writting into a subarray

2014-11-21 Thread Ján Dolinský
Lovely :)

Re: [julia-users] constructing ArrayViews with indexers that are not representable as a range

2014-11-21 Thread Ján Dolinský
Thanks for this tip. I am OK at the moment on 0.3 with e.g. X[:, 2,7,8,10] or X[:, 2,7,7,10]. It creates a copy but it is good enough at the moment. Thanks, Jan

Re: [julia-users] Typeclass implementation

2014-11-21 Thread Sebastian Good
I will look into Traits.jl -- interesting package. To get traction and some of the great power of comparability, the base library will need to be carefully decomposed into traits, which (as noted in some of the issue conversations on github) takes you straight to the great research Haskell is doin

Re: [julia-users] Typeclass implementation

2014-11-21 Thread John Myles White
This sounds a bit like a mix of two problems: (1) A lack of interfaces: - a) A lack of formal interfaces, which will hopefully be addressed by something like Traits.jl at some point. (https://github.com/JuliaLang/julia/issues/6975) - b) A lack of documentation for informal interfaces, such a

[julia-users] Typeclass implementation

2014-11-21 Thread Sebastian Good
In implementing new kinds of numbers, I've found it difficult to know just how many functions I need to implement for the general library to "just work" on them. Take as an example a byte-swapped, e.g. big-endian, integer. This is handy when doing memory-mapped I/O on a file with data written in

Re: [julia-users] Re: @printf with comma for thousands separator (also ANN: NumFormat.jl)

2014-11-21 Thread Tony Fong
I'm only aware of https://github.com/lindahua/Formatting.jl so I'd welcome pointers about the other packages, so we can pool efforts and ideas. Please note that my package only tries to focus on formatting 1 number at a time. It's easy to concatenate strings in Julia, so I didn't worry about r

Re: [julia-users] constructing ArrayViews with indexers that are not representable as a range

2014-11-21 Thread Tim Holy
As of yesterday you can do this on julia 0.4 (using `sub` or `slice`). I don't know of an alternative way to do it on 0.3. --Tim On Friday, November 21, 2014 01:40:50 AM Ján Dolinský wrote: > Hello, > > I am trying to create an ArrayView with column indexer like [2,7,8,10] or > even a repeating

Re: [julia-users] Re: @printf with comma for thousands separator (also ANN: NumFormat.jl)

2014-11-21 Thread Tim Holy
Looks really nice. There are several packages that have been dipping into the guts of Base.Grisu, this looks like a promising alternative. --Tim On Friday, November 21, 2014 12:48:35 AM Tony Fong wrote: > I just wrote a package that may do what you need in runtime. > > https://github.com/tonyhf

Re: [julia-users] InPlace function writting into a subarray

2014-11-21 Thread Stefan Karpinski
You can just do X[:,3] = 0.1 and the value will be broadcast. > On Nov 21, 2014, at 8:06 AM, Ján Dolinský wrote: > > Thanks. Indeed, and that is why fill!(X[:,3], 0.1) does not update X. It > updates the brand new array which is a copy of 3rd column of X. Intuitively, > however, I would expec

Re: [julia-users] InPlace function writting into a subarray

2014-11-21 Thread Milan Bouchet-Valat
Le vendredi 21 novembre 2014 à 05:06 -0800, Ján Dolinský a écrit : > Thanks. Indeed, and that is why fill!(X[:,3], 0.1) does not update X. > It updates the brand new array which is a copy of 3rd column of X. > Intuitively, however, I would expect fill!(X[:,3], 0.1) to update the > 3rd column of X.

[julia-users] Re: @printf with comma for thousands separator

2014-11-21 Thread Arch Call
Thanks Tony for getting back. I wrote a Julia function that: thousands separates, truncates on specified digits to right of decimal, and pads spaces for vertical alignment. I'll reply to your post this weekend my source code. Maybe you can lift various aspects of my function into your code. B

Re: [julia-users] InPlace function writting into a subarray

2014-11-21 Thread Ján Dolinský
Thanks. Indeed, and that is why fill!(X[:,3], 0.1) does not update X. It updates the brand new array which is a copy of 3rd column of X. Intuitively, however, I would expect fill!(X[:,3], 0.1) to update the 3rd column of X. Thanks for the clarification, Jan

Re: [julia-users] [ANN, x-post julia-stats] Mocha.jl Deep Learning Library for Julia

2014-11-21 Thread René Donner
Hi, as I am just in the process of wrapping caffe, this looks really exiciting! I will definitely try this out in the coming days. Are there any specific areas where you would like testing / feedback for now? Do you have an approximate feeling how the performance compares to caffe? Cheers, Re

Re: [julia-users] InPlace function writting into a subarray

2014-11-21 Thread John Myles White
X[:, 3] doesn't produce a SubArray. It produces a brand new array. -- John On Nov 21, 2014, at 10:30 AM, Ján Dolinský wrote: > Hello, > > I wanted an inplace function to write a result into a subarray as follows: > > X = zeros(10,5) > fill!(X[:,3], 0.1) > > The X[:,3] is however not updated.

[julia-users] InPlace function writting into a subarray

2014-11-21 Thread Ján Dolinský
Hello, I wanted an inplace function to write a result into a subarray as follows: X = zeros(10,5) fill!(X[:,3], 0.1) The X[:,3] is however not updated. X[:,3] = fill(0.1, 10) does the update as expected. Is this a desired behaviour ? --- Alternatively, I can do r = view(X,:,3) fill!(r, 0.1

Re: [julia-users] Create formatted string

2014-11-21 Thread Tony Fong
For formatting just one number into a string (instead of multi-arg sprintf) you can use sprintf1 in https://github.com/tonyhffong/NumFormat.jl. It's somewhat close to standard macro speed. On Friday, April 18, 2014 12:58:08 AM UTC+7, Dominique Orban wrote: > > Here are some timings comparing @p

[julia-users] constructing ArrayViews with indexers that are not representable as a range

2014-11-21 Thread Ján Dolinský
Hello, I am trying to create an ArrayView with column indexer like [2,7,8,10] or even a repeating example like [2,7,7,10]. E.g. X = rand(10,10) view(X, :, [2,7,8,10]) Is this possible at the moment ? The documentation of ArrayViews says that four types of indexers are supported: integer, ran

[julia-users] constructing ArrayViews with indexers that are representable as a range

2014-11-21 Thread Ján Dolinský
Hello, I am trying to create an ArrayView with column indexer like [2,7,8,10] or even a repeating example like [2,7,7,10]. E.g. X = rand(10,10) view(X, :, [2,7,8,10]) Is this possible at the moment ? The documentation of ArrayViews says that four types of indexers are supported: integer, ran

[julia-users] Re: @printf with comma for thousands separator (also ANN: NumFormat.jl)

2014-11-21 Thread Tony Fong
I just wrote a package that may do what you need in runtime. https://github.com/tonyhffong/NumFormat.jl It's not in METADATA yet, since I'm not sure if its implementation is kosher. (There's a trick of generating new generic functions at runtime within the module name space). Speed is decent (