/*
 * Academic License - for use in teaching, academic research, and meeting
 * course requirements at degree granting institutions only.  Not for
 * government, commercial, or other organizational use.
 *
 * unsafeSxfun.c
 *
 * Code generation for function 'unsafeSxfun'
 *
 */

/* Include files */
#include "unsafeSxfun.h"
#include "digital_option_price_cg_data.h"
#include "digital_option_price_cg_emxutil.h"
#include "digital_option_price_cg_types.h"
#include "rt_nonfinite.h"
#include "mwmathutil.h"

/* Variable Definitions */
static emlrtRTEInfo jd_emlrtRTEI = {
    113,                       /* lineNo */
    10,                        /* colNo */
    "digital_option_price_cg", /* fName */
    "/Users/lazarus/Dropbox/Work/Research/Ned/VolatilityFinance/"
    "ReplicationCodeManual/Code/Temp/Toolbox/digital_option_price_cg.m" /* pName
                                                                         */
};

/* Function Definitions */
void binary_expand_op_7(const emlrtStack *sp, emxArray_real_T *in1,
                        const emxArray_real_T *in3, const emxArray_real_T *in4)
{
  emxArray_real_T *b_in3;
  const real_T *in3_data;
  const real_T *in4_data;
  real_T *b_in3_data;
  real_T *in1_data;
  int32_T i;
  int32_T loop_ub;
  int32_T stride_0_0;
  int32_T stride_1_0;
  in4_data = in4->data;
  in3_data = in3->data;
  emlrtHeapReferenceStackEnterFcnR2012b((emlrtConstCTX)sp);
  emxInit_real_T(sp, &b_in3, 1, &jd_emlrtRTEI);
  if (in4->size[0] == 1) {
    loop_ub = in3->size[0];
  } else {
    loop_ub = in4->size[0];
  }
  i = b_in3->size[0];
  b_in3->size[0] = loop_ub;
  emxEnsureCapacity_real_T(sp, b_in3, i, &jd_emlrtRTEI);
  b_in3_data = b_in3->data;
  stride_0_0 = (in3->size[0] != 1);
  stride_1_0 = (in4->size[0] != 1);
  for (i = 0; i < loop_ub; i++) {
    b_in3_data[i] = in3_data[i * stride_0_0] * in4_data[i * stride_1_0];
  }
  i = in1->size[0];
  in1->size[0] = loop_ub;
  emxEnsureCapacity_real_T(sp, in1, i, &x_emlrtRTEI);
  in1_data = in1->data;
  for (i = 0; i < loop_ub; i++) {
    real_T varargin_1;
    varargin_1 = b_in3_data[i];
    in1_data[i] = muDoubleScalarMax(varargin_1, 0.0);
  }
  emxFree_real_T(sp, &b_in3);
  emlrtHeapReferenceStackLeaveFcnR2012b((emlrtConstCTX)sp);
}

/* End of code generation (unsafeSxfun.c) */
