/*
 * This file was generated automatically by ExtUtils::ParseXS version 2.18 from the
 * contents of SVMLight.xs. Do not edit this file, edit SVMLight.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST! 
 *
 */

#line 1 "lib/Algorithm/SVMLight.xs"
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif

/* Standard system headers: */
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>

/* Stuff from the SVM Light source: */
/* #include "kernel.h" */
#include "svm_common.h"
#include "svm_learn.h"


#define INITIAL_DOCS 8
#define EXPANSION_FACTOR 2.0

typedef struct {
  long num_features;
  long num_docs;
  long allocated_docs;
  DOC **docs;
  double *labels;
} corpus;

SV **
self_store(SV *self, void *ptr, const char *slot, int make_readonly) {
  HV *self_hash = (HV*) SvRV(self);
  SV **fetched = hv_fetch(self_hash, slot, strlen(slot), 1);
  if (fetched == NULL) croak("Couldn't create the %s slot in $self", slot);
  
  sv_setiv(*fetched, (IV) ptr);
  if (make_readonly) SvREADONLY_on(*fetched);
  return fetched;
}

void *
self_fetch(SV *self, const char *slot) {
  HV *self_hash = (HV*) SvRV(self);
  SV **fetched = hv_fetch(self_hash, slot, strlen(slot), 0);
  if (fetched == NULL) croak("Couldn't fetch the %s slot in $self", slot);

  return (void *) SvIV(*fetched);
}

/* Extract the '_corpus' structure out of $self */
corpus *get_corpus (SV *self) {
  return (corpus *) self_fetch(self, "_corpus");
}

/* Convert a SV* containing an arrayref into an AV* */
AV *unpack_aref(SV *input_rv, char *name) {
  if ( !SvROK(input_rv) || SvTYPE(SvRV(input_rv)) != SVt_PVAV ) {
    croak("Argument '%s' must be array reference", name);
  }
  
  return (AV*) SvRV(input_rv);
}

WORD *create_word_array(AV *indices_av, AV *values_av, int *num_words) {
  WORD *words;
  SV **fetched;
  int j, n;

  n = av_len(indices_av)+1;
  if (num_words)
    *num_words = n;

  /* Get the data from the two parallel arrays and put into *words array */
  if (n != av_len(values_av)+1)
    croak("Different number of entries in indices & values arrays");
  
  New(id, words, n+1, WORD);
  for (j=0; j<n; j++) {
    fetched = av_fetch(indices_av, j, 0);
    if (fetched == NULL)
      croak("Missing index for element number %d", j);
    words[j].wnum = SvIV(*fetched);

    if (words[j].wnum <= 0)
      croak("Feature indices must be positive integers");

    if (j>0 && words[j-1].wnum >= words[j].wnum)
      croak("Feature indices must be in strictly increasing order");
    
    fetched = av_fetch(values_av, j, 0);
    if (fetched == NULL)
      croak("Missing value for element number %d", j);
    words[j].weight = (FVAL) SvNV(*fetched);
  }
  words[n].wnum = 0;
  words[n].weight = 0.0;

  return words;
}



#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#line 123 "lib/Algorithm/SVMLight.c"

XS(XS_Algorithm__SVMLight__xs_init); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight__xs_init)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::_xs_init", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
#line 116 "lib/Algorithm/SVMLight.xs"
{
  /* Initializes data structures that will be used in the lifetime of $self */
  corpus *c;
  LEARN_PARM *learn_parm;
  KERNEL_PARM *kernel_parm;

  /* Initialize the corpus */
  New(id, c, 1, corpus);

  c->num_features = 0;
  c->num_docs = 0;
  New(id, c->docs, INITIAL_DOCS, DOC*);
  New(id, c->labels, INITIAL_DOCS, double);
  c->allocated_docs = INITIAL_DOCS;

  self_store(self, c, "_corpus", 1);

  New(id, learn_parm, 1, LEARN_PARM);
  New(id, kernel_parm, 1, KERNEL_PARM);

  self_store(self, learn_parm, "_learn_parm", 1);
  self_store(self, kernel_parm, "_kernel_parm", 1);

  set_learning_defaults(learn_parm, kernel_parm);
  check_learning_parms(learn_parm, kernel_parm);
}
#line 165 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_add_instance_i); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_add_instance_i)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items < 5 || items > 8)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::add_instance_i", "self, label, name, indices, values, query_id= 0, slack_id= 0, cost_factor= 1.0");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	label = (double)SvNV(ST(1));
	char *	name = (char *)SvPV_nolen(ST(2));
	SV *	indices = ST(3);
	SV *	values = ST(4);
	long	query_id;
	long	slack_id;
	double	cost_factor;

	if (items < 6)
	    query_id = 0;
	else {
	    query_id = (long)SvIV(ST(5));
	}

	if (items < 7)
	    slack_id = 0;
	else {
	    slack_id = (long)SvIV(ST(6));
	}

	if (items < 8)
	    cost_factor = 1.0;
	else {
	    cost_factor = (double)SvNV(ST(7));
	}
