|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Cost
public class Cost
This class implements a cost model based on a power expansion.
$Id: Cost.java,v 1.15 2007-05-15 17:36:06 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The cost model is the sum of a set of terms. Each term is of the form
c*x**n
Constructor Summary | |
---|---|
Cost()
Create a cost with one term with a zero coefficient, power of 0. |
|
Cost(double coefficient,
int power)
Create a cost with one term with the given coefficient, etc. |
Method Summary | |
---|---|
void |
add(Cost cost)
Add all the terms of another Cost to this one. |
void |
add(double coefficient,
int power)
Add new term to cost expression: |
void |
add(int c)
Increment cost expression by constant: |
double |
calcCost(double x)
Return the cost based on value x. |
Cost |
copy()
Return a deep copy of this cost. |
void |
divide(double c)
Divide cost expression by constant: |
Cost |
getHighestOrderTerm()
Return the term with the highest exponent. |
boolean |
lessThan(Cost cost)
Return true if this cost is less than the specified cost. |
void |
multiply(Cost cost)
Multiply all the terms of this loop with the terms of the argument cost. |
void |
multiply(double mfactor)
Multiply cost expression by constant: |
void |
multiply(double coefficient,
int power)
Multiply cost expression by cost term: |
int |
order()
Return the order of the polynomial: the power of the largest non-zero term. |
void |
reset()
Set all terms to 0. |
void |
subtract(double coefficient,
int power)
Add new term to cost expression: |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cost()
public Cost(double coefficient, int power)
coefficient
- of the cost termpower
- of the cost termMethod Detail |
---|
public double calcCost(double x)
public void reset()
public void add(int c)
public void add(double coefficient, int power)
public void add(Cost cost)
public void subtract(double coefficient, int power)
public void multiply(double mfactor)
public void multiply(double coefficient, int power)
public void multiply(Cost cost)
public void divide(double c)
public int order()
public Cost getHighestOrderTerm()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean lessThan(Cost cost)
public Cost copy()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |