[julia-users] Using generators

2016-10-02 Thread harven
) at strings/string.jl:209 reverse(!Matched::LegacyStrings.ASCIIString) at /home/harven/.julia/v0.5/LegacyStrings/src/ascii.jl:90

[julia-users] Re: Using generators

2016-10-03 Thread harven
Thanks for the answers, the examples are enlightening. I thought at first that a generator could be used whenever an array was expected, I get it now.

[julia-users] linear algebra question

2016-10-05 Thread harven
Is there a way to check if a vector v is in the linear span of a given family of vectors v1,...vn? I don't think I saw such a function in the base library but I may have missed it. I can use something like rank([v;v1...vn]) == rank([v1...vn]) but that looks inefficient. Also is there any f

[julia-users] Re: Julia 0.5 Highlights

2016-10-12 Thread harven
Le mercredi 12 octobre 2016 01:45:25 UTC+2, Jared Crean a écrit : > > Very nice summary, thanks for posting. One question I had was what should > the signature of a function be to receive a generator? For example, if the > only method of extrema is extrema(A::AbstractArray), is that too > re

[julia-users] problem with bigfloat precision

2015-05-14 Thread harven
There is something I don't understand with bigfloat precision. I have some task where I need to compute exactly with a thousand significant digit. I wrote a small benchmark, just by taking a power of two and its logarithm. julia> with_bigfloat_precision(10_000) do l

Re: [julia-users] problem with bigfloat precision

2015-05-14 Thread harven
Thanks for the answer. I understand now. So log(2,x) is log(x)/log(2) and the denominator is a Float64 so we don't get the desired precision. So I can just write julia> with_bigfloat_precision(10_000) do log(big(2)^10_000)/log(big(2)) end 1e+04 with 1000

Re: [julia-users] problem with bigfloat precision

2015-05-15 Thread harven
Le jeudi 14 mai 2015 22:31:03 UTC+2, Steven G. Johnson a écrit : > > > > On Thursday, May 14, 2015 at 3:46:25 PM UTC-4, Stefan Karpinski wrote: >> >> On Thu, May 14, 2015 at 3:43 PM, Steven G. Johnson >> wrote: >> >>> I think the right thing would be for log(b,x) to first promote its >>> argum

[julia-users] performance problem with factor

2015-05-23 Thread harven
The factor function seems to be slow. julia> @time factor(147573952589676412927) # 2^67-1; Cole elapsed time: 4.955545116 seconds (6 MB allocated, 6.82% gc time in 1 pauses with 0 full sweep) Dict{Int128,Int64} with 2 entries: 761838257287 => 1 193707721

[julia-users] problem with quadgk

2015-07-17 Thread harven
Hi, I just tried to integrate the gaussian using the builtin quadgk but got a stackoverflow. julia> quadgk(t->exp(-t^2/2), 0,inf) ERROR: StackOverflowError: in typejoin at ./promotion.jl in quadgk at quadgk.jl:169 in quadgk at quadgk.jl:174 (repeats 12364 times)

Re: [julia-users] problem with quadgk [solved]

