American-transaction costs 1.0.0.0 American option pricer under proportional transaction costs

- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

Functions
piecewiselinear.cpp File Reference
`#include "piecewiselinear.h"`
`#include "../config.h"`
`#include <iostream>`

## Functions
coefficient | crossing (const Line &line, const PiecewiseLinear &function, const coefficient x, const int direction)
PiecewiseLinear | maximum (PiecewiseLinear &first, PiecewiseLinear &second)
ostream & | operator<< (ostream &output, const PiecewiseLinear &line)
void | print_convex_conjugate (const PiecewiseLinear &line)
void | untangle_maximum (const PiecewiseLinear &f, const vector< PiecewiseLinear > &g, const coefficient y, coefficient &w, vector< coefficient > &p, vector< coefficient > &x)

## Detailed Description

Implementation of class and utility functions in piecewiselinear.h.

## Function Documentation

coefficient crossing | ( | const Line & | line,
|  | const PiecewiseLinear & | function,
|  | const coefficient | x,
|  | const int | direction
| ) |  |

Finds a crossing point between line and function, starting at x and searching in the given direction. Returns NAN if it cannot be found. Intersections between lines and piecewise linear functions are not necessarily unique, and by no means guaranteed.

PiecewiseLinear maximum | ( | PiecewiseLinear & | first,
|  | PiecewiseLinear & | second
| ) |  |

Maximum of two piecewise linear functions. The original functions are not touched, the absence of const is for technical reasons. It is safe to assign the returned function to either of the functions that was passed as a parameter.

Parameters:

  first | The first function
  second | The second function

ostream& operator<< | ( | ostream & | output,
|  | const PiecewiseLinear & | line
| ) |  |

Outputs line in format that can be copied and pasted into Gnuplot (http://www.gnuplot.info/).

void print_convex_conjugate | ( | const PiecewiseLinear & | line | ) |

Computes and prints convex conjugate of line.

void untangle_maximum | ( | const PiecewiseLinear & | f,
|  | const std::vector< PiecewiseLinear > & | g,
|  | const coefficient | y,
|  | coefficient & | w,
|  | std::vector< coefficient > & | p,
|  | std::vector< coefficient > & | x
| ) |  |

Service method. Suppose given a function f that is the maximum of convex functions (not checked) and a number y such that for some number w, where superscripts and refer to left and right derivatives. This function returns this number w, numbers in the interval together with numbers such that , , and for all . Any input value for w is considered as a first guess for w (but this input value is checked for correctness).

All Classes Namespaces Files Functions Variables Typedefs Defines