Sounds good! Thanks for taking a look too. I always like to make methods
@tailrec if possible to avoid potentially blowing the stack for large
inputs.


On Sat, Jul 6, 2013 at 4:52 PM, Matei Zaharia <notifications@github.com>wrote:

> In mllib/src/main/scala/spark/mllib/regression/RidgeRegression.scala:
>
> > -      val highValue = crossValidate((high - mid) / 2 + mid)
> > -      val (newLow, newHigh) = if (lowValue._2 < highValue._2) {
> > -        (low, mid + (high-low)/4)
> > -      } else {
> > -        (mid - (high-low)/4, high)
> > -      }
> > -      if (newHigh - newLow > 1.0E-7) {
> > -        // :: is list prepend in Scala.
> > -        lowValue :: highValue :: binSearch(newLow, newHigh)
> > -      } else {
> > -        List(lowValue, highValue)
> > +      @tailrec
> > +      def loop(
> > +        low: Double,
> > +        high: Double,
> > +        acc: List[(Double, Double, DoubleMatrix)]): List[(Double, Double, DoubleMatrix)] = {
>
> OK, I was just asking because I haven't looked much at this code and
> wanted to make sure it's correct. I'll let @shivaram<https://github.com/shivaram>look at it too.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mesos/spark/pull/679/files#r5053712>
> .
>