Have you taken a look at my attempt at a solution (on the other/
original thread)?

https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4169bc292ab572%3F#doc_6d03461efde166ad

I don't know if it can be called idiomatic, but it looks functional to
me, doesn't use any type hints or mutable arrays, and it seems pretty
fast.  Convolves two 1000000 size vectors in roughly ~600 ms I
think...

Carson

On Jul 17, 5:44 pm, Frederick Polgardy <f...@polgardy.com> wrote:
> This example is beside the point of the original question. It uses mutable 
> arrays. It's very much dropping to the Java level. Am I missing something?
>
> -Fred
>
> --
> Science answers questions; philosophy questions answers.
>
> On Jul 17, 2010, at 6:04 PM, David Nolen wrote:
>
> > (defn ^{:static true} convolve ^doubles [^doubles xs ^doubles is]
> >   (let [xlen (count xs)
> >         ilen (count is)
> >         ys   (double-array (dec (+ xlen ilen)))]
> >     (dotimes [p xlen]
> >       (dotimes [q ilen]
> >         (let [n (+ p q), x (aget xs p), i (aget is q), y (aget ys n)]
> >           (aset ys n (+ (* x i) y)))))
> >     ys))
>
> > I don't think this is so bad and it can do a million points in ~400ms on my 
> > machine. 100,000 points in ~25ms. I don't consider this dropping to the 
> > Java level at all.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to