On 7/17/10 4:43 PM, Isaac Hodes wrote:
Apologies in advance if this is somewhat OT in a Clojure group.
double convolve(double *xs, double *is, double *ys){
int i,j;
for(i=0; i
How are you getting the size of the collections from the pointers, and
why are you checking the lengths on ever
On Jul 17, 2010, at 9:46 PM, Isaac Hodes wrote:
> I did check out your response: it's rather fast on my machine. it's
> not really functional, though, as you use the `let` macro as a way of
> procedurally executing a lot of functions. This isn't bad at all, but
> you're not composing functions.
'
First: sorry for splitting the conversation. That was my fault: don't
know how it happened. For those following along: the thread this
started with is here:
http://groups.google.com/group/clojure/browse_thread/thread/ee4169bc292ab572
Second, I don't think I expressed myself well in the original p
Hi Per,
woh, take it easy. I don't claim to be an expert. Thanks for showing
me that though. It certainly didn't seem right at first, but I had
trouble figuring out the laziness in clojure, me being new to it.
Anyway, have a good weekend!
Carson
On Jul 17, 10:02 pm, Per Vognsen wrote:
> How a
On Sun, Jul 18, 2010 at 11:32 AM, Carson wrote:
> I guess different people see things differently. I actually didn't
> understand the intent of the imperative version, even though it takes
> less lines I guess. There's quite a few things called convolution.
> My naive implementation was function
Thanks David.
On Jul 17, 4:58 pm, David Nolen wrote:
> I tried this, it runs in about the same amount of time as it did for you.
>
> On Sat, Jul 17, 2010 at 7:17 PM, Carson wrote:
> > Hi David,
> > Would appreciate if you could try out my attempt at this [1] on your
> > machine. My machine ain'
I guess different people see things differently. I actually didn't
understand the intent of the imperative version, even though it takes
less lines I guess. There's quite a few things called convolution.
My naive implementation was functional and pretty fast. Turns out it
can be even faster with
I think it really doesn't get any clearer than this in terms of intent. While I
was adept at calculus-level math 20 years ago, I've forgotten the little I knew
of matrices. This is the first algorithm that has communicated by visual
inspection (to me) exactly what a convolution is.
-Fred
--
Sc
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
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} convol
On 17 Jul, 22:43, Isaac Hodes wrote:
> It's just a shame, it seems to me, that there is such a nice way to
> represent the procedure in Python or even C, yet Clojure (or any Lisp
> really) struggles to idiomatically answer this question of
> convolution.
I'll have to disagree with the conclusion.
I tried this, it runs in about the same amount of time as it did for you.
On Sat, Jul 17, 2010 at 7:17 PM, Carson wrote:
> Hi David,
> Would appreciate if you could try out my attempt at this [1] on your
> machine. My machine ain't as fast as yours apparently...
>
> [1]
>
> https://groups.googl
Hi David,
Would appreciate if you could try out my attempt at this [1] on your
machine. My machine ain't as fast as yours apparently...
[1]
https://groups.google.com/group/clojure/tree/browse_frm/thread/ee4169bc292ab572/6d03461efde166ad?rnum=11&_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2Fee4
On Jul 17, 2010, at 3:43 PM, Isaac Hodes wrote:
> It's just a shame, it seems to me, that there is such a nice way to
> represent the procedure in Python or even C, yet Clojure (or any Lisp
> really) struggles to idiomatically answer this question of
> convolution.
No, it's pretty easy to do conv
(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
15 matches
Mail list logo