[julia-users] Re: Indexing problem

2016-11-17 Thread Simon Byrne
I'm not familiar with the package in question, but this line: w = Any[ 0.1*randn(1,13), 0 ] may be what is causing the problem. It is creating a 2-element Vector, the first element of which is a 1x13 Matrix, and the second element is a scalar 0. The analogous object in R would be: W =

Re: [julia-users] Re: [Announcement] Moving to Discourse (Statement of Intent)

2016-11-06 Thread Simon Byrne
Personally, I find the following an improvement over google groups: - code blocks (copying and pasting code into the google groups interface always tends to look bad) - the ability to edit posts - the ability to move threads to different categories (i.e. posts to julia-dev which should have gone

[julia-users] Re: unicode

2016-11-04 Thread Simon Byrne
Do you mean you to use the character as part of a variable name? e.g. ䷀ = 12 If so, I'm not sure you can do it from the REPL, other than via using eval, e.g. @eval $(Symbol('\u4dc0')) = 12 -simon On Friday, 4 November 2016 15:16:20 UTC, Henri Girard wrote: > > Hi, > I am trying to enter

[julia-users] Re-export variable define in __init__ of submodule with precompilation

2016-11-04 Thread Simon Byrne
How can I reexport a variable defined in the __init__ method of a submodule, to play nice with precompilation. The following gives me a "WARNING: could not import Foo.bar into TestExport": __precompile__() module TestExport export bar module Foo export bar function

[julia-users] Re: async read from device?

2016-11-02 Thread Simon Byrne
ld be nice if there was a way to do this without cat On Tuesday, 1 November 2016 11:17:31 UTC, Simon Byrne wrote: > > I'm trying to read from an input device asynchronously. I tried the obvious > > @async begin > dev = open(STICK_INPUT_DEV) > while true > s = read(dev

[julia-users] Re: avoid dollar $ interpolation in shell commands

2016-11-02 Thread Simon Byrne
Perhaps not quite what you had in mind, but `echo $ENV["PATH"]` should work On Wednesday, 2 November 2016 10:43:47 UTC, Christian Theil Have wrote: > > Hi, > > I've been trying to create a shell command that refers to an environment > variable, e.g., > > echo $PATH > > Julia will interpolate

[julia-users] async read from device?

2016-11-01 Thread Simon Byrne
I'm trying to read from an input device asynchronously. I tried the obvious @async begin dev = open(STICK_INPUT_DEV) while true s = read(dev, Stick) if s.ev_type == EV_KEY println(s) end end end But this doesn't seem to yield correctly. The full

Re: [julia-users] [ANN] JuliaBerry org: Julia on the Raspberry Pi

2016-10-31 Thread Simon Byrne
ct 31, 2016, at 08:39 AM, Simon Byrne wrote: > > Avik and myself have put together an organisation for those interested on > using Julia on the Raspberry Pi: > > https://juliaberry.github.io/ > > (the name was chosen to avoid confusing with JuliaPy). > > Contributions are welcome! > > -Simon > >

[julia-users] [ANN] JuliaBerry org: Julia on the Raspberry Pi

2016-10-31 Thread Simon Byrne
Avik and myself have put together an organisation for those interested on using Julia on the Raspberry Pi: https://juliaberry.github.io/ (the name was chosen to avoid confusing with JuliaPy). Contributions are welcome! -Simon

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Simon Byrne
It seems like you have a bunch of null characters in the string for some reason. You could try stripping them out with replace: julia> x = "\x002\0.\x005\0" "\x002\0.\x005\0" julia> y = replace(x,"\0","") "2.5" julia> parse(Float64, y) 2.5 On Tuesday, 25 October 2016 05:44:34 UTC+1,

[julia-users] Re: Is FMA/Muladd Working Here?

2016-09-21 Thread Simon Byrne
On Wednesday, 21 September 2016 06:56:45 UTC+1, Chris Rackauckas wrote: > > Hi, > First of all, does LLVM essentially fma or muladd expressions like > `a1*x1 + a2*x2 + a3*x3 + a4*x4`? Or is it required that one explicitly use > `muladd` and `fma` on these types of instructions (is there a

Re: [julia-users] Setting random number generator seed using sequential integers

2016-08-09 Thread Simon Byrne
It's an interesting problem. In general, there's not much you can do if the state of your generator is larger than the size of the seed (which it definitely is in the case of Mersenne twisters). As to whether it would bias your sample: it ultimately depends on what you are doing with your

[julia-users] Re: Speeding up Matrix .^ transpose(Vector)

2016-06-30 Thread Simon Byrne
exp(a*log(b)) is usually faster than b^a (in fact, b^a internally usually does something similar, but with some extra tricks to avoid loss of precision). You might be able to use one of the vectorized math libraries: AppleAccelerate.jl (if you're on OS X), VML.jl (if you have access to Intel

[julia-users] Re: Remez algorithm

2016-06-16 Thread Simon Byrne
I realise this is a bit late to the party, but in case anyone is still interested (or happens to be searching in future), I've created: https://github.com/simonbyrne/Remez.jl The code is mostly based on some code by ARM:

[julia-users] ANN: WinReg.jl

2016-04-26 Thread Simon Byrne
I've put together a small package for interfacing with the Windows registry: https://github.com/simonbyrne/WinReg.jl At the moment, it can only be used for querying the registry, but if you have other needs, please open a pull request. -Simon

[julia-users] Re: My module MathToolkit (PSLQ algorithm, recurrence detection, etc.)

2016-03-06 Thread Simon Byrne
I think you should submit it as a package, though you might want to consider a more descriptive name: keep in mind that Julia is a technical computing language, so a lot of things can be called "Math". The algorithms you mention would typically fall under number theory, so how about

Re: [julia-users] Code introspection for generated function

2016-02-11 Thread Simon Byrne
This might fall under: https://github.com/JuliaLang/julia/issues/2625 On Thursday, 11 February 2016 02:54:42 UTC, Andy Ferris wrote: > > OK thanks Tim! > > Is there some way/plan to fix this in the future, to make it more > convenient? > > Andy > > On Wednesday, February 10, 2016 at 10:27:38 PM

[julia-users] Re: Euler Maruyama for neural networks, slower than python

2016-01-21 Thread Simon Byrne
I noticed the commented out BLAS.gemm! and BLAS.axpy! lines: did these help? -Simon On Thursday, 21 January 2016 11:12:53 UTC, Viral Shah wrote: > > The matrix-vector multiply in there will lose the benefit of BLAS in > devectorization. This is one area where we ought to be better, since this

Re: [julia-users] Moore foundation grant.

2016-01-13 Thread Simon Byrne
Hi All, The roadmap has now been posted: http://juliacomputing.com/blog/2016/01/14/stats-roadmap.html Can I suggest that comments be posted to the julia-stats thread: https://groups.google.com/d/topic/julia-stats/29l5yA87Qss/discussion -Simon On Wednesday, 13 January 2016 21:23:03 UTC, Lars

[julia-users] Re: ANN: FlexFloat, interval valued, stretchy floats for accuracy (each is 2-stateful, if desired)

2015-12-11 Thread Simon Byrne
Thanks Jeffrey it looks interesting. How does this compare to ValidatedNumerics.jl? https://github.com/dpsanders/ValidatedNumerics.jl -simon On Friday, 11 December 2015 05:09:27 UTC, Jeffrey Sarnoff wrote: > > FlexFloat is available -- see > the

[julia-users] Re: Is the accuracy of Julia's elementary functions (exp, sin ..) known?

2015-12-08 Thread Simon Byrne
Assuming you're using the default openlibm math library (i.e. your Base.libm_name == "libopenlibm"), then yes I believe that should be the case. The precise accuracy details are given in the file headers, e.g. for exp(x::Float64),

Re: [julia-users] Has std() enough precision?

2015-09-07 Thread Simon Byrne
The problem is that the computation of the mean is inaccurate: although the relative error is small, when you perform the subtraction for computing the standard deviation, as the numbers are almost the same, the relative error is massively amplified (this is typically known as *catastrophic

Re: [julia-users] Has std() enough precision?

2015-09-07 Thread Simon Byrne
September 2015 10:47:42 UTC+1, Simon Byrne wrote: > > The problem is that the computation of the mean is inaccurate: although > the relative error is small, when you perform the subtraction for computing > the standard deviation, as the numbers are almost the same, the relative > err

Re: [julia-users] Re: John L. Gustafson's UNUMs

2015-07-30 Thread Simon Byrne
that extra bit? I can't really comment yet on how much processing this would add... On Thu, Jul 30, 2015 at 9:18 AM, Simon Byrne simon...@gmail.com javascript: wrote: On Wednesday, 29 July 2015 22:07:45 UTC+1, Steven G. Johnson wrote: And I don't see a clear practical use-case for an inexact bit

[julia-users] Re: John L. Gustafson's UNUMs

2015-07-30 Thread Simon Byrne
On Wednesday, 29 July 2015 22:07:45 UTC+1, Steven G. Johnson wrote: And I don't see a clear practical use-case for an inexact bit per value, as opposed to a single inexact flag for a whole set of computations (as in IEEE). Probably not quite what others had in mind, but an

[julia-users] Re: John L. Gustafson's UNUMs

2015-07-25 Thread Simon Byrne
Some HN discussion here: https://news.ycombinator.com/item?id=9943589 I'd be keen to know more but he hasn't really published any details other than his book http://www.amazon.com/The-End-Error-Computing-Computational/dp/1482239868. Based on the free preview, it looks like a bit of a diatribe

Re: [julia-users] Re: Azure: Which VM?

2015-07-15 Thread Simon Byrne
Also, if you want to test on Windows, Microsoft have some prebuilt VM images available: http://dev.modern.ie/tools/vms/#downloads They don't come with a licence, so expire after 90 days, but they're quite handy for testing and debugging packages. On Wednesday, 15 July 2015 21:26:55 UTC+1, Tony

Re: [julia-users] how to determine if a particular method signature defined

2015-07-07 Thread Simon Byrne
easier than what Traits does as it test for equality. Let me know if you got questions. On Mon, 2015-07-06 at 19:25, Simon Byrne simon...@gmail.com javascript: wrote: If I have a generic method foo, is there a way I can tell if a particular signature has been defined? Note that I

Re: [julia-users] how to determine if a particular method signature defined

2015-07-07 Thread Simon Byrne
On 7 Jul 2015, at 13:13, Milan Bouchet-Valat nalimi...@club.fr wrote: I think another solution could work, but I'm not sure it's really better. Instead of checking whether method_defined(f,(Vararg{SEXPREC},)) you could always define a fallback wrapper function like this: function

[julia-users] how to determine if a particular method signature defined

2015-07-06 Thread Simon Byrne
If I have a generic method foo, is there a way I can tell if a particular signature has been defined? Note that I don't want method_exists (which simply determines if something can be dispatched), I want to determine if a particular definition has been made, e.g. if foo(x) = x then I want

Re: [julia-users] Re: Short-circuit evaluation for multiplication

2015-07-03 Thread Simon Byrne
If the zeros are known at compile time, LLVM may optimise away some unnecessary operations: julia foo(x) = x + 0*(x*x + 2) foo (generic function with 1 method) julia @code_llvm foo(1) define i64 @julia_foo_21664(i64) { top: ret i64 %0 } Unfortunately, this doesn't work as is with

[julia-users] parse with optional BigInts

2015-06-30 Thread Simon Byrne
I've searched around, but am somewhat stumped: is there any function (in 0.3 and/or 0.4) which when passed a decimal string, will return the best signed integer type, i.e. the smallest of Int, Int64, Int128 or BigInt? The closest I've found is parse, but this returns macro-wrapped expressions:

[julia-users] Re: Guidelines for overriding Base.convert?

2015-06-25 Thread Simon Byrne
For abstract types it is acceptable to return an instance of a subtype, e.g. convert(Integer, 1.0) Otherwise, I suspect you are in for all sorts of trouble, e.g. julia import Base.convert julia immutable Foo x::Int end julia function bar(x) y::Foo y=x

[julia-users] Re: Set precision when printing to file

2015-06-18 Thread Simon Byrne
You might be thinking of https://github.com/JuliaLang/julia/issues/10610 On Thursday, 18 June 2015 15:30:05 UTC+1, Tom Breloff wrote: Scott: I remember there being another discussion but I can't seem to find it. How did you try to get in touch? Do you want to start a github issue and I'll

[julia-users] Re: FFT performance compared to MATLAB

2015-06-15 Thread Simon Byrne
Hi Juan, You would also need to change Complex64 to Complex128. -Simon On Sunday, 14 June 2015 22:25:21 UTC+1, Juan Carlos Cuevas Bautista wrote: Hi Everybody, I am new in Julia Programming. I have been following this post to optimize my code of time series in which I have big heavy files

[julia-users] Re: Is it possible to change an object's type at runtime?

2015-06-07 Thread Simon Byrne
No, you can't change the type of an object. You can however define types with fields that aren't constrained to be of a concrete type: while this is worse for performance, it is occasionally useful, e.g. type A a::Union(Void, Int) end A(nothing).a = 1 On Saturday, 6 June 2015 23:49:53

[julia-users] Re: ANN: modifyField! routine

2015-06-02 Thread Simon Byrne
, June 1, 2015 at 5:57:19 PM UTC-4, Simon Byrne wrote: That's some impressive metaprogramming. In v0.4, you should be able to do this without the maker functions, using generated functions http://julia.readthedocs.org/en/latest/manual/metaprogramming/#generated-functions As far as an interface

Re: [julia-users] Re: ANN: modifyField! routine

2015-06-02 Thread Simon Byrne
to the package. I'd appreciate your comments on that as well. On Tuesday, June 2, 2015 at 8:16:29 AM UTC-4, Simon Byrne wrote: On 2 June 2015 at 13:00, David Gold david@gmail.com wrote: @Simon: why safer? Rather, what is unsafe about calling symbol within the Expr constructor? I

Re: [julia-users] Re: ANN: modifyField! routine

2015-06-02 Thread Simon Byrne
On 2 June 2015 at 13:00, David Gold david.gol...@gmail.com wrote: @Simon: why safer? Rather, what is unsafe about calling symbol within the Expr constructor? I wasn't quite sure how the scoping worked (i.e. what would happen if the type had not been exported?), but it does seem to be safe.

[julia-users] Re: ANN: modifyField! routine

2015-06-02 Thread Simon Byrne
, but it does seem safer). On Tuesday, 2 June 2015 10:00:39 UTC+1, Simon Byrne wrote: You could use the eltype function, but having thought more about it, I think it might be easier (and more general) if you operate on the objects instead of the container. Something like: @generated function

[julia-users] Re: ANN: modifyField! routine

2015-06-01 Thread Simon Byrne
That's some impressive metaprogramming. In v0.4, you should be able to do this without the maker functions, using generated functions http://julia.readthedocs.org/en/latest/manual/metaprogramming/#generated-functions As far as an interface goes, I would suggest a macro, e.g. so that the user

Re: [julia-users] Re: Sampling a Discrete Probability Distribution Using a Vector

2015-05-27 Thread Simon Byrne
In fact, it's already implemented in Distributions.jl: julia c = Categorical([0.1,0.2,0.3,0.4]) Categorical(K=4, p=[0.1,0.2,0.3,0.4]) julia a = sampler(c) AliasTable with 4 entries julia rand(a) 4 On Wednesday, 27 May 2015 17:24:55 UTC+1, Sebastian Nowozin wrote: Hi Jason, great answer,

Re: [julia-users] Has anyone done a Pascal-style with statement (i.e., macro)?

2015-05-22 Thread Simon Byrne
R has such a function: http://www.inside-r.org/r-doc/base/with But given the mess that is R's scoping rules, this is perhaps not something we should attempt to emulate. I think Toivo's suggestion is very reasonable. On Friday, 22 May 2015 05:53:39 UTC+1, Toivo Henningsson wrote: I think at

Re: [julia-users] Method ambiguity when defining new Number types

2015-05-22 Thread Simon Byrne
In 0.4 you can also use the Val{T} type for dispatching on particular values (it's used in Base.LinAlg in a couple of places). Things like this highlight how old the BLAS specification really is: level-3 BLAS (the most recent) is now 27 years old. They were written with machines such as the

[julia-users] Access Windows registry from Julia?

2015-05-12 Thread Simon Byrne
The Windows registry useful to determine installation paths of other software and whatnot. I've hacked together some code using the REG QUERY command: https://github.com/JuliaStats/RCall.jl/blob/e4ba35cf45ca2eb041f660642449b8259c2f30e3/deps/build.jl#L13 but it is somewhat complicated (and

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Simon Byrne
bar). On the other hand, it does work the other way, i.e. rprint(Sys.setenv(FOO='baz')) ENV[FOO] gives the desired result. Is there anyway if I can tell if the problem is on the Julia or the R end? On 9 May 2015 at 09:13, Simon Byrne simonby...@gmail.com wrote: On 8 May 2015 at 22:14, ele

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Simon Byrne
On 8 May 2015 at 22:14, ele...@gmail.com wrote: Your problem may not be the dll itself, it could be one of its dependencies. Yes, the problem isn't the dll I'm calling, but one of the dependencies. Also the windows dll search path is kind of complex (see

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Simon Byrne
On Saturday, 9 May 2015 18:18:28 UTC+1, Jameson wrote: It might be a problem with windows. In particular, windows has 3 semi-independent environment variables. Julia uses the Win32 API environment, but there are also two posix environ arrays (unicode and not unicode) that might be getting

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Simon Byrne
On Saturday, 9 May 2015 18:18:28 UTC+1, Jameson wrote: Sorry, but I'm guessing that none of that information really helps :( Well, other than having gained insight into the massive amount of effort required to keep Julia running across platforms, it was useful in that I now know I should

Re: [julia-users] Re: ccall and ENV on Windows

2015-05-09 Thread Simon Byrne
On 9 May 2015 at 19:53, Scott Jones scott.paul.jo...@gmail.com wrote: Do you need to check both the 8-bit and Unicode environments then to set the environment variable so R can see it? I guess so? Anyway, I've opened issue https://github.com/JuliaLang/julia/issues/11215

[julia-users] ccall and ENV on Windows

2015-05-08 Thread Simon Byrne
I'm trying to understand how ENV works (at least on Windows): I'm trying to ccall a library that requires a particular addition to PATH. If I do this externally (through the Windows menus) it works okay, but not via ENV[PATH]. I assume that this means that ENV only changes the local process?

[julia-users] Re: ccall and ENV on Windows

2015-05-08 Thread Simon Byrne
UTC+1, Simon Byrne wrote: I'm trying to understand how ENV works (at least on Windows): I'm trying to ccall a library that requires a particular addition to PATH. If I do this externally (through the Windows menus) it works okay, but not via ENV[PATH]. I assume that this means that ENV only

Re: [julia-users] command line interpolation with prefixes

2015-05-07 Thread Simon Byrne
invocation with a space *as part of the argument* (many commands actually do allow this), then you can do this: `command -e $a` If neither of those is the case you can do something like this: cmd = `command` for x in a cmd = `$cmd -e $x` end On Wed, May 6, 2015 at 10:27 AM, Simon

[julia-users] command line interpolation with prefixes

2015-05-06 Thread Simon Byrne
I want to pass an array of strings to a command line program, where each string needs to be preceded by an -e. e.g. I have a = [string1,string2,string3,...] and I want to call `command -e $(a[1]) -e $(a[2]) -e $(a[3])` ... Is there an easy way to do this using the command line interpolation

[julia-users] Re: calling Julia from Mathematica

2015-04-07 Thread Simon Byrne
I don't think there's an easy way to do it, unfortunately: if someone really wants to tackle it, the way forward would probably be through Mathematica's LibraryLink: http://mathematica.stackexchange.com/q/8438 s On Tuesday, 7 April 2015 11:31:16 UTC+1, Sheehan Olver wrote: I would be very

Re: [julia-users] Re: Does it make sence to use Uint8 instead of Int64 on x64 OS?

2015-03-28 Thread Simon Byrne
There can also be some speed advantages if you can exploit vectorised SIMD operations, see for example https://software.intel.com/en-us/articles/computing-delacorte-numbers-with-julia On Wednesday, 25 March 2015 21:38:31 UTC+1, Boris Kheyfets wrote: Thanks. On Wed, Mar 25, 2015 at 11:31 PM,

Re: [julia-users] Can Julia Import SAS Datasets or SAS Transport Files ?

2015-03-27 Thread Simon Byrne
I had the same idea, but didn't get anywhere near as far. But I did write some code for converting the IBM float format: https://gist.github.com/simonbyrne/5443843 On Friday, 27 March 2015 22:46:11 UTC+1, Sam L wrote: I actually started writing a package to do this as a way to learn Julia.

[julia-users] Re: Saving Kernel Density Estimation Function output for later use

2015-03-24 Thread Simon Byrne
Ah. So FloatRange actually has 4 fields: you can see their names by calling names(range) start step len divisor if you save all those, and pass them back to the constructor, FloatRange(start,step,len,divisor) you should be in business. On Tuesday, 24 March 2015 21:40:41 UTC+1, Christopher

[julia-users] Re: Saving Kernel Density Estimation Function output for later use

2015-03-24 Thread Simon Byrne
The UnivariateKDE object is just a Range and an Array of the same length, so you could also just save that information, and recreate the object via UnivariateKDE(range,density). On Tuesday, 24 March 2015 13:32:46 UTC+1, René Donner wrote: You can try the jld* functions of the HDF5.jl package,

Re: [julia-users] Anything changng assembly?

2015-03-23 Thread Simon Byrne
On Sunday, 22 March 2015 20:13:43 UTC+1, Isaiah wrote: The big change is that `Base.llvmcall` is now merged, so you can write LLVM IR directly. There are two examples in test/llvmcall.jl, and I believe Simon Byrne has been testing the use of this for some math intrinsics if you want

Re: [julia-users] Official recommendation for: conversions?

2015-03-21 Thread Simon Byrne
My rough interpretation (which is by no means the official one, as I think this is still up for debate), is as follows:, 1) convert(T,x) is the most specific: it will convert x to type T, throwing an error if outside the range (though it can round, for instance when converting to a Rational

Re: [julia-users] Official recommendation for: conversions?

2015-03-21 Thread Simon Byrne
On Saturday, 21 March 2015 09:38:23 UTC+1, Simon Byrne wrote: * in some cases, x can be a string: at the moment this seems to only work for BigFloat and BigInt, but perhaps this should apply to other types. See https://github.com/JuliaLang/julia/issues/10594 in case anyone has an opinion

Re: [julia-users] Re: Some simple use cases for multi-threading

2015-03-19 Thread Simon Byrne
One other possible use case: for interactive IJulia help notebooks, similar to Mathematica. Though you would probably want them completely sandboxed. On Thursday, 19 March 2015 08:38:58 UTC, Tobias Knopp wrote: Same thing for Gtk.jl Its an absolute standard pattern to spawn a thread even for

[julia-users] Re: Some simple use cases for multi-threading

2015-03-18 Thread Simon Byrne
On Saturday, 14 March 2015 13:06:26 UTC, John wrote: My main use cases involve operations that I want to parallelize over the last dimension of an array. I think this is a nice straightforward case, and something that a lot of other vector math libraries do (e.g. I believe that Intel's MKL

Re: [julia-users] Re: Factorization of big integers is taking too long

2015-03-15 Thread Simon Byrne
You're right the issue is that Char : Integer, but segmentation faults still shouldn't happen. I actually see a stack overflow in 0.3.6 (on OS X). In 0.4, it is simply a MethodError, as Char is no longer a subtype of Integer. -simon On 15 March 2015 at 12:25, Hans W Borchers

[julia-users] Re: Factorization of big integers is taking too long

2015-03-13 Thread Simon Byrne
The R gmp docs say that they use the Pollard Rho algorithm, and there is an implementation of it in the GMP demos directory: https://gmplib.org/repo/gmp/file/2d027c920892/demos/factorize.c So presumably they're using that code? simon On Friday, 13 March 2015 18:46:21 UTC, Steven G. Johnson

Re: [julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-09 Thread Simon Byrne
On Monday, 9 March 2015 13:06:46 UTC, Alan Edelman wrote: buffon needle could be one That has the nice benefit of leading to a discussion of how lucky Lazzarini was in getting his approximation: http://en.wikipedia.org/wiki/Buffon's_needle#Estimating_.CF.80

Re: [julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-09 Thread Simon Byrne
On a pi-related note: one algorithm that would be useful in Base is a remainder modulo-pi. At the moment we call out to a routine in openspecfun, but this requires allocating a 2-element array on each call (and also has some issues on certain compilers (see, for example

[julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-08 Thread Simon Byrne
How about an ijulia notebook of 101 ways to compute pi in Julia, ideally with accompanying graphics? On Sunday, 8 March 2015 13:16:26 UTC, Johan Sigfrids wrote: Because calling out to mpfr is cheating here is a implementation of Gauss-Legendre in Julia calculating Pi to the desired number

Re: [julia-users] Re: Informal Call for a Julia π - day challenge

2015-03-08 Thread Simon Byrne
Here's my nomination: unfortunately, it only works on 0.4 using LLVM =3.5: function asmpi() Base.llvmcall(%pi = call double asm fldpi, ={st},~{dirflag},~{fpsr},~{flags}() #0 ret double %pi, Float64, ()) end

[julia-users] Re: KDEMultivariate in Julia

2015-02-27 Thread Simon Byrne
Well, there isn't one, at least not yet. KernelDensity.jl (https://github.com/JuliaStats/KernelDensity.jl) can handle univariate and bivariate data, but only continuous variables. From what I can tell, the python one handles discrete data by just separating the data, so you could to that

[julia-users] Re: How to store the state of current rand generator (not set the seed)

2015-02-24 Thread Simon Byrne
One idiom that we are slowly moving toward is requiring that all methods (such as rand) which use random numbers should accept an RNG as an argument, so you might be able to write something like r = MersenneTwister() stage1(r) r_a = deepcopy(r) stage2_a(r_a) r_b = deepcopy(r) stage2_b(r_b)

[julia-users] Re: How to store the state of current rand generator (not set the seed)

2015-02-24 Thread Simon Byrne
That is a good idea and something we are working toward. Unfortunately situation is a bit complicated at the moment: in the 0.4 branch, there are actually 2 RNGs operating side-by-side (one for Base rand methods, and for the Rmath library used by Distributions). Hopefully this can get resolved

Re: [julia-users] Elegant way of dealing with evaluating on branch cuts of sqrt(z-1).*sqrt(z+1) ?

2015-02-13 Thread Simon Byrne
On Friday, 13 February 2015 04:34:43 UTC, Sheehan Olver wrote: For completeness, here is the definition I ended up using (probably using map is bad performance wise but I don’t actually use that yet): You can use @vectorize_1arg macro for this: @vectorize_1arg sqrtx2 Number

[julia-users] Re: Chi square test in Julia?

2015-02-10 Thread Simon Byrne
Hi Arin, It would appear that there isn't a chi square test at the moment. If you want to implement one yourself, you can compute the quantiles of a chi squared distribution using DIstributions.jl (if you do this, please consider submitting it to HypothesisTests.jl). Alternatively, you could

[julia-users] Re: Robust Inner Products

2015-02-01 Thread Simon Byrne
If you wanted to implement such an algorithm, you would need to robust-ify the multiplication as well, using a two-product style algorithm: this paper goes into a lot of detail: http://www.ti3.tu-harburg.de/paper/rump/OgRuOi05.pdf Alternatively, you could use full double-double arithmetic: see

[julia-users] Re: Robust Inner Products

2015-02-01 Thread Simon Byrne
I realise I didn't actually answer your question: I can't speak as to whether it will be accepted in Base (you will probably have to open an issue or pull request to start a discussion), but at the very least it would be useful to at least have in a package somewhere. If you don't want to

[julia-users] Re: Peculiarly slow matrix multiplication

2015-01-21 Thread Simon Byrne
As Jutho said, this shouldn't happen, but is difficult to diagnose without further information. What are the types of shrt and expr? (these can be found using the typeof function). Simon On Wednesday, 21 January 2015 07:59:34 UTC, Jutho wrote: Not sure what is causing the slowness, but you

[julia-users] Re: Complex infinity

2015-01-15 Thread Simon Byrne
On Thursday, 15 January 2015 02:51:35 UTC, Ed Scheinerman wrote: First, dividing nonzero by zero should give an infinite result. It does for real, but not complex: julia 1/0 Inf julia 1/(0+0*im) # Should be some form of infinity NaN + NaN*im Second: Dividing by infinity (expect

[julia-users] Re: Julia takes 2nd place in Delacorte Numbers competition

2015-01-05 Thread Simon Byrne
Congrats as well. I look forward to seeing your writeup. Simon On Sunday, 4 January 2015 17:35:46 UTC, Arch Robison wrote: FYI, I won 2nd place in the recent Al Zimmerman programming contest Delacorte Numbers http://trdb.org/Contest/DelacorteNumbers/Standings, using only Julia and a

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
* julia 3e+1* * 30.0* *julia 3e + 1* * 9.154845485377136* Perhaps this is a good reason to change behaviour such that e is no longer a constant: it has always seemed bit odd to use a valuable latin singleton in this way. We could use a unicode script e (U+212F)

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
On Monday, 5 January 2015 13:48:31 UTC, Tamas Papp wrote: I think that using Unicode (outside ASCII) for numeric literals would be more trouble than it is worth (typing, visually distinguishing them from other similar-looking characters, etc). I feel that even if a language supports

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
On Monday, 5 January 2015 20:13:51 UTC, Jeff Bezanson wrote: Hex float literals are a different story. It's an understatement to say they are VERY rarely used, and that most programmers don't need them and have never heard of them. They also don't currently work under MSVC (issue #6349).

Re: [julia-users] Rounding and the IEEE rule

2014-12-26 Thread Simon Byrne
On Friday, 26 December 2014 06:14:34 UTC-6, Hans W Borchers wrote: I started this thread long time ago with a question about rounding rules and the IEEE floating point standard. I felt like being criticized for even thinking Julia could follow the round-to-even rule. Now I learn that Julia

[julia-users] Re: Porting a Matlab function, mvtrnd, multivariate t distribution number generation

2014-12-26 Thread Simon Byrne
You might also be interested in MvTDist in Distributions.jl: https://github.com/JuliaStats/Distributions.jl/blob/master/src/multivariate/mvtdist.jl On Friday, 26 December 2014 19:50:03 UTC-6, jspark wrote: Hi, I am porting a matlab random number generation from multivariate T distribution

Re: [julia-users] Re: home page content

2014-12-10 Thread Simon Byrne
Yeah, I don't think we need runnable widgets on the main page. A better option would be to have a Run in JuliaBox link which could start a new session. As far as code samples go, the ideal ones should: * be around 10 lines or so * demonstrate the key features of Julia (i.e. all the things under

[julia-users] scoping and begin

2014-12-08 Thread Simon Byrne
According to the docs http://julia.readthedocs.org/en/latest/manual/variables-and-scoping/, begin blocks do not introduce new scope blocks. But this block: https://github.com/JuliaLang/julia/blob/1b9041ce2919f2976ec726372b49201c887398d7/base/string.jl#L1601-L1618 *does* seem to introduce a new

Re: [julia-users] ijulia with multiple versions

2014-12-08 Thread Simon Byrne
(and then probably create a launcher script to start 'ipython --notebook --profile=PROFILENAME' as needed) On Dec 8, 2014 5:58 AM, Simon Byrne simon...@gmail.com javascript: wrote: I have multiple versions of julia installed on my machine. Is there an easy way to specify which version of julia I want

[julia-users] Re: [WIP] CSVReaders.jl

2014-12-08 Thread Simon Byrne
Very nice. I was thinking about this recently when I came across the rust csv library: http://burntsushi.net/rustdoc/csv/ It had a few neat features that I thought were useful: * the ability to iterate by row, without saving the entire table to an object first (i.e. like awk) * the option to

Re: [julia-users] scoping and begin

2014-12-08 Thread Simon Byrne
= 1; t`) On Mon, Dec 8, 2014 at 6:11 AM, Simon Byrne simon...@gmail.com javascript: wrote: According to the docs http://julia.readthedocs.org/en/latest/manual/variables-and-scoping/, begin blocks do not introduce new scope blocks. But this block: https://github.com/JuliaLang/julia/blob

Re: [julia-users] Re: [WIP] CSVReaders.jl

2014-12-08 Thread Simon Byrne
On Monday, 8 December 2014 17:04:10 UTC, John Myles White wrote: * This package and the current DataFrames code both support specifying the types of all columns before parsing begins. There's no fast path in CSVReaders that uses this information to full-advantage because the functions

Re: [julia-users] scoping and begin

2014-12-08 Thread Simon Byrne
in: julia a = 0 0 julia begin local x = 1 a = 2 end 2 julia a 2 julia x ERROR: x not defined On Mon, Dec 8, 2014 at 12:02 PM, Simon Byrne simon...@gmail.com javascript: wrote: So begin blocks can introduce a scope, they just don't by default

[julia-users] Re: processor vector instructions?

2014-12-04 Thread Simon Byrne
FMA operations are not yet supported, but there is an open pull request: https://github.com/JuliaLang/julia/pull/8112 On Wednesday, 3 December 2014 07:20:12 UTC, ivo welch wrote: dear julia experts: my question is not important, but I am curious: there seem to be a bewildering array of

Re: [julia-users] travis for os x packages

2014-11-11 Thread Simon Byrne
Fantastic, I got it working. Thanks for all the help. Simon. On Tuesday, 11 November 2014 04:56:14 UTC, Pontus Stenetorp wrote: On 11 November 2014 10:49, Tony Kelman to...@kelman.net javascript: wrote: I don't want to steal Pontus Stenetorp's thunder since he did all the work, but

[julia-users] travis for os x packages

2014-11-10 Thread Simon Byrne
I would like to set up travis for an OS X-only package: does anyone have suggestions for how I should set up travis (or has anyone already done this)? simon

Re: [julia-users] Trigonometric functions at infinity

2014-11-05 Thread Simon Byrne
Alternatively, you could just redefine sin without the nan_dom_err call: https://github.com/JuliaLang/julia/blob/cdcdc7ae5a79d5f8232a14e6e072123dd178cf9e/base/math.jl#L123 Something like the following should work: import Base.sin sin(x::Float64) = ccall((:sin,Base.Math.libm), Float64,

Re: [julia-users] realmax function and maximum float64 number

2014-10-28 Thread Simon Byrne
When playing around with floating point numbers, I find a function like the following helps a lot to see what they look like underneath: decode(x::Float32) = (b=bits(x); (b[1], b[2:9], b[10:32])) decode(x::Float64) = (b=bits(x); (b[1], b[2:12], b[13:64])) or, very soon, you will be able to use

[julia-users] Re: Type parameter describes number of items

2014-10-28 Thread Simon Byrne
This is exactly what `NTuple` was designed for: julia NTuple{3,Float64} (Float64,Float64,Float64) You can use this as a field in a parametric type julia type Foo{N} x::NTuple{N,Float64} end julia Foo((1.0,2.0,3.0)) Foo{3}((1.0,2.0,3.0)) On Tuesday, 28 October 2014 15:47:56 UTC, Andrew

Re: [julia-users] Re: Modified Gram-Schmidt: getting the best out of Julia

2014-10-23 Thread Simon Byrne
On Thursday, 23 October 2014 15:02:23 UTC+1, Tim Holy wrote: I believe I mentioned A_mul_B! and friends. For the subtraction, check out NumericExtensions, specifically the subtract! function. Also I would like to shamelessly plug InplaceOps: https://github.com/simonbyrne/InplaceOps.jl

[julia-users] determining first pass of a loop

2014-10-23 Thread Simon Byrne
Is it possible to determine whether or not it is the first pass of a loop entirely from within the loop, i.e. without adding extra statements outside the loop? The context is that I've been thinking about how to avoid reallocating arrays on each loop, for instance something like this will

  1   2   >