Take a look at:

https://github.com/twitter/scalding/blob/develop/scalding-core/src/main/scala/com/twitter/scalding/mathematics/SizeHint.scala

specifically:

https://github.com/twitter/scalding/blob/develop/scalding-core/src/main/scala/com/twitter/scalding/mathematics/SizeHint.scala#L85


On Wed, Jun 12, 2013 at 2:58 AM, tomtau <notifications@github.com> wrote:

> In prototype/src/main/scala/prototype/Prototype.scala:
>
> > +    (optimizedChains.map(chain => optimizeProductChain(chain)._1).sum,
> > +        optimizedChains.map(chain => optimizeProductChain(chain)._2).reduce((x,y) => Sum(x,y)))
> > +  }
> > +
> > +  /**
> > +   * returns resulting cost, dimensions, sparsity
> > +   */
> > +  def evaluate(mf: MatrixFormula): (Double, (Int, Int), Float) = {
> > +    def max(one: Float, two: Float): Float = if (one > two) one else two
> > +
> > +    mf match {
> > +      case element: Literal => (0.0f, element.dimensions, element.sparsity)
> > +      case Sum(left, right) => {
> > +        val (costL, dimL, sparsL) = evaluate(left)
> > +        val (costR, dimR, sparsR) = evaluate(right)
> > +        (costL + costR, dimR, max(sparsL, sparsR))
>
> It is a summation, so dimR == dimL, no?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/tomtau/scalding/pull/2/files#r4653382>
> .
>



-- 
Oscar Boykin :: @posco :: http://twitter.com/posco