GenSVM
Functions
gensvm_zv.c File Reference

Functions for computing the ZV matrix product. More...

#include "gensvm_zv.h"
Include dependency graph for gensvm_zv.c:

Go to the source code of this file.

Functions

void gensvm_calculate_ZV (struct GenModel *model, struct GenData *data, double *ZV)
 Wrapper around sparse/dense versions of this function. More...
 
void gensvm_calculate_ZV_sparse (struct GenModel *model, struct GenData *data, double *ZV)
 Compute the product Z*V for when Z is a sparse matrix. More...
 
void gensvm_calculate_ZV_dense (struct GenModel *model, struct GenData *data, double *ZV)
 Compute the product Z*V for when Z is a dense matrix. More...
 

Detailed Description

Functions for computing the ZV matrix product.

Author
G.J.J. van den Burg
Date
2016-10-17

This file exists because the product Z*V of two matrices occurs both in the computation of the loss function and for predicting class labels. Moreover, a distinction has to be made between dense Z matrices and sparse Z matrices, hence a seperate file is warranted.

This file is part of GenSVM.

GenSVM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GenSVM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GenSVM. If not, see http://www.gnu.org/licenses/.

Definition in file gensvm_zv.c.

Function Documentation

◆ gensvm_calculate_ZV()

void gensvm_calculate_ZV ( struct GenModel model,
struct GenData data,
double *  ZV 
)

Wrapper around sparse/dense versions of this function.

This function tests if the data is stored in dense format or sparse format by testing if GenData::Z is NULL or not, and calls the corresponding version of this function accordingly.

See also
gensvm_calculate_ZV_dense(), gensvm_calculate_ZV_sparse()
Parameters
[in]modela GenModel instance holding the model
[in]dataa GenData instance with the data
[out]ZVa pre-allocated matrix of appropriate dimensions

Definition at line 50 of file gensvm_zv.c.

Here is the call graph for this function:

◆ gensvm_calculate_ZV_dense()

void gensvm_calculate_ZV_dense ( struct GenModel model,
struct GenData data,
double *  ZV 
)

Compute the product Z*V for when Z is a dense matrix.

This function uses cblas_dgemm() to compute the matrix product between Z and V.

Parameters
[in]modela GenModel instance holding the model
[in]dataa GenData instance with the data
[out]ZVa pre-allocated matrix of appropriate dimensions

Definition at line 108 of file gensvm_zv.c.

◆ gensvm_calculate_ZV_sparse()

void gensvm_calculate_ZV_sparse ( struct GenModel model,
struct GenData data,
double *  ZV 
)

Compute the product Z*V for when Z is a sparse matrix.

This is a simple sparse-dense matrix multiplication, which uses cblas_daxpy() for each nonzero element of Z, to compute Z*V.

Parameters
[in]modela GenModel instance holding the model
[in]dataa GenData instance with the data
[out]ZVa pre-allocated matrix of appropriate dimensions

Definition at line 70 of file gensvm_zv.c.