Assembla home | Assembla project page
 

Changeset 215

Show
Ignore:
Timestamp:
06/23/08 05:48:37 (5 months ago)
Author:
snovik
Message:

Change: QL 15108

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/QLNet/QLNet/Methods/montecarlo/montecarlomodel.cs

    r194 r215  
    9292                double price = pathPricer_.value(path.value); 
    9393 
    94                 if (isControlVariate_) 
     94                if (isControlVariate_) { 
    9595                    if (cvPathGenerator_ == null) { 
    96                         price += cvOptionValue_-cvPathPricer_.value(path.value); 
     96                        price += cvOptionValue_ - cvPathPricer_.value(path.value); 
     97                    } else { 
     98                        Sample<Path> cvPath = cvPathGenerator_.next(); 
     99                        price += cvOptionValue_ - cvPathPricer_.value(cvPath.value); 
    97100                    } 
    98                     else { 
    99                         Sample<Path> cvPath = cvPathGenerator_.next(); 
    100                         price += cvOptionValue_-cvPathPricer_.value(cvPath.value); 
    101                     } 
     101                } 
    102102 
    103103                if (isAntitheticVariate_) { 
    104104                    path = pathGenerator_.antithetic(); 
    105105                    double price2 = pathPricer_.value(path.value); 
    106                     if (isControlVariate_) 
     106                    if (isControlVariate_) { 
    107107                        if (cvPathGenerator_ == null) 
    108                             price2 += cvOptionValue_-cvPathPricer_.value(path.value); 
     108                            price2 += cvOptionValue_ - cvPathPricer_.value(path.value); 
    109109                        else { 
    110110                            Sample<Path> cvPath = cvPathGenerator_.antithetic(); 
    111                             price2 += cvOptionValue_-cvPathPricer_.value(cvPath.value); 
     111                            price2 += cvOptionValue_ - cvPathPricer_.value(cvPath.value); 
    112112                        } 
     113                    } 
    113114 
    114115                    sampleAccumulator_.add((price+price2)/2.0, path.weight);