Skip to content

Instantly share code, notes, and snippets.

View cderivan's full-sized avatar

Clebson Drivan cderivan

View GitHub Profile
#include <R.h>
#include <Rmath.h>
#include <Rinternals.h>
SEXP BSput (SEXP S, SEXP X, SEXP b, SEXP r, SEXP t, SEXP v)
{
/* possible add vectorization to this to make it faster, though
the R code is plenty fast enough */
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#endif
package main
import (
"fmt"
"log"
"net/http"
"encoding/json"
)
type test_struct struct {
@cderivan
cderivan / greeks.cpp
Created October 5, 2015 17:08
Calculating the greeks
#include <stdio.h>
#include <math.h>
const double Pi = 3.14159265359;
// Standard Normal probability density function
// Normal PDF(x) = exp(-x*x/2)/{sigma * sqrt(2 * Pi) }
double Normal_PDF(const double & x) {
return (1.0/(double)pow(2 * Pi, 0.5)) * exp(-0.5 * x * x);
}