#line 147 "lib/Algorithm/SVMLight.xs"
{
  corpus *c = get_corpus(self);
  AV *indices_av = unpack_aref(indices, "indices");
  AV  *values_av = unpack_aref( values,  "values");
  WORD *words;
  int num_words;

  words = create_word_array(indices_av, values_av, &num_words);

  if (words[num_words-1].wnum > c->num_features)
    c->num_features = words[num_words-1].wnum;


  /* Check whether we need to allocate more slots for documents */
  if (c->num_docs >= c->allocated_docs) {
    c->allocated_docs *= EXPANSION_FACTOR;
    Renew(c->docs, c->allocated_docs, DOC*);
    if (!(c->docs)) croak("Couldn't allocate more array space for documents");
    Renew(c->labels, c->allocated_docs, double);
    if (!(c->labels)) croak("Couldn't allocate more array space for document labels");
  }

  c->labels[ c->num_docs ] = label;

  c->docs[ c->num_docs ] = create_example( c->num_docs,
					   query_id,
					   slack_id,
					   cost_factor,
					   create_svector(words, name, 1.0) );
  c->num_docs++;
}
#line 241 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_read_instances); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_read_instances)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::read_instances", "self, docfile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	docfile = (char *)SvPV_nolen(ST(1));
#line 182 "lib/Algorithm/SVMLight.xs"
{
  corpus *c = get_corpus(self);
  Safefree(c->docs);
  Safefree(c->labels);
  read_documents(docfile, &(c->docs), &(c->labels), &(c->num_features), &(c->num_docs));
}
#line 268 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_train); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_train)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::train", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
#line 192 "lib/Algorithm/SVMLight.xs"
{
  corpus *c = get_corpus(self);
  MODEL *model;
  double *alpha_in=NULL;
  KERNEL_CACHE *kernel_cache;
  KERNEL_PARM *kernel_parm = (KERNEL_PARM*) self_fetch(self, "_kernel_parm");
  LEARN_PARM *learn_parm = (LEARN_PARM*) self_fetch(self, "_learn_parm");

  /* XXX may need to "restart" alpha_in */

  if(kernel_parm->kernel_type == LINEAR) { /* don't need the cache */
    kernel_cache=NULL;
  } else {
    kernel_cache=kernel_cache_init(c->num_docs, learn_parm->kernel_cache_size);
  }

  New(id, model, 1, MODEL);

  switch (learn_parm->type) {
  case CLASSIFICATION:
    svm_learn_classification(c->docs, c->labels, c->num_docs, c->num_features, learn_parm,
                             kernel_parm,kernel_cache,model,alpha_in);
    break;
  case REGRESSION:
    svm_learn_regression(c->docs, c->labels, c->num_docs, c->num_features, learn_parm,
                         kernel_parm,&kernel_cache,model);
    break;
  case RANKING:
    svm_learn_ranking(c->docs, c->labels, c->num_docs, c->num_features, learn_parm,
                      kernel_parm,&kernel_cache,model);
    break;
  case OPTIMIZATION:
    svm_learn_optimization(c->docs, c->labels, c->num_docs, c->num_features, learn_parm,
                           kernel_parm,kernel_cache,model,alpha_in);
    break;
  default:
    croak("Unkown learning type '%d'", learn_parm->type);
  }

  if (model->kernel_parm.kernel_type == 0) { /* linear kernel */
    /* compute weight vector */
    add_weight_vector_to_linear_model(model);
  }

  /* free(alpha_in); */

  if(kernel_cache) {
    /* Free the memory used for the cache. */
    kernel_cache_cleanup(kernel_cache);
  }

  /* Since the model contains references to the training documents, we
   * can't free up space by freeing the documents.  We could revisit
   * this in a future release if memory becomes tight.
   */

  self_store(self, model, "_model", 1);
}
#line 346 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_predict_i); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_predict_i)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 3)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::predict_i", "self, indices, values");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
	SV *	indices = ST(1);
	SV *	values = ST(2);
