Git Product home page Git Product logo

Comments (5)

dmbates avatar dmbates commented on August 31, 2024

Regarding 1, the style in Julia is to use multiple dispatch, keeping in mind that you can methods to generic functions defined in another package. In particular you can define external constructors to take the form of argument that you prefer rather than having code for argument checking added to the internal constructor for every distribution type. Eventually all the constructors should end up at the one that has the arguments in the form of numeric scalars.

Regarding 2, remember that loops are relatively lightweight in Julia. A comprehension is a very effective way of creating an array from input arrays. Try

rg = [rand(Gamma(A[i,j],B[i,j])) for i in 1:size(A,1), j in 1:size(A,2)]

from distributions.jl.

jamesjohndrow avatar jamesjohndrow commented on August 31, 2024

Thanks, this is now my third day using Julia, so I appreciate your taking
the time to help out the n00b. My initial question has been "can I do
everything I can do in matlab and just as fast" and the answer appears to
be yes -- actually Julia is somewhat faster for the things I do. It's
ideally suited to Bayesian computation but I'm the first in the department
to start using it. I'll try to win some converts.

On Tue, Jun 18, 2013 at 8:20 AM, dmbates [email protected] wrote:

Regarding 1, the style in Julia is to use multiple dispatch, keeping in
mind that you can methods to generic functions defined in another package.
In particular you can define external constructors to take the form of
argument that you prefer rather than having code for argument checking
added to the internal constructor for every distribution type. Eventually
all the constructors should end up at the one that has the arguments in the
form of numeric scalars.

Regarding 2, remember that loops are relatively lightweight in Julia. A
comprehension is a very effective way of creating an array from input
arrays. Try

rg = [rand(Gamma(A[i,j],B[i,j]) for i in 1:size(A,1), j in 1:size(A,2)]


Reply to this email directly or view it on GitHubhttps://github.com//issues/71#issuecomment-19618471
.

from distributions.jl.

johnmyleswhite avatar johnmyleswhite commented on August 31, 2024

How much interest is there in doing this? I'm not opposed to it, but it seems a little bit like overkill.

from distributions.jl.

jamesjohndrow avatar jamesjohndrow commented on August 31, 2024

I don't see it as a high priority. The constructor syntax is compact and I've found the performance is often similar to C. I may just write up a little something to help people accustomed to matlab statistics toolbox to transition to Julia and put it on my blog. Happy to close this if you are.

from distributions.jl.

johnmyleswhite avatar johnmyleswhite commented on August 31, 2024

Let's close this for now then. We want to vectorize over parameters, we can do that in the future.

from distributions.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.