Re: [julia-users] [ANN] Plots.jl, a plotting interface

2015-09-12 Thread Tom Breloff
I just pushed up a lot of improvements/additions to Plots.jl master. Some of the major ones: - Support for bars and histograms - Flexible subplots - Added UnicodePlots.jl as a supported backend - New plotting options, including functions over a range and parametric plots - Impro

Re: [julia-users] I don't understand the behaviour of macros and let.

2015-09-12 Thread Diego Javier Zea
Thank you Jameson!* esc()* does the trick :) El sábado, 12 de septiembre de 2015, 21:56:19 (UTC-3), Jameson escribió: > > You also need to call `esc()` on any symbol you want to "leak" into the > outer scope. Otherwise, it will be turned into a unique symbol name visible > only to the code gener

Re: [julia-users] Returning an ASCIIString decays to Array(Uint8, n)?

2015-09-12 Thread Corey Moncure
One of the challenges in the first set is to break repeating-key XOR cipher (Vigenere cipher). The cleartext is presumed to be ASCII-encoded. One method to break this cipher is to guess the length of the key, and then break the cipher text into blocks of key_length, and then take every Nth byt

[julia-users] Re: higher rank sparse matrices

2015-09-12 Thread Tony Kelman
In JuMP you can do indexing over constraints and variables with any number of indexes. You probably don't need to worry about explicitly forming constraint matrices at all, since the flattened individual indexes of optimization variables and constraints are somewhat arbitrary and will mostly li

Re: [julia-users] I don't understand the behaviour of macros and let.

2015-09-12 Thread Jameson Nash
You also need to call `esc()` on any symbol you want to "leak" into the outer scope. Otherwise, it will be turned into a unique symbol name visible only to the code generated by that macro. On Sat, Sep 12, 2015 at 5:45 PM Diego Javier Zea wrote: > I don't understand why am I getting this error?

Re: [julia-users] AES (Rijndael) block cipher implementation, performance

2015-09-12 Thread Corey Moncure
So, what is the Julia way to achieve what is desired here? Is it possible to exploit lexical scoping to advantage without detriment to performance? I am not necessarily concerned about concurrent access or thread safety. On Saturday, September 12, 2015 at 12:16:24 AM UTC-4, Yichao Yu wrote:

Re: [julia-users] AES (Rijndael) block cipher implementation, performance

2015-09-12 Thread Corey Moncure
Frankly honored and flattered. That is clever to use the result of the == comparator, which yields a 1 or a 0, to avoid an if/else branch. Also, using assignment to a tuple of matrix indices to avoid allocating a temporary vector. The difficulty of mix_columns! is that each calculation depen

[julia-users] Re: I don't understand the behaviour of macros and let.

2015-09-12 Thread Diego Javier Zea
Thanks Simon, I get the correct behavior following your example. But I don't understand why are my macros looking for the variable (pdbml) in my module (MIToS.PDB.pdbml): julia> using MIToS.PDB julia> macro example(var) :(dump($var)) end julia> let code = "1SSX" pdbml = re

[julia-users] Re: I don't understand the behaviour of macros and let.

2015-09-12 Thread Simon Danisch
Well, m is not a global because of the let blog. Because you evaluate that statement, m needs to be in the scope of the macro, which it is only for msg (msg is global). You probably don't want to eval in a macro, and just return an expression instead. That's what macros do, take an expression an

[julia-users] Re: higher rank sparse matrices

2015-09-12 Thread Frank Kampas
On Saturday, September 12, 2015 at 12:09:11 PM UTC-4, Frank Kampas wrote: > > Is it possible to create sparse matrices with a rank other than 2? > I've been using 4th rank sparse matrices in Mathematica for circle packing. The constraints can be expressed using 2nd rank matrices and representin

[julia-users] I don't understand the behaviour of macros and let.

2015-09-12 Thread Diego Javier Zea
I don't understand why am I getting this error? My macros can not find the variables inside *let* blocks. How Can I fix it? Thanks in advance julia> macro example(var) dump(var) @eval dump($var) end julia> msg = "hola" "hola" julia> @example msg Symbol msg ASCIIString "hola

[julia-users] Re: higher rank sparse matrices

2015-09-12 Thread Sisyphuss
Doesn't 'diag([1,1,1])` have a rank of 3? On Saturday, September 12, 2015 at 6:09:11 PM UTC+2, Frank Kampas wrote: > > Is it possible to create sparse matrices with a rank other than 2? >

Re: [julia-users] higher rank sparse matrices

2015-09-12 Thread Stuart Brorson
On Sat, 12 Sep 2015, Frank Kampas wrote: Is it possible to create sparse matrices with a rank other than 2? I'll let the Julia experts answer this question (I suspect the answer is no). However, I'm curious -- what is your use-case? Do you have a problem requiring sparse arrays of dimension

Re: [julia-users] AES (Rijndael) block cipher implementation, performance

2015-09-12 Thread Simon Kornblith
With some tweaks I got a 12x speedup. Original (using Iain's bench with 10 iterations): 0.639475 seconds (4.10 M allocations: 279.236 MB, 1.96% gc time) 0.634781 seconds (4.10 M allocations: 279.236 MB, 1.90% gc time) With 9ab84caa046d687928642a27c30c85336efc876c

[julia-users] libcurl in Plotly

2015-09-12 Thread Paddy Healy
Greetings, I'm new to julia and even newer to plotly. I'm getting a libcurl error when I call Plotly.plot(): julia> response = Plotly.plot([trace1], ["filename" => "basic-line", "fileopt" => "overwrite"]) ERROR: error compiling post: error compiling put_post: error compiling _put_post: error

Re: [julia-users] Returning an ASCIIString decays to Array(Uint8, n)?

2015-09-12 Thread Milan Bouchet-Valat
Le vendredi 04 septembre 2015 à 17:42 -0700, Corey Moncure a écrit : > Extremely new to Julia. My background is in Python and C. > Working on implementing the Matasano crypto challenges in Julia to > learn the ins and outs. The implementations require heavy use of > string conversions, casting,

Re: [julia-users] Returning an ASCIIString decays to Array(Uint8, n)?

2015-09-12 Thread Stefan Karpinski
What encoding is the data in? On Fri, Sep 4, 2015 at 8:42 PM, Corey Moncure wrote: > Extremely new to Julia. My background is in Python and C. > Working on implementing the Matasano crypto challenges in Julia to learn > the ins and outs. The implementations require heavy use of string > conver

Re: [julia-users] Re: IDE for Julia

2015-09-12 Thread Stefan Karpinski
Feel free to step up to the plate and help make any or all of that happen. On Thu, Sep 3, 2015 at 2:11 PM, kike wrote: > I agree with you, Deb > > Hi, firstly thanks,i am new to the topic of the programming and i chose > Julia i would like to say what i think to reflect on this: > > Install the

[julia-users] Error: cp does not accept keyword arguments

2015-09-12 Thread questors
Hello All, I have just tried a clean install of Julia and on adding IJulia got the following: Found jupyter kernelspec version 4.0.0 ... ok. Writing IJulia kernelspec to julia-0.3/kernel.json ... [ ERROR: IJulia ]==

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread David Gold
@ Jameson (and Tim) good points. Thank you both for correcting me on that. On Saturday, September 12, 2015 at 6:55:12 AM UTC-7, Jameson wrote: > > Accessing T.parameters is almost always completely wrong. (except for > TupleType: see https://github.com/JuliaLang/julia/pull/11547 for example) > >

Re: [julia-users] AES (Rijndael) block cipher implementation, performance

2015-09-12 Thread Kristoffer Carlsson
I played around with devectorization and made it allocation free but only got the time down by a factor of 2. Most of the time is spent in gf_mult anyway and I don't know how to optimize that one. If the C library is using a similar function, maybe looking at the generated code to see what is d

Re: [julia-users] AES (Rijndael) block cipher implementation, performance

2015-09-12 Thread Iain Dunning
I think this code is much quicker on 0.4, simply because it leaves UInt8s as UInt8s - way less conversion of types. Adding: function bench() in_ = hex2bytes("00112233445566778899aabbccddeeff") key = hex2bytes("000102030405060708090a0b0c0d0e0f") prm = aes_get_cipher_params(key) keys = gen_

[julia-users] higher rank sparse matrices

2015-09-12 Thread Frank Kampas
Is it possible to create sparse matrices with a rank other than 2?

Re: [julia-users] Re: META: What are the chances of moving this forum?

2015-09-12 Thread Michael Francis
I'd be inclined to agree. Which likely means using a hosted solution, for unlimited that would seem to run about 1k per month.

Re: [julia-users] Re: How to capture the output of a system command?

2015-09-12 Thread J Luis
Thanks, I'll keep an eye on that PR. One other thing that is also missing is the possibility of returning the command status like Matlab does. In my workaround above I force it to be ignored (otherwise it may abort the function execution) but we than have no info of its value. Right, one can do

Re: [julia-users] Re: META: What are the chances of moving this forum?

2015-09-12 Thread Stefan Karpinski
I can't say I'm thrilled about the prospect of a service we have to host ourselves. My experience with that is that it will stop working pretty regularly. Cost is not the issue, maintenance is. > On Sep 12, 2015, at 2:49 AM, andy hayden wrote: > > allegedly you can host multiple sites on the s

Re: [julia-users] Re: How to capture the output of a system command?

2015-09-12 Thread Miguel Bazdresch
See this PR: https://github.com/JuliaLang/julia/pull/12807/files This is a change to `open` that would allow capturing STDERR the way you want. This change won't make it into v0.4, but the code in there could point you towards a solution. I hope to have some time soon to dive into this (I need to

Re: [julia-users] Re: How to capture the output of a system command?

2015-09-12 Thread J Luis
Right, that's indeed what is (very sadly) happening. It turned out that the stderr output is the part that I really need in this case. The only working solution I found was to do run(pipeline(ignorestatus(cmd), stdout=DevNull, stderr="errs.txt")) t = readall("errs.txt"); but it's annoy

Re: [julia-users] Re: How to capture the output of a system command?

2015-09-12 Thread Miguel Bazdresch
What could be happening is that `gm.exe` is printing that message to STDERR, which is not captured by `readall()`. In theory, the new pipeline infrastructure should let you capture STDERR, but I haven't had the time to figure out exactly how. Maybe somebody who knows will chime in. -- mb On Fri,

Re: [julia-users] Any serious quant finance package for Julia?

2015-09-12 Thread Ferenc Szalma
@Tom Breloff Quantlib is useful because it has an industry strength calendar/date library containing all the day count conventions and its calendar is maintained (e.g. when the Queen of England turns 100 holiday comes along, you don't need to enter that in your calendar manually). I don't thin

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Tim Holy
Derp. Yes, forgot the typeof. And then indeed Union{}->Any. (Which of course is still problematic, but much less weird.) --Tim On Saturday, September 12, 2015 09:06:59 AM Yichao Yu wrote: > On Sat, Sep 12, 2015 at 6:48 AM, Tim Holy wrote: > > The problem with this approach: > > > > julia> func

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Jameson Nash
Accessing T.parameters is almost always completely wrong. (except for TupleType: see https://github.com/JuliaLang/julia/pull/11547 for example) For example, I've posted on a similar question previously: https://groups.google.com/d/msg/julia-users/Khe1Eh-K6i0/kxvj3day77AJ And I've written some exa

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Erik Schnetter
I would be using these to generate functions (via @generated), so performance and type stability are not too important. Compare to `fieldtype`; this also returns the type of the respective object field, which is not type stable, in particular if called in a loop. -erik On Sat, Sep 12, 2015 at 6:1

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Yichao Yu
On Sat, Sep 12, 2015 at 6:48 AM, Tim Holy wrote: > The problem with this approach: > > julia> function foo(mt::MyType) >T = mt.parameters[1] should be `typeof(mt)` or sth like that. >a = Array(T, 5) >a[3] = 7 >a >end > foo (generic function

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Mauro
Somewhat academical questions: Would it be possible to generalise firstparam and secondparam to any type and number of parameters? Something like param(SomeType, n) # -> returns nth parameter To generalise to any type, I think something like this would be needed: firstparam{T,A}(::Type{T{A}}

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Jeffrey Sarnoff
very clear, now. -- thanks, Jeffrey On Saturday, September 12, 2015 at 6:48:16 AM UTC-4, Tim Holy wrote: > > The problem with this approach: > > julia> function foo(mt::MyType) >T = mt.parameters[1] >a = Array(T, 5) >a[3] = 7 >a >end >

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Tim Holy
The problem with this approach: julia> function foo(mt::MyType) T = mt.parameters[1] a = Array(T, 5) a[3] = 7 a end foo (generic function with 1 method) julia> @code_warntype foo(MyType{Int,Float64}()) Variables: mt::MyType{Int64,Float64} T::

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Tim Holy
All I mean is that if you write functions that call `firstparam` or `secondparam`, julia will be able to infer the return type. That means that in function foo(mt::MyType) T = firstparam(typeof(mt)) a = Array(T,20) # now do something with a end julia will generate efficient code in m

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Mauro
> Yes, I guess this would work. I'm not keen on the function names proposed > there, as the same ones are used in Base to access fields of objects, but > an interface similar to `nfields`, `getfield`, `fieldtype` where `field` > has been replace by `param` would work. That would be good feedback f

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Jeffrey Sarnoff
pls show me a quick example of using that inferrably On Saturday, September 12, 2015 at 6:12:21 AM UTC-4, Tim Holy wrote: > > A much better way (because it's inferrable): > > firstparam{A,B}(::Type{MyType{A,B}}) = A > secondparam{A,B}(::Type{MyType{A,B}}) = B > > --Tim > > On Friday, September

Re: [julia-users] Re: Getting type parameters from a parameterized types?

2015-09-12 Thread Tim Holy
A much better way (because it's inferrable): firstparam{A,B}(::Type{MyType{A,B}}) = A secondparam{A,B}(::Type{MyType{A,B}}) = B --Tim On Friday, September 11, 2015 06:40:59 PM Jeffrey Sarnoff wrote: > julia> type MyType{A,B} end > > julia> ((MyType.parameters)...) > (A,B) > > On Friday, Septem

Re: [julia-users] Find sequence in array?

2015-09-12 Thread cormullion
Hi Milan - thanks for the clues! I found `Base._searchindex`, which work for integers: julia> a = rand(1:10, 100); julia> Base._searchindex(a, [19272, 52257], 1) 86 It's pretty quick, too.

Re: [julia-users] Find sequence in array?

2015-09-12 Thread Milan Bouchet-Valat
Le vendredi 11 septembre 2015 à 16:03 -0700, cormull...@mac.com a écrit : > Is there a Julia function/method to find the location(s) of a > sequence of elements in a 1-D array? > > With strings, you can do: > > search("longstring", "str") > > 5:7 > > so with arrays it would hopefully b