2015-07-17 Thread harven
> > Does this help? > > julia> quadgk(t->exp(-t^2/2), 0, Inf) > (1.2533141373155001,1.422966106459907e-8) > > julia> quadgk(t->exp(-t^2/2), 0, inf) > ERROR: StackOverflowError: > in quadgk at ./quadgk.jl:171 > in quadgk at ./quadgk.jl:176 (repeats 10690 times) > > julia> inf > inf (generi

[julia-users] create a similar array with different dimension

2015-08-26 Thread harven
Hi, I have an array and I want to create a similar array with same element type but different dimensions (say, 2x2). julia > similar(M, ?, (2,2)) Is there a way to skip the second optional argument, which should be infered from M, and just provide the third? I have a similar question with

[julia-users] Re: create a similar array with different dimension

2015-08-26 Thread harven
Le mercredi 26 août 2015 16:02:37 UTC+2, Sisyphuss a écrit : > > Try just `similar(M,(2,2))`. > > Thanks, that works.

[julia-users] recent deprecations

2015-08-27 Thread harven
Hi, it seems that there are a few useful methods/functions that have been deprecated lately. I just stumble upon the following warning. WARNING: int(z::Complex) is deprecated, use Complex((Int64)(real(z)),(Int64)(imag(z))) instead. The new syntax does not look very friendly. So I have som

[julia-users] Re: Upcoming switch to Colors package (breaking change)

2015-08-27 Thread harven
sed -i -E 's/\b([a-zA-Z0-9_\.]+)\.c\b/color(\1)/g' $fls > > # These are not essential, but they generalize to RGB24 better > # However, they are too error-prone to use by default since other color > # types like Lab have fields with the same names > #sed -i -E 's/\b([a-zA-Z0-9_\.]+)\.r\b/red(

[julia-users] install failed

2014-06-20 Thread harven
I just tried to install julia on a linux debian laptop by cloning the git repository and running make but the install ended with -- [...] make[4]: warning: -jN forced in submake: disabling jobserver mode. OK. OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE) OS ...

Re: [julia-users] install failed

2014-06-20 Thread harven
Le vendredi 20 juin 2014 21:30:56 UTC+2, Elliot Saba a écrit : > > Can you run `make` again? Sometimes, due to parallel makefile rules, the > cause of an error can be hard to see. Please post the output of `make` > again, which should fail immediately and give us an idea as to why it > didn'

[julia-users] Re: 100 Julia exercises

2014-06-22 Thread harven
I just had a quick look. Here are some ideas for a few exercices. You can use list comprehension in some exercices e.g. Checkerboard pattern Float64[(i+j)%2 for i=1:8, j=1:8] 10x10 matrix with row values ranging from 0 to 9 Float64[j for i=0:9, j=0:9 ] It seems that what is called a

[julia-users] planned array changes

2015-09-17 Thread harven
I see that there are many changes scheduled for arrays in the next release. Can someone summarize what is planned? I understand that [,] will become non concatenating. What will be the type of expressions such as ["julia", [1, 1.0]] Any, union{AbstractString, Array{Float64}}? Will the

[julia-users] Re: Request for comments: best way to deal with type uncertainty.

2015-09-25 Thread harven
Le vendredi 25 septembre 2015 02:41:32 UTC+2, Ben Ward a écrit : > > As an update: We have tested fetching annotations without trying to > enforce type, and then another in which we don't. I don't understand why, > but the one in which we don't enforce type, is faster, it is also puzzling > fo

[julia-users] Re: help!

2015-09-25 Thread harven
You can also use julia> @doc sin sin(x) Compute sine of x, where x is in radians

[julia-users] functions on iterable types

2015-10-25 Thread harven
An iterable type is obtained by defining start, next and end methods for such a type. Is there a way to obtain the list of all functions that work on iterable types? I can see that there are some functions listed under the Iteration section but it does not seem to be the full story. For example

Re: [julia-users] functions on iterable types

2015-10-25 Thread harven
Thanks for your answer. Still, there could be an Iterable abstract type and then functions could dispatch on it. Actually there are 34 functions in Base with an argument called `itr`. These are good candidates to dispatch on such a type. A bit like the Enumerate type. Nothing fancy, just a tag

Re: [julia-users] functions on iterable types

2015-10-25 Thread harven
> > I can see that there are some functions listed under the Iteration > section > > but it does not seem to be the full story. > > For example mapreduce works on iterable types (nice) but it seems that > the > > length function is not defined on iterables. Why is it so? > > Iterables can b

Re: [julia-users] functions on iterable types

2015-10-26 Thread harven
Le lundi 26 octobre 2015 07:15:56 UTC+1, DNF a écrit : > > Hmm. Trying to answer myself: I guess my suggested solution would miss > functions that don't specify the type, but just rely on the iterable > behaviour. > > It is easy to get the list of thunks that work on iterables. type Itera

Re: [julia-users] functions on iterable types

