An algorithm like that generating StackOverflowErrors suggests it's recursing deeply, which suggests you're not using recur *enough*. If the function calls itself, try to see if you can get that call into tail position and change it to "recur".
On Fri, Jun 21, 2013 at 4:06 PM, P Martin <prof.pmarti...@gmail.com> wrote: > Hi, > > I am new to clojure and I am trying to reimplement some optimization code > that uses gradient descent. I have attached the source to this post. My > experience with gradient descent is in Matlab, which is procedural. > > When I run my function gradient-descent I supply step sizes and error > values of 0.01, it runs correctly and gives me good results. However, if I > decrease the error value below 0.001 it produces a stack overflow error. I > get the same error if my step value goes down to 0.001. > > Is my looping mechanism correct and I am just having numerical > limitations? Am I abusing loop/recur? Any suggestions/critiques would be > great! > > Thanks, > Patrick > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.