#include <math.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
 
#include "input.h"
 
    const float sqrt05 = 
sqrt(0.5f);
 
    return 0.5f * 
erfc(-x * sqrt05);
 
}
 
    
    
 
    
    
    
    
    
 
    d1       = d1 + (R + (V * V) * 0.5) * T;
 
 
 
    C = S * cnd_d1 - (X * 
exp((-R) * T) * cnd_d2);
    P = X * 
exp((-R) * T) * (1 - cnd_d2) - (S * (1 - cnd_d1));
}
 
int main(int argc, char** argv) {
    try {
        int device = argc > 1 ? atoi(argv[1]) : 0;
 
        printf(
            "** ArrayFire Black-Scholes Example **\n"
            "**          by AccelerEyes         **\n\n");
 
 
        
        
 
        
        black_scholes(Cg, Pg, Sg, Xg, Rg, Vg, Tg);
        printf("Warming up done\n");
 
        int iter = 1000;
        for (int n = 50; n <= 500; n += 50) {
            
 
            
 
            for (int i = 0; i < iter; i++) {
                black_scholes(Cg, Pg, Sg, Xg, Rg, Vg, Tg);
            }
 
            printf("Input Data Size = %8d. Mean GPU Time: %0.6f ms\n",
                   (int)dims[0], 1000 * t);
        }
        fprintf(stderr, 
"%s\n", e.
what());
        throw;
    }
 
    return 0;
}
A multi dimensional data container.
dim4 dims() const
Get dimensions of the array.
Generic object that represents size and shape.
An ArrayFire exception class.
virtual const char * what() const
Returns an error message for the exception in a string format.
array erfc(const array &in)
C++ Interface to evaluate the complementary error function.
array exp(const array &in)
C++ Interface to evaluate the exponential.
array log(const array &in)
C++ Interface to evaluate the natural logarithm.
array sqrt(const array &in)
C++ Interface to evaluate the square root.
array & eval(array &a)
Evaluate an expression (nonblocking).
void setDevice(const int device)
Sets the current device.
void sync(const int device=-1)
Blocks until the device is finished processing.
array tile(const array &in, const unsigned x, const unsigned y=1, const unsigned z=1, const unsigned w=1)
C++ Interface to generate a tiled array.