alphas_full[sv_idx] = alphas

    alphas_full = alphas_full * y

    print "svmlight objective:", svm.get_objective()
    print "svmlight alphas:", numpy.array(alphas_full[0:5])

    external_objective = 0.0

    for j in xrange(N):

        external_objective += alphas_full[j] * f[j]

        for k in xrange(N):

            external_objective += 0.5 * alphas_full[j] * alphas_full[k] * y[j] * y[k] * wdk.kernel(j,k)

    print "svmlight external objective:", external_objective




    #precompute kernel matrix using shogun
    K = wdk.get_kernel_matrix()
    K = numpy.transpose(y.flatten() * (K*y.flatten()).transpose())

    C = 1.0
    # Important!! QP does not accept ndarray as a type, it must be an array
    p = QP(K, f, Aeq=y, beq=0, lb=numpy.zeros(N), ub=C*numpy.ones(N))
    r = p.solve('cvxopt_qp', iprint = 0)