Learn R Programming

LSMonteCarlo (version 1.0)

firstValueRow: Returning the first >0 value in each row of a matrix

Description

Technical function implemented in the pricing functions of the package. It returns the first >0 value in each row of a matrix and assign zero to all subsequent values.

Usage

firstValueRow(x)

Arguments

x
A matrix.

Value

A matrix.

See Also

Functions: AmerPutLSM, AmerPutLSM_AV, AmerPutLSM_CV, AsianAmerPutLSM, QuantoAmerPutLSM, and QuantoAmerPutLSM_AV.

Examples

Run this code
mat<-matrix(c(0,0,2,0,4,0,3,0,1,9,8,7), ncol=4)
mat
firstValueRow(mat)

Run the code above in your browser using DataLab