You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: training.m
    path of file: ./repos/CanlabCore/CanlabCore/External/spider/clust/@one_class_svm
    
    the code of the file until where you have to start completion: function [d,a] =  training(a,d)

disp(['training ' get_name(a) '.... '])

switch a.optimizer

    case {'andre_c'}

        K=train(a.child,d); K=K.X;  % calc kernel
        m=length(K);
        alpha = quadsolve(K,-ones(m,1),[],0,a.C);
        a.alpha=alpha;
        a.b0=0;
        a.Xsv=d;

    case {'quadprog_c'}

        K=train(a.child,d); K=K.X;  % calc kernel
        m=length(K);
        opts=optimset('LargeScale','off');
        [alpha,fval,exitflag,output,lambda]=quadprog(K,-ones(m,1),[],[],[],[],zeros(m,1),ones(m,1)*a.C,[],opts);
        a.alpha=alpha;
        a.b0=0;
        a.Xsv=d;

    case {'quadprog'}

        K=train(a.child,d); K=K.X;  % calc kernel

    
function [d,a] =  training(a,d)

disp(['training ' get_name(a) '.... '])

switch a.optimizer

    case {'andre_c'}

        K=train(a.child,d); K=K.X;  % calc kernel
        m=length(K);
        alpha = quadsolve(K,-ones(m,1),[],0,a.C);
        a.alpha=alpha;
        a.b0=0;
        a.Xsv=d;

    case {'quadprog_c'}

        K=train(a.child,d); K=K.X;  % calc kernel
        m=length(K);
        opts=optimset('LargeScale','off');
        [alpha,fval,exitflag,output,lambda]=quadprog(K,-ones(m,1),[],[],[],[],zeros(m,1),ones(m,1)*a.C,[],opts);
        a.alpha=alpha;
        a.b0=0;
        a.Xsv=d;

    case {'quadprog'}

        K=train(a.child,d); K=K.X;  % calc kernel
        m=length(K);
        opts=optimset('LargeScale','off');
        [alpha,fval,exitflag,output,lambda]=quadprog(K,zeros(m,1),[],[],ones(1,m),1,zeros(m,1),ones(m,1)/(a.nu*m),[],opts);
        a.alpha=alpha;
        a.b0=lambda.eqlin;
        a.Xsv=d;

    case {'andre'}
        error('Not implemented yet');


    case {'libsvm'}

        %% default values for libsvm
        cachesize = 40;
        eps=1e-5; p=0.00001; shrinking=1;
        gamma=1;
        C=1;
        svm_type = 2;
        degree = 0;
        coef0 = 0;
        nu = a.nu;
        kertmp = a.child;
        if strcmp(kertmp.ker,'linear')
            kernelType = 0;
        end