void VineCopulaStructureSelect(int type, double *Structure, double *Families, double *Rotations, std::vector<double>& Thetas, double *U, int d, unsigned int n, int StructuringRule, double *familyset, int m)
{
    std::vector<double> bounds(120);
    LoadDefaultBounds(&bounds[0]);
    VineCopulaStructureSelect(&bounds[0],type,Structure,Families,Rotations,Thetas,U,d,n,StructuringRule,familyset,m);
    
    return;
}
// FunctionID 106: VineStructureSelect
void VineStructureSelect(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
//declare variables
    double *U, *familyset, *families, *rotations, *Thetas, *structure, *structuringrule, *bounds;
    double *Type;
    int type, m, StructuringRule;
    unsigned int n;
    int i, d;
    

//figure out dimensions
    n = (unsigned int)mxGetM(prhs[3]);
    d = (int)mxGetN(prhs[3]);
    
//associate inputs
    bounds = mxGetPr(prhs[1]);
    Type = mxGetPr(prhs[2]);
    type = (int) *Type;
    U = mxGetPr(prhs[3]);
    structuringrule = mxGetPr(prhs[4]);
    StructuringRule = (int) *structuringrule;
    m = (int)mxGetM(prhs[5]);
    familyset = mxGetPr(prhs[5]);
    
    std::vector<double> thetas;
    
//associate outputs
    plhs[0] = mxCreateDoubleMatrix(1,d,mxREAL);
    structure = mxGetPr(plhs[0]);
    plhs[1] = mxCreateDoubleMatrix(1,d*(d-1)/2,mxREAL);
    families = mxGetPr(plhs[1]);
    plhs[2] = mxCreateDoubleMatrix(1,d*(d-1)/2,mxREAL);
    rotations = mxGetPr(plhs[2]);
    
    VineCopulaStructureSelect(bounds,type, structure, families, rotations, thetas, U, d, n, StructuringRule, familyset, m);
    
    int NumbParams = thetas.size();
    plhs[3] = mxCreateDoubleMatrix(1,NumbParams,mxREAL);
    Thetas = mxGetPr(plhs[3]);
    
    for (i=0;i<NumbParams;i++)
        Thetas[i] = thetas[i];
    
    return;
    
}