Documentation>C API
Functions
svmdataset.c File Reference

SVM Dataset - Definition. More...

`#include "svmdataset.h"`
`#include <string.h>`
`#include <math.h>`
`#include "svmdataset.c"`
`#include "float.th"`

## Functions

VlSvmDataset * | vl_svmdataset_new (vl_type dataType, void *data, vl_size dimension, vl_size numData)
| Create a new object wrapping a dataset.
void | vl_svmdataset_delete (VlSvmDataset *self)
| Delete the object.
void * | vl_svmdataset_get_data (VlSvmDataset const *self)
| Get the wrapped data.
vl_size | vl_svmdataset_get_num_data (VlSvmDataset const *self)
| Get the number of wrapped data elements.
vl_size | vl_svmdataset_get_dimension (VlSvmDataset const *self)
| Get the dimension of the wrapped data.
VlHomogeneousKernelMap * | vl_svmdataset_get_homogeneous_kernel_map (VlSvmDataset const *self)
| Get the homogeneous kernel map object.
void | vl_svmdataset_set_homogeneous_kernel_map (VlSvmDataset *self, VlHomogeneousKernelMap *hom)
| Set the homogeneous kernel map object.
VlSvmAccumulateFunction | vl_svmdataset_get_accumulate_function (VlSvmDataset const *self)
| Get the accumulate function.
VlSvmInnerProductFunction | vl_svmdataset_get_inner_product_function (VlSvmDataset const *self)
| Get the inner product function.

## Detailed Description

Author
  Daniele Perrone
  Andrea Vedaldi

## Function Documentation

## ◆ vl_svmdataset_delete()

void vl_svmdataset_delete | ( | VlSvmDataset * | self | ) |

Parameters

  self | object to delete.

The function frees the resources allocated by vl_svmdataset_new(). Notice that the wrapped data will not be freed as it is not owned by the object.

## ◆ vl_svmdataset_get_accumulate_function()

VlSvmAccumulateFunction vl_svmdataset_get_accumulate_function | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  a pointer to the accumulate function to use with this data.

## ◆ vl_svmdataset_get_data()

void * vl_svmdataset_get_data | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  a pointer to the wrapped data.

## ◆ vl_svmdataset_get_dimension()

vl_size vl_svmdataset_get_dimension | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  dimension of the wrapped data.

## ◆ vl_svmdataset_get_homogeneous_kernel_map()

VlHomogeneousKernelMap * vl_svmdataset_get_homogeneous_kernel_map | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  homogenoeus kernel map object (or `NULL` if any).

## ◆ vl_svmdataset_get_inner_product_function()

VlSvmInnerProductFunction vl_svmdataset_get_inner_product_function | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  a pointer to the inner product function to use with this data.

## ◆ vl_svmdataset_get_num_data()

vl_size vl_svmdataset_get_num_data | ( | VlSvmDataset const * | self | ) |

Parameters

  self | object.

Returns
  number of wrapped data elements.

## ◆ vl_svmdataset_new()

VlSvmDataset * vl_svmdataset_new | ( | vl_type | dataType,
|  | void * | data,
|  | vl_size | dimension,
|  | vl_size | numData )

Parameters

  dataType | of data (`float` and `double` supported).
  data | pointer to the data.
  dimension | the dimension of a data vector.
  numData | number of wrapped data vectors.

Returns
  new object.

The function allocates and returns a new SVM dataset object wrapping the data pointed by data. Note that no copy is made of data, so the caller should keep the data allocated as the object exists.

See also
  vl_svmdataset_delete

## ◆ vl_svmdataset_set_homogeneous_kernel_map()

void vl_svmdataset_set_homogeneous_kernel_map | ( | VlSvmDataset * | self,
|  | VlHomogeneousKernelMap * | hom )

Parameters

  self | object.
  hom | homogeneous kernel map object to use.

After changing the kernel map, the inner product and accumulator function should be queried again (vl_svmdataset_get_inner_product_function adn vl_svmdataset_get_accumulate_function).

Set this to `NULL` to avoid using a kernel map.

Note that this does not transfer the ownership of the object to the function. Furthermore, VlSvmDataset holds to the object until it is destroyed or the object is replaced or removed by calling this function again.