at.dms.kjc.sir.statespace
Class LinearCost

java.lang.Object
  extended by at.dms.kjc.sir.statespace.LinearCost

public class LinearCost
extends Object

This class represents the cost (variously defined) of computing the value of a linear filter representation. I.e. it represents the number of multiplies and adds that are necessary if we were to use a direct implementation for one execution of a LinearFilterRepresentation.
Obviously, all of the multiplies and adds refer to floating point operations.int cols


Field Summary
static LinearCost ZERO
          LinearCost with 0 multiplies and 0 adds.
 
Constructor Summary
LinearCost(int muls, int adds, int rows, int cols)
          Note that muls and adds do NOT count multiplication/addition by zero or multiplication by one, whereas originalMatrixSize gives the number of elements (including zero and one) that were in the original matrix.
 
Method Summary
 int getAdds()
           
 long getDirectCost()
          Returns the cost of this (in units proportional of estimated execution time, relative to any metric) if implemented directly in the time domain.
 int getMultiplies()
           
 boolean lessThan(LinearCost other)
          Returns true if this represents less computation than other.
 LinearCost plus(LinearCost other)
          returns a new LinearCost that represents the sum (element wise) of this and other.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

public static final LinearCost ZERO
LinearCost with 0 multiplies and 0 adds.

Constructor Detail

LinearCost

public LinearCost(int muls,
                  int adds,
                  int rows,
                  int cols)
Note that muls and adds do NOT count multiplication/addition by zero or multiplication by one, whereas originalMatrixSize gives the number of elements (including zero and one) that were in the original matrix.

Method Detail

getMultiplies

public int getMultiplies()

getAdds

public int getAdds()

lessThan

public boolean lessThan(LinearCost other)
Returns true if this represents less computation than other.


plus

public LinearCost plus(LinearCost other)
returns a new LinearCost that represents the sum (element wise) of this and other.


getDirectCost

public long getDirectCost()
Returns the cost of this (in units proportional of estimated execution time, relative to any metric) if implemented directly in the time domain. It's important to count the adds because we don't currently count the multiplies if it's multiplication by one! Also add one so that no linear node is completely free (even if it just does reordering or rate-changing, it takes some time to execute).
We scale up by FREQ_BENEFIT here instead of dividing in getFrequencyCost so that eveverything stays integral.