#line 254 "lib/Algorithm/SVMLight.xs"
{
  MODEL *model = (MODEL*) self_fetch(self, "_model");
  AV *indices_av = unpack_aref(indices, "indices");
  AV  *values_av = unpack_aref( values,  "values");

  WORD *words = create_word_array(indices_av, values_av, NULL);
  DOC *d = create_example(-1, 0, 0, 0.0, create_svector(words, "", 1.0));

  double dist = (model->kernel_parm.kernel_type == 0
		 ? classify_example_linear(model, d)
		 : classify_example(model, d));

  RETVAL = dist;
}
#line 384 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight__write_model); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight__write_model)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::_write_model", "self, modelfile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	modelfile = (char *)SvPV_nolen(ST(1));
#line 274 "lib/Algorithm/SVMLight.xs"
{
  MODEL *m = (MODEL*) self_fetch(self, "_model");
  write_model(modelfile, m);
}
#line 410 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_linear_weights); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_linear_weights)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_linear_weights", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	RETVAL;
	SV *	self = ST(0);
#line 282 "lib/Algorithm/SVMLight.xs"
{
  MODEL *m;
  int i;
  AV *result;

  if (!hv_exists((HV*) SvRV(self), "_model", 6))
    croak("Model has not yet been trained");

  m = (MODEL*) self_fetch(self, "_model");
  if (m->kernel_parm.kernel_type != 0)
    croak("Kernel type is not linear");

  result = newAV();
  av_push(result, newSVnv(m->b));

  for (i=1; i<m->totwords+1; i++) {
    av_push(result, newSVnv(m->lin_weights[i]));
  }

  RETVAL = newRV_noinc(result);
}
#line 452 "lib/Algorithm/SVMLight.c"
	ST(0) = RETVAL;
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight__read_model); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight__read_model)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::_read_model", "self, modelfile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	modelfile = (char *)SvPV_nolen(ST(1));
#line 309 "lib/Algorithm/SVMLight.xs"
{
  MODEL *m = read_model(modelfile);
  corpus *c = get_corpus(self);

  if (m->kernel_parm.kernel_type == 0) { /* linear kernel */
    /* compute weight vector - it's not stored in the model file */
    add_weight_vector_to_linear_model(m);
  }

  self_store(self, m, "_model", 1);

  /* Fetch a little training info from the model struct */
  c->num_docs = m->totdoc;
  c->num_features = m->totwords;

  /* No actual documents are stored in our corpus - free the memory
     now so DESTROY doesn't get confused later. */
  Safefree(c->docs);
  c->docs = NULL;
}
#line 495 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_num_features); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_num_features)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::num_features", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	int	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 334 "lib/Algorithm/SVMLight.xs"
  RETVAL = (get_corpus(self))->num_features;
#line 518 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_num_instances); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_num_instances)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::num_instances", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	int	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 341 "lib/Algorithm/SVMLight.xs"
  RETVAL = (get_corpus(self))->num_docs;
#line 542 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_DESTROY)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::DESTROY", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
#line 349 "lib/Algorithm/SVMLight.xs"
{
  corpus *c = get_corpus(self);
  MODEL *m;
  int i;

  HV *self_hash = (HV*) SvRV(self);

  if (hv_exists(self_hash, "_model", strlen("_model"))) {
    m = (MODEL*) self_fetch(self, "_model");
    free_model(m, 0);
  }

  if (c->docs != NULL) {
    for(i=0;i<c->num_docs;i++)
      free_example(c->docs[i],1);

    Safefree(c->docs);
  }

  Safefree(c->labels);
  Safefree(c);
}
#line 585 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


/* INCLUDE:  Including 'param_set.c' from 'SVMLight.xs' */


XS(XS_Algorithm__SVMLight_set_biased_hyperplane); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_biased_hyperplane)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_biased_hyperplane", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 4 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->biased_hyperplane = val;
#line 610 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_biased_hyperplane); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_biased_hyperplane)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_biased_hyperplane", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 9 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->biased_hyperplane;
#line 633 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_compute_loo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_compute_loo)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_compute_loo", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 16 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->compute_loo = val;
#line 656 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_compute_loo); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_compute_loo)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_compute_loo", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 21 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->compute_loo;
#line 679 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_eps); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_eps)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_eps", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 28 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->eps = val;
#line 702 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_eps); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_eps)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_eps", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 33 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->eps;
#line 725 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_epsilon_crit); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_epsilon_crit)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_epsilon_crit", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 40 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->epsilon_crit = val;
#line 748 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_epsilon_crit); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_epsilon_crit)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_epsilon_crit", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 45 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->epsilon_crit;
#line 771 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_epsilon_shrink); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_epsilon_shrink)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_epsilon_shrink", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 52 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->epsilon_shrink = val;
#line 794 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_epsilon_shrink); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_epsilon_shrink)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_epsilon_shrink", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 57 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->epsilon_shrink;
#line 817 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_kernel_cache_size); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_kernel_cache_size)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_kernel_cache_size", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 64 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->kernel_cache_size = val;
#line 840 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_kernel_cache_size); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_kernel_cache_size)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_kernel_cache_size", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 69 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->kernel_cache_size;
#line 863 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_maxiter); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_maxiter)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_maxiter", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 76 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->maxiter = val;
#line 886 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_maxiter); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_maxiter)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_maxiter", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 81 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->maxiter;
#line 909 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_remove_inconsistent); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_remove_inconsistent)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_remove_inconsistent", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 88 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->remove_inconsistent = val;
#line 932 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_remove_inconsistent); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_remove_inconsistent)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_remove_inconsistent", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 93 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->remove_inconsistent;
#line 955 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_rho); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_rho)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_rho", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 100 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->rho = val;
#line 978 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_rho); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_rho)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_rho", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 105 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->rho;
#line 1001 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_sharedslack); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_sharedslack)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_sharedslack", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 112 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->sharedslack = val;
#line 1024 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_sharedslack); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_sharedslack)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_sharedslack", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 117 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->sharedslack;
#line 1047 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_skip_final_opt_check); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_skip_final_opt_check)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_skip_final_opt_check", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 124 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->skip_final_opt_check = val;
#line 1070 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_skip_final_opt_check); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_skip_final_opt_check)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_skip_final_opt_check", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 129 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->skip_final_opt_check;
#line 1093 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_svm_c); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_svm_c)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_svm_c", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 136 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_c = val;
#line 1116 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_svm_c); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_svm_c)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_svm_c", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 141 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_c;
#line 1139 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_svm_costratio); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_svm_costratio)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_svm_costratio", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 148 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_costratio = val;
#line 1162 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_svm_costratio); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_svm_costratio)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_svm_costratio", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 153 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_costratio;
#line 1185 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_svm_iter_to_shrink); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_svm_iter_to_shrink)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_svm_iter_to_shrink", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 160 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_iter_to_shrink = val;
#line 1208 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_svm_iter_to_shrink); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_svm_iter_to_shrink)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_svm_iter_to_shrink", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 165 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_iter_to_shrink;
#line 1231 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_svm_maxqpsize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_svm_maxqpsize)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_svm_maxqpsize", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 172 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_maxqpsize = val;
#line 1254 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_svm_maxqpsize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_svm_maxqpsize)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_svm_maxqpsize", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 177 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_maxqpsize;
#line 1277 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_svm_newvarsinqp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_svm_newvarsinqp)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_svm_newvarsinqp", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 184 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_newvarsinqp = val;
#line 1300 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_svm_newvarsinqp); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_svm_newvarsinqp)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_svm_newvarsinqp", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 189 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->svm_newvarsinqp;
#line 1323 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_transduction_posratio); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_transduction_posratio)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_transduction_posratio", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 196 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->transduction_posratio = val;
#line 1346 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_transduction_posratio); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_transduction_posratio)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_transduction_posratio", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 201 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->transduction_posratio;
#line 1369 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_type); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_type)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_type", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 208 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->type = val;
#line 1392 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_type); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_type)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_type", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 213 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->type;
#line 1415 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_xa_depth); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_xa_depth)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_xa_depth", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 220 "param_set.c"
  ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->xa_depth = val;
#line 1438 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_xa_depth); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_xa_depth)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_xa_depth", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 225 "param_set.c"
  RETVAL = ((LEARN_PARM*) self_fetch(self, "_learn_parm"))->xa_depth;
#line 1461 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_coef_const); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_coef_const)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_coef_const", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 232 "param_set.c"
  ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->coef_const = val;
#line 1484 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_coef_const); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_coef_const)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_coef_const", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 237 "param_set.c"
  RETVAL = ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->coef_const;
#line 1507 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_coef_lin); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_coef_lin)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_coef_lin", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 244 "param_set.c"
  ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->coef_lin = val;
#line 1530 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_coef_lin); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_coef_lin)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_coef_lin", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 249 "param_set.c"
  RETVAL = ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->coef_lin;
#line 1553 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_kernel_type); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_kernel_type)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_kernel_type", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 256 "param_set.c"
  ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->kernel_type = val;
#line 1576 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_kernel_type); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_kernel_type)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_kernel_type", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 261 "param_set.c"
  RETVAL = ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->kernel_type;
#line 1599 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_poly_degree); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_poly_degree)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_poly_degree", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	long	val = (long)SvIV(ST(1));
#line 268 "param_set.c"
  ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->poly_degree = val;
#line 1622 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_poly_degree); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_poly_degree)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_poly_degree", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	long	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 273 "param_set.c"
  RETVAL = ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->poly_degree;
#line 1645 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_rbf_gamma); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_rbf_gamma)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_rbf_gamma", "self, val");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	double	val = (double)SvNV(ST(1));
#line 280 "param_set.c"
  ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->rbf_gamma = val;
#line 1668 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_get_rbf_gamma); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_get_rbf_gamma)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::get_rbf_gamma", "self");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	double	RETVAL;
	dXSTARG;
	SV *	self = ST(0);
#line 285 "param_set.c"
  RETVAL = ((KERNEL_PARM*) self_fetch(self, "_kernel_parm"))->rbf_gamma;
#line 1691 "lib/Algorithm/SVMLight.c"
	XSprePUSH; PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS(XS_Algorithm__SVMLight_set_predfile); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_predfile)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_predfile", "self, predfile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	predfile = (char *)SvPV_nolen(ST(1));
#line 294 "param_set.c"
  LEARN_PARM *learn_parm = (LEARN_PARM*) self_fetch(self, "_learn_parm");
  strncpy(learn_parm->predfile, predfile, sizeof(learn_parm->predfile)-1);
  learn_parm->predfile[sizeof(learn_parm->predfile)-1] = '\0';
#line 1716 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_set_alphafile); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_alphafile)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_alphafile", "self, alphafile");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	alphafile = (char *)SvPV_nolen(ST(1));
#line 301 "param_set.c"
  LEARN_PARM *learn_parm = (LEARN_PARM*) self_fetch(self, "_learn_parm");
  strncpy(learn_parm->alphafile, alphafile, sizeof(learn_parm->alphafile)-1);
  learn_parm->alphafile[sizeof(learn_parm->alphafile)-1] = '\0';
#line 1740 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Algorithm__SVMLight_set_custom); /* prototype to pass -Wmissing-prototypes */
XS(XS_Algorithm__SVMLight_set_custom)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    if (items != 2)
       Perl_croak(aTHX_ "Usage: %s(%s)", "Algorithm::SVMLight::set_custom", "self, custom");
    PERL_UNUSED_VAR(cv); /* -W */
    {
	SV *	self = ST(0);
	char *	custom = (char *)SvPV_nolen(ST(1));
#line 308 "param_set.c"
  KERNEL_PARM *kernel_parm = (KERNEL_PARM*) self_fetch(self, "_kernel_parm");
  strncpy(kernel_parm->custom, custom, sizeof(kernel_parm->custom)-1);
  kernel_parm->custom[sizeof(kernel_parm->custom)-1] = '\0';
#line 1764 "lib/Algorithm/SVMLight.c"
    }
    XSRETURN_EMPTY;
}


/* INCLUDE: Returning to 'SVMLight.xs' from 'param_set.c' */

#ifdef __cplusplus
extern "C"
#endif
XS(boot_Algorithm__SVMLight); /* prototype to pass -Wmissing-prototypes */
XS(boot_Algorithm__SVMLight)
{
#ifdef dVAR
    dVAR; dXSARGS;
#else
    dXSARGS;
#endif
    char* file = __FILE__;

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
    XS_VERSION_BOOTCHECK ;

        newXSproto("Algorithm::SVMLight::_xs_init", XS_Algorithm__SVMLight__xs_init, file, "$");
        newXSproto("Algorithm::SVMLight::add_instance_i", XS_Algorithm__SVMLight_add_instance_i, file, "$$$$$;$$$");
        newXSproto("Algorithm::SVMLight::read_instances", XS_Algorithm__SVMLight_read_instances, file, "$$");
        newXSproto("Algorithm::SVMLight::train", XS_Algorithm__SVMLight_train, file, "$");
        newXSproto("Algorithm::SVMLight::predict_i", XS_Algorithm__SVMLight_predict_i, file, "$$$");
        newXSproto("Algorithm::SVMLight::_write_model", XS_Algorithm__SVMLight__write_model, file, "$$");
        newXSproto("Algorithm::SVMLight::get_linear_weights", XS_Algorithm__SVMLight_get_linear_weights, file, "$");
        newXSproto("Algorithm::SVMLight::_read_model", XS_Algorithm__SVMLight__read_model, file, "$$");
        newXSproto("Algorithm::SVMLight::num_features", XS_Algorithm__SVMLight_num_features, file, "$");
        newXSproto("Algorithm::SVMLight::num_instances", XS_Algorithm__SVMLight_num_instances, file, "$");
        newXSproto("Algorithm::SVMLight::DESTROY", XS_Algorithm__SVMLight_DESTROY, file, "$");
        newXSproto("Algorithm::SVMLight::set_biased_hyperplane", XS_Algorithm__SVMLight_set_biased_hyperplane, file, "$$");
        newXSproto("Algorithm::SVMLight::get_biased_hyperplane", XS_Algorithm__SVMLight_get_biased_hyperplane, file, "$");
        newXSproto("Algorithm::SVMLight::set_compute_loo", XS_Algorithm__SVMLight_set_compute_loo, file, "$$");
        newXSproto("Algorithm::SVMLight::get_compute_loo", XS_Algorithm__SVMLight_get_compute_loo, file, "$");
        newXSproto("Algorithm::SVMLight::set_eps", XS_Algorithm__SVMLight_set_eps, file, "$$");
        newXSproto("Algorithm::SVMLight::get_eps", XS_Algorithm__SVMLight_get_eps, file, "$");
        newXSproto("Algorithm::SVMLight::set_epsilon_crit", XS_Algorithm__SVMLight_set_epsilon_crit, file, "$$");
        newXSproto("Algorithm::SVMLight::get_epsilon_crit", XS_Algorithm__SVMLight_get_epsilon_crit, file, "$");
        newXSproto("Algorithm::SVMLight::set_epsilon_shrink", XS_Algorithm__SVMLight_set_epsilon_shrink, file, "$$");
        newXSproto("Algorithm::SVMLight::get_epsilon_shrink", XS_Algorithm__SVMLight_get_epsilon_shrink, file, "$");
        newXSproto("Algorithm::SVMLight::set_kernel_cache_size", XS_Algorithm__SVMLight_set_kernel_cache_size, file, "$$");
        newXSproto("Algorithm::SVMLight::get_kernel_cache_size", XS_Algorithm__SVMLight_get_kernel_cache_size, file, "$");
        newXSproto("Algorithm::SVMLight::set_maxiter", XS_Algorithm__SVMLight_set_maxiter, file, "$$");
        newXSproto("Algorithm::SVMLight::get_maxiter", XS_Algorithm__SVMLight_get_maxiter, file, "$");
        newXSproto("Algorithm::SVMLight::set_remove_inconsistent", XS_Algorithm__SVMLight_set_remove_inconsistent, file, "$$");
        newXSproto("Algorithm::SVMLight::get_remove_inconsistent", XS_Algorithm__SVMLight_get_remove_inconsistent, file, "$");
        newXSproto("Algorithm::SVMLight::set_rho", XS_Algorithm__SVMLight_set_rho, file, "$$");
        newXSproto("Algorithm::SVMLight::get_rho", XS_Algorithm__SVMLight_get_rho, file, "$");
        newXSproto("Algorithm::SVMLight::set_sharedslack", XS_Algorithm__SVMLight_set_sharedslack, file, "$$");
        newXSproto("Algorithm::SVMLight::get_sharedslack", XS_Algorithm__SVMLight_get_sharedslack, file, "$");
        newXSproto("Algorithm::SVMLight::set_skip_final_opt_check", XS_Algorithm__SVMLight_set_skip_final_opt_check, file, "$$");
        newXSproto("Algorithm::SVMLight::get_skip_final_opt_check", XS_Algorithm__SVMLight_get_skip_final_opt_check, file, "$");
        newXSproto("Algorithm::SVMLight::set_svm_c", XS_Algorithm__SVMLight_set_svm_c, file, "$$");
        newXSproto("Algorithm::SVMLight::get_svm_c", XS_Algorithm__SVMLight_get_svm_c, file, "$");
        newXSproto("Algorithm::SVMLight::set_svm_costratio", XS_Algorithm__SVMLight_set_svm_costratio, file, "$$");
        newXSproto("Algorithm::SVMLight::get_svm_costratio", XS_Algorithm__SVMLight_get_svm_costratio, file, "$");
        newXSproto("Algorithm::SVMLight::set_svm_iter_to_shrink", XS_Algorithm__SVMLight_set_svm_iter_to_shrink, file, "$$");
        newXSproto("Algorithm::SVMLight::get_svm_iter_to_shrink", XS_Algorithm__SVMLight_get_svm_iter_to_shrink, file, "$");
        newXSproto("Algorithm::SVMLight::set_svm_maxqpsize", XS_Algorithm__SVMLight_set_svm_maxqpsize, file, "$$");
        newXSproto("Algorithm::SVMLight::get_svm_maxqpsize", XS_Algorithm__SVMLight_get_svm_maxqpsize, file, "$");
        newXSproto("Algorithm::SVMLight::set_svm_newvarsinqp", XS_Algorithm__SVMLight_set_svm_newvarsinqp, file, "$$");
        newXSproto("Algorithm::SVMLight::get_svm_newvarsinqp", XS_Algorithm__SVMLight_get_svm_newvarsinqp, file, "$");
        newXSproto("Algorithm::SVMLight::set_transduction_posratio", XS_Algorithm__SVMLight_set_transduction_posratio, file, "$$");
        newXSproto("Algorithm::SVMLight::get_transduction_posratio", XS_Algorithm__SVMLight_get_transduction_posratio, file, "$");
        newXSproto("Algorithm::SVMLight::set_type", XS_Algorithm__SVMLight_set_type, file, "$$");
        newXSproto("Algorithm::SVMLight::get_type", XS_Algorithm__SVMLight_get_type, file, "$");
        newXSproto("Algorithm::SVMLight::set_xa_depth", XS_Algorithm__SVMLight_set_xa_depth, file, "$$");
        newXSproto("Algorithm::SVMLight::get_xa_depth", XS_Algorithm__SVMLight_get_xa_depth, file, "$");
        newXSproto("Algorithm::SVMLight::set_coef_const", XS_Algorithm__SVMLight_set_coef_const, file, "$$");
        newXSproto("Algorithm::SVMLight::get_coef_const", XS_Algorithm__SVMLight_get_coef_const, file, "$");
        newXSproto("Algorithm::SVMLight::set_coef_lin", XS_Algorithm__SVMLight_set_coef_lin, file, "$$");
        newXSproto("Algorithm::SVMLight::get_coef_lin", XS_Algorithm__SVMLight_get_coef_lin, file, "$");
        newXSproto("Algorithm::SVMLight::set_kernel_type", XS_Algorithm__SVMLight_set_kernel_type, file, "$$");
        newXSproto("Algorithm::SVMLight::get_kernel_type", XS_Algorithm__SVMLight_get_kernel_type, file, "$");
        newXSproto("Algorithm::SVMLight::set_poly_degree", XS_Algorithm__SVMLight_set_poly_degree, file, "$$");
        newXSproto("Algorithm::SVMLight::get_poly_degree", XS_Algorithm__SVMLight_get_poly_degree, file, "$");
        newXSproto("Algorithm::SVMLight::set_rbf_gamma", XS_Algorithm__SVMLight_set_rbf_gamma, file, "$$");
        newXSproto("Algorithm::SVMLight::get_rbf_gamma", XS_Algorithm__SVMLight_get_rbf_gamma, file, "$");
        newXSproto("Algorithm::SVMLight::set_predfile", XS_Algorithm__SVMLight_set_predfile, file, "$$");
        newXSproto("Algorithm::SVMLight::set_alphafile", XS_Algorithm__SVMLight_set_alphafile, file, "$$");
        newXSproto("Algorithm::SVMLight::set_custom", XS_Algorithm__SVMLight_set_custom, file, "$$");
    XSRETURN_YES;
}



syntax highlighted by Code2HTML, v. 0.9.1