[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 = list(mat

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 unic

[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
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 = rea

[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 cod

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, Ch

[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 macro

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 rando

[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 M

[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: https://github.com/ARM-software/optimized-routines/blob/master/auxiliary/rem

[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 "NumberRel

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 U

[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 Ton

Re: [julia-users] Moore foundation grant.

2015-12-27 Thread Simon Byrne
Thanks for the suggestions, these are certainly the main areas in which we're looking to address as part of this work. I'd be interested to hear if you have more thoughts about the model specification/probabilistic programming language. A few other people have requested things like this, and th

[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 front

[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), (https://github.com/JuliaLang/openlibm/blob/master/src/e_exp.c):

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] 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 can

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

2015-07-30 Thread Simon Byrne
orlds, but with the speed/memory penalty of setting 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 > wrote: > >> On Wednesday, 29 July 2015 22:07:45 UTC+1, Steven G. Johnson

[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 instruction-

[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 . Based on the free preview, it looks like a bit of a diatrib

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 K

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 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 f(x::AbstractSEXPREC..

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

2015-07-07 Thread Simon Byrne
However, > your problem might be a bit 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 > > wrote: > > If I have a generic method foo, is there a way I can tell if a > particu

[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 flo

[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

[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 fi

[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 UTC+

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

2015-06-02 Thread Simon Byrne
derstand the escaping rules: what I usually do is write something that seems close, then call macroexpand on a quoted macro call, e.g. macroexpand(:(@modify_field! y.isadded = false)) > (4) Finally, building upon your ingenious code, I also added a > @modify_tuple_entry! macro to the pa

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

2015-06-02 Thread Simon Byrne
On 2 June 2015 at 13:00, David Gold 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
ut 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: > &

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

2015-06-02 Thread Simon Byrne
to analyze this output for the general case; it > seems like determining the return value of getindex is as hard as the > halting problem! > > Thanks, > Steve > > > On Monday, June 1, 2015 at 5:57:19 PM UTC-4, Simon Byrne wrote: >> >> That's som

[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 c

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 a

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 Cra

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 t

Re: [julia-users] Access Windows registry from Julia?

2015-05-13 Thread Simon Byrne
On Wednesday, 13 May 2015 09:45:46 UTC+1, Tony Kelman wrote: > > There's probably a fancier answer to that, but you can just shell out to > it: readall(`powershell -Command "Get-ChildItem -Path hkcu:"`) > Ah. Great, thanks! On Tuesday, 12 May 2015 17:22:10 UTC+1, David Anthoff wrote: > > I thin

Re: [julia-users] Access Windows registry from Julia?

2015-05-13 Thread Simon Byrne
end on that >> WindowsAPI.jl package? >> >> >> >> *From:* julia...@googlegroups.com [mailto:julia...@googlegroups.com] *On >> Behalf Of *Simon Byrne >> *Sent:* Tuesday, May 12, 2015 3:55 AM >> *To:* julia...@googlegroups.com >> *Subject:* [julia-us

[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 potenti

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

2015-05-09 Thread Simon Byrne
On 9 May 2015 at 19:53, Scott Jones 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

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 gett

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 p

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

2015-05-09 Thread Simon Byrne
tly (it returns a blank string, whereas on OS X it returns "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 th

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

2015-05-09 Thread Simon Byrne
On 8 May 2015 at 22:14, 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 > https://msdn.microsoft.com/en-us/library/windows/de

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

2015-05-08 Thread Simon Byrne
gure out why the julia process PATH wouldn't carry over to the R one. On 8 May 2015 at 15:32, Simon Byrne wrote: > I tried it (adding both the extra PATH path, and the path of the > library it couldn't find), but that didn't seem to help either. > > > On 8 May 2015

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

2015-05-08 Thread Simon Byrne
Directory first: > > https://msdn.microsoft.com/en-us/library/windows/desktop/hh310513(v=vs.85).aspx > > On Fri, May 8, 2015 at 10:12 AM, Simon Byrne wrote: >> >> As a follow up, here's some code (which requires that R be installed): >> >> ENV["PATH"] = ENV[&quo

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

2015-05-08 Thread Simon Byrne
r goes away. Any ideas? Simon On Friday, 8 May 2015 09:55:29 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

[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

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 = `

[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 interpola

[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 i

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

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 Fis

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

2015-03-24 Thread Simon Byrne
On Tuesday, 24 March 2015 20:25:48 UTC+1, Christopher Fisher wrote: > > Thank you for your replies, Rene and Simon. Unfortunately, HDF5 would not > properly install. Simon, would you be able to show me the syntax for > extracting the Range and Array from the UnivariateKDE object? I'm not > famil

[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

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 a

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 or

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 fo

[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 M

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 wrote: > I thought

[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 wrot

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 https://github.com/Julia

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-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: 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

[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 manua

[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

[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) Wi

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 c

[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 creat

[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: 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

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] 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 Un

[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+

[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 ", using only > Julia an

[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 > distributi

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 >

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 unde

Re: [julia-users] scoping and begin

2014-12-08 Thread Simon Byrne
allows globals to leak 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 B

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
t), try typing `local t = 1; t`) > > On Mon, Dec 8, 2014 at 6:11 AM, Simon Byrne > 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

[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 spe

Re: [julia-users] ijulia with multiple versions

2014-12-08 Thread Simon Byrne
each > julia version (and then probably create a launcher script to start 'ipython > --notebook --profile=PROFILENAME' as needed) > On Dec 8, 2014 5:58 AM, "Simon Byrne" > > wrote: > >> I have multiple versions of julia installed on my machine. Is there an

[julia-users] scoping and begin

2014-12-08 Thread Simon Byrne
According to the docs , 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 ne

[julia-users] ijulia with multiple versions

2014-12-08 Thread Simon Byrne
I have multiple versions of julia installed on my machine. Is there an easy way to specify which version of julia I want to use when running ijulia? Simon

[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 f

  1   2   >