American-transaction costs 1.0.0.0
American option pricer under proportional transaction costs
|
Straight line in two dimensions. More...
#include <line.h>
Public Member Functions | |
void | check () |
coefficient | intercept () const |
Line (const coefficient slope, const coefficient intercept) | |
void | negate () |
coefficient | operator() (const coefficient x) const |
Line & | operator*= (const coefficient value) |
void | shift (const coefficient x, const coefficient y) |
coefficient | slope () const |
void | swivel (const coefficient slope, const coefficient x) |
Straight line in two dimensions.
The line follows the equation y = slope()x + intercept().
Line::Line | ( | const coefficient | slope, |
const coefficient | intercept | ||
) | [inline] |
Constructor.
void Line::check | ( | ) | [inline] |
Checks whether slope or intercept is zero.
coefficient Line::intercept | ( | ) | const [inline] |
Intercept with vertical axis.
void Line::negate | ( | ) | [inline] |
Negates both slope() and intersection().
coefficient Line::operator() | ( | const coefficient | x | ) | const [inline] |
Value of line for given horizontal value x.
Line & Line::operator*= | ( | const coefficient | value | ) | [inline] |
Multiplies both slope() and intercept() by value.
void Line::shift | ( | const coefficient | x, |
const coefficient | y | ||
) | [inline] |
Shifts line.
x | Number of units to shift to the right (to the left if negative) |
y | Number of units to shift upwards (downwards if negative) |
coefficient Line::slope | ( | ) | const [inline] |
Slope of line.
void Line::swivel | ( | const coefficient | slope, |
const coefficient | x | ||
) | [inline] |
Adjust line to have slope slope, while leaving its value in x unchanged.
slope | New slope |
x | Point at which value of function should be left unchanged. |