2015-10-26 Thread harven
Le lundi 26 octobre 2015 12:52:04 UTC+1, DNF a écrit : > > I must admit I don't understand very well what snippet is supposed to do. > But, for example, it doesn't work for :sum or :maximum or anything like > that. > > A thunk is a function that takes a single argument. Cheers,

Re: [julia-users] functions on iterable types

2015-10-26 Thread harven
Le lundi 26 octobre 2015 12:52:04 UTC+1, DNF a écrit : > > I must admit I don't understand very well what snippet is supposed to do. > But, for example, it doesn't work for :sum or :maximum or anything like > that. > > This comes from the fact that sum and maximum don't work on empty arrays. W

[julia-users] julia upgrade to 0.3.2

2014-10-26 Thread harven
Hi, I am currently using julia v0.3.1-pre+4 under a debian gnu/linux system and would like to upgrade to the latest stable version 0.3.2. Should I recompile from source or is there a faster way? I used to do `git pull origin` but I guess that would retrieve the 0.4 version of julia. Thanks for

Re: [julia-users] julia upgrade to 0.3.2

2014-10-26 Thread harven
Thanks for your response. That worked.

[julia-users] Re: idiom for WITH-OUTPUT-TO-STRING

2014-11-11 Thread harven
julia version 0.3.3 julia> rdstdout, wrstdout = redirect_stdout() (Pipe(open, 0 bytes waiting),Pipe(open, 0 bytes waiting)) julia> print("hello") julia> s = readavailable(rdstdout) "hello" Using a IOBuffer() is more idiomatic though. Look at the source of the filter functi

[julia-users] state of Winston

2016-04-07 Thread harven
Hi, I recently upgraded to the last stable version of julia (4.5). I noticed that Winston is not advertised on julialang anymore, and the development seems to have stalled on github. Is it still maintained? If not, what should I use instead? I mainly use it for 2d graphs and animations. Thanks

[julia-users] Re: emacs ess julia trouble

2016-04-07 Thread harven
Le vendredi 1 août 2014 20:32:01 UTC+2, Sarvagnan a écrit : > > I'd like to pose a question on the ess config itself. I haven't been able > to find a satisfactory explanation anywhere. What directory do you need to > provide in the seta inferior-julia-program-name field? When starting julia >

Re: [julia-users] state of Winston

2016-04-08 Thread harven
Le jeudi 7 avril 2016 21:37:47 UTC+2, Mauro a écrit : > > https://github.com/tbreloff/Plots.jl wraps many of the plotting packages > and thus allows to use all of them with a single syntax. Maybe you > should give that a spin? > > I will have a look. Thanks.

[julia-users] Re: reduce() behavior question

2014-02-15 Thread harven
As a workaround, you can use mapreduce. julia> mapreduce(int, (x,y)-> x*y, 1, ["1","2","3"]) 6

[julia-users] Re: reduce() behavior question

2014-02-15 Thread harven
Le lundi 10 février 2014 23:22:47 UTC+1, Ivar Nesje a écrit : > > Currently it is much faster to write a explicit loop, than to use theese > functions. In the 0.3-prerelease version we have a new function foldl and > foldr to do what you want. See the latest docs > http://docs.julialang.org/en

[julia-users] Re: reduce() behavior question

2014-02-15 Thread harven
Le samedi 15 février 2014 11:30:12 UTC+1, Tim Holy a écrit : > > You're running into the classic globals problem, see the performance tips > section of the manual. > > I am sorry, I don't understand your remark. There are no global variables in the code I posted previously. Also, wrapping the c

[julia-users] update problem

2014-02-16 Thread harven
of Elliptic... INFO: Updating cache of Color... INFO: Updating cache of JSON... INFO: Updating cache of ImageView... INFO: Updating cache of BinDeps... INFO: Updating cache of DataFrames... ERROR: failed process: Process(`git --git-dir=/home/harven/.julia/.cache/Stats merge-b

[julia-users] Outlines of bars in histograms with Winston, Gadfly

2014-02-16 Thread harven
Hi, is there a way to draw the outlines of the bars when plotting an histogram e.g. http://www.mathsisfun.com/data/images/histogram.gif as opposed to http://d1qchgnwtps1zh.cloudfront.net/winston/520f8076fed8057daf05b8b2e991bca9c7d10efe.png I am asking both for Winston and Gadfly. Cheers.

Re: [julia-users] update problem

2014-02-16 Thread harven
v0.2.10 INFO: Upgrading Tk: v0.2.5 => v0.2.11 INFO: Upgrading URIParser: v0.0.0- => v0.0.1 INFO: Installing Units v0.2.4 INFO: Upgrading Winston: v0.4.0 => v0.9.0 INFO: Installing Zlib v0.1.3 INFO: Removing Grid v0.2.5 INFO: Building Cairo ====[ ERROR: Cairo ]=

Re: [julia-users] update problem

2014-02-17 Thread harven
The issue is solved, a fresh reinstall built Cairo and Tk without problem. Thanks.

[julia-users] Re: Julia as a General Purpose Language

2014-02-18 Thread harven
Le lundi 17 février 2014 19:22:38 UTC+1, Dave Bettin a écrit : > > Julia is promoted as a technical computing language. However, there is > this beautiful general purpose language waiting to be unleashed onto the > masses. > > Why is this aspect of the language not communicated/marketed more?

[julia-users] Re: DataFrames missing functions?

2014-02-18 Thread harven
Le mardi 18 février 2014 10:07:55 UTC+1, Samuel S. Watson a écrit : > > I'm running Julia on OS X Mavericks 10.9.1, and my DataFrames package > (version 0.4.2) seems to be missing several basic functions, including > dropna and array, which are mentioned in the DataFrames documentation. When >

[julia-users] Re: DataFrames missing functions?

2014-02-18 Thread harven
I have filled an issue.

[julia-users] Re: DataFrames missing functions?

2014-02-18 Thread harven
Thanks, problem solved! Le mardi 18 février 2014 22:04:22 UTC+1, Ivar Nesje a écrit : > > Crosslinking: https://github.com/JuliaStats/DataFrames.jl/issues/546 > > Also answer from @simonster > > dropna only exists in the latest versions of DataFrames/DataArrays, whic

[julia-users] animated plot

2014-02-24 Thread harven
Is there a way to produce an animated plot with julia? I am thinking of simple animations, like the one produced by CAS softwares (maple/mathematica/sage etc) e.g. http://www.maplesoft.com/support/help/helpview.aspx?si=2057/file01057/plot309.gif

[julia-users] Re: animated plot

2014-02-24 Thread harven
Thanks for the answer, pyplot looks great and seems to be the easiest way to animate a plot. I tried with Winston and I just managed to do a simple animation as follows: using Winston frame(f, u; pts = 1000, kw...) = Curve([real(f(t,u)) for t in 0:1/pts:1],[imag(f(t,u)) for t in

[julia-users] operations on distributions

2014-02-25 Thread harven
Given two independent random variables X and Y following two distributions, is there a way to compute the distribution of X+Y, X*Y, F(X) where F is some real function, or the distribution of the pair (X,Y)? The Distributions package is nice but I didn't find a way to build distributions startin

[julia-users] Re: operations on distributions

2014-02-25 Thread harven
Thanks a lot for the answers. At the moment, I am trying some hack with the conv function when the distributions are discrete. The continuous case is definitely more difficult.

[julia-users] Re: Help in Winston FramedPlot()

2014-03-04 Thread harven
julia> large = [i^4 + 1e12 for i in 1:10^3] ; small = [1:10^3] ; plot(small,large) or julia> large = [i^4 + 1e12 for i in 1:10^3] ; small = [1:10^3] ; p = FramedPlot() ; plot(p,small,large)

[julia-users] clesing a file descriptor

2014-03-09 Thread harven
Hi, I saw the following code in a blog recently. const mydata = "/home/something.csv" |> open |> readall |> s -> split(s, "\n") |> a -> map(l -> split(l, ","), a) It seems that there is a file descriptor left open here, Am I right? Is there some way to c

[julia-users] intersecting sets is slow

2014-03-09 Thread harven
Intersecting two sets seems to be very slow. As a test case, I take a wordlist and find the words whose reversals are again in the list (e.g. "desserts" and "stressed"). julia> dict = Set{UTF8String}(map!(chomp, open(readlines, "wordlist"))) ; length(dict) 651357 julia> @time result = intersec

[julia-users] Re: intersecting sets is slow

2014-03-10 Thread harven
Le lundi 10 mars 2014 02:07:40 UTC+1, andrew cooke a écrit : > > > ok, i think your problem is that map(reverse, dict) is returning an array. > > if you make that a Set{UTF8String} then everything is fast. > > cheers, > andrew > Indeed, that's it. Thanks! julia> @time result = sort([intersect(

[julia-users] preserve column type when building a matrix

2014-04-01 Thread harven
When I build a matrix from columns using vcat, the type of the columns is sometimes modified, e.g. julia> [[1:3] float([1:3])] 3x2 Array{Float64,2}: 1.0 1.0 2.0 2.0 3.0 3.0 Here the first column of integers has been converted to float. How can I prevent this conversion so as to obtain 3x2

[julia-users] Re: preserve column type when building a matrix

2014-04-01 Thread harven
Thanks!

[julia-users] Re: preserve column type when building a matrix

2014-04-01 Thread harven
@ Gunnar Farnebäck Nifty! I didn't know one can create zero-width arrays.

[julia-users] Re: Iterating over all possible subsets

2014-04-01 Thread harven
I use the following to get the (untyped) powerset of an array: function powerset (x) result = {{}} for i in x, j = 1:length(result) push!(result, [result[j],i]) end result end julia> show(powerset(1:3)) {{},{1},{2},{1,2},{3},{1,3},{2,3},{1,2,3}} Then sdifsums can be written as sdifs

[julia-users] Re: Iterating over all possible subsets

2014-04-01 Thread harven
Also if k is known in advance, you could precompute the signs and map to the sample. # clumsy computation of all vectors of length k with 1/-1 as entries using powerset. signs(k) = [[(-1)^(i in s) for i = 1:k] for s=powerset(1:k)] # now return a closure sdifsums(k) = let s=signs(k) ; a->map(x-

[julia-users] questions about latest documentation

2014-04-08 Thread harven
The documentation is a bit different for the 'latest' version of julia, as compared to version 0.2. I have a few questions/remarks about it. In the main page of the latest version, I don't see the entry "available packages". Or did I miss something? I can

[julia-users] complement to findin

2014-04-10 Thread harven
findin(*a*, *b*) returns the indices of elements in collection a that appear in collection b.Is there a "notfindin" function that returns the indices of elements in collection a that do not appear in collection b? If not, what do you think of the idea of adding a keyword argument to switch to

[julia-users] Re: complement to findin

2014-04-10 Thread harven
Le jeudi 10 avril 2014 17:19:12 UTC+2, Tony Kelman a écrit : > > help> setdiff > > well, findin returns the positions of the elements, not the elements themselves. This is quite different. julia> findin("honolulu","ou")' 1x4 Array{Int64,2}: 2 4 6 8 julia> intersect("honolulu","ou")' 1x4 A

Re: [julia-users] Re: complement to findin

2014-04-10 Thread harven
Le jeudi 10 avril 2014 19:45:04 UTC+2, Jacob Quinn a écrit : > > You *could* use setdiff, it depends on what you're working with (e.g. a > range of integers) > I am working with general collections. but then I can define findnot(a,b) = setdiff(1:length(a), findin(a,b)) which seems to work as I

[julia-users] wierd behavior of booleans and colon.

2014-04-15 Thread harven
Hi, I don't understand how true and false behave in conjonction to the colon. I would have expected false:true to give a range of two values, false and true, but the behavior of the range is actually quite weird, see below. julia> {i*j for i in false:true, j in false:true} 2x2 Array{Any,2}: fal

Re: [julia-users] wierd behavior of booleans and colon.

2014-04-15 Thread harven
Le mardi 15 avril 2014 16:48:24 UTC+2, Stefan Karpinski a écrit : > > There were a lot of > problemswith ranges that were > fixed since that build. This all works find in a > current build. Can you try upgrading? > > I have just upgraded and no

[julia-users] problem with map after upgrade

2014-04-15 Thread harven
Hi, I updated to the latest version of julia yesterday and now I encounter a problem with map. I have an utf8 file that contains two lines, with a word made of ascii chars on the first line and with some utf8 chars on the second line. I read the file using readlines and try to reverse the stri

[julia-users] Re: open a file and writing lines to it

2014-04-15 Thread harven
Le mercredi 16 avril 2014 05:49:44 UTC+2, gdeloscampos a écrit : > > Hello, I am wondering if anyone can point me to documentation about > opening, reading and writing to connections? > IO = open("temp", "a") # a stands for append write(IO, "string1\n") write(IO, "string2\n") close(IO

[julia-users] Re: open a file and writing lines to it

2014-04-16 Thread harven
Le mercredi 16 avril 2014 08:49:53 UTC+2, harven a écrit : > > > > Le mercredi 16 avril 2014 05:49:44 UTC+2, gdeloscampos a écrit : >> >> Hello, I am wondering if anyone can point me to documentation about >> opening, reading and writing to connections? >>

[julia-users] Re: problem with map after upgrade

2014-04-16 Thread harven
Le mercredi 16 avril 2014 00:09:14 UTC+2, Matt Bauman a écrit : > > > In Julia 0.2, readlines returned an Array with Any elements. In recent > versions, that's been sharpened to an Array with ASCII- and UTF8Strings. > Thanks for the answer. So apparently utf16 is not supported anymore? >From

Re: [julia-users] What is the "find" command in Julia?

2014-04-16 Thread harven
Le mercredi 16 avril 2014 11:08:31 UTC+2, RecentConvert a écrit : > > Is there a faster way of doing this? > > Dstr2 = Array(Float64,length(Dstc["time"])-1,2) # Preallocate averaged > Dstr array > for i=1:1:length(Dstc["time"]) - 1 >f = find(Dstc["time"][i] .<= Dstr["time"] .< Dstc["time"][i+

[julia-users] Re: Performance expectations and benchmarks

2014-04-17 Thread harven
Le jeudi 17 avril 2014 03:24:54 UTC+2, Gilberto Noronha a écrit : > > Hi all, > > I was looking at some benchmark results (mainly the ones on julialang.org) > and I could not resist the thought that they are a bit misleading. I say > this as a Julia fan (I wish I did not think this way!) > I

Re: [julia-users] Re: Performance expectations and benchmarks

2014-04-17 Thread harven
Le jeudi 17 avril 2014 23:28:52 UTC+2, Stefan Karpinski a écrit : > > ... and you can write slow code in any language. > Sure. I am just pointing out that microbenchmarks are not always easy to interpret. On a different subject, It would be nice to be able to pass big(1):big(10) to prod in o

[julia-users] Re: Some Syntactic Sugar for end Keyword

2014-05-09 Thread harven
There are some alternative constructs that reduce the `end` noise, e.g. for word in english_dictionary, url in url_list search(line, word) != (0:-1) && (term_freq[word]=get(term_freq,word,0)+1) end other examples: begin expression1 expression2 end is equ

[julia-users] Re: OT: entering Unicode characters

2014-05-22 Thread harven
Le jeudi 22 mai 2014 19:27:41 UTC+2, Steven G. Johnson a écrit : > > A quick update for people who haven't been tracking git closely: > > The Julia REPL (#6911), IJulia, and (soon) Emacs julia-mode (#6920) now > allows you to type many mathematical Unicode characters simply by typing > the LaTe

[julia-users] Re: PEG Parser

2014-05-26 Thread harven
Nice! If you are interested by testing your library on a concrete problem, you may want to parse comma separated value (csv) files. The bnf is in the specification RFC4180. http://tools.ietf.org/html/rfc4180 AFAIK, the readcsv function provided in Base does not handle quotations well whereas t