# Finite Difference Matrix Generator

### Description

Generates a modified coefficient matrix (**M**-matrix) used in the finite difference method from the option inputs. See Tavella and Randall (2000) for more on the standard formulation of the **M**-matrix.

### Usage

1 |

### Arguments

`S` |
list containing the vectors of spatial grid points associated with each underlying. Vector sizes of underlying spatial grid points need not be equal. |

`rf` |
scalar; applicable risk-free rate (domestic risk-free rate). |

`q` |
vector; holding costs of the option's underlyings (dividends, foreign risk-free rates, etc.). |

`vol` |
vector; volatilities of the option's underlyings. |

`rho` |
matrix; correlation matrix of the option's underlyings. |

### Details

`matrixFDM`

first constructs the non-zero diagonals of the **M**-matrix and stores them as columns. The `bandSparse`

function from the Matrix package then constructs a sparse banded matrix from the columns of the previously contructed matrix. Spatial domain boundaries are calculated first-order inwards with second difference terms dropped, maintaining block tridiagonality.

### Value

`matrixFDM`

returns a `CsparseMatrix`

-class matrix used for timestepping in the finite difference method.

### Author(s)

Michael Eichenberger and Carlo Rosa

### References

Tavella, D., Randall, C., 2000. Pricing Financial Instruments: The Finite Difference Method. John Wiley & Sons, Inc., New York.

### Examples

1 2 3 4 5 6 7 8 |