Skip to content

Commit

Permalink
remove std::vector usage and replace it with SGVector
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Sep 26, 2011
1 parent b1043b0 commit 13468eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/shogun/kernel/Kernel.h
Expand Up @@ -25,8 +25,6 @@
#include <shogun/kernel/KernelNormalizer.h>

#include <vector>
#include <set>
#include <string>

namespace shogun
{
Expand Down Expand Up @@ -247,18 +245,15 @@ class CKernel : public CSGObject
*
* @return the jth column of the kernel matrix
*/
virtual std::vector<float64_t> get_kernel_col(int32_t j)
virtual SGVector<float64_t> get_kernel_col(int32_t j)
{

std::vector<float64_t> col = std::vector<float64_t>(num_rhs);
SGVector<float64_t> col = SGVector<float64_t>(num_rhs);

for (int32_t i=0; i!=num_rhs; i++)
{
col[i] = kernel(i,j);
}

return col;

}


Expand All @@ -267,18 +262,14 @@ class CKernel : public CSGObject
*
* @return the ith row of the kernel matrix
*/
virtual std::vector<float64_t> get_kernel_row(int32_t i)
virtual SGVector<float64_t> get_kernel_row(int32_t i)
{

std::vector<float64_t> row = std::vector<float64_t>(num_lhs);
SGVector<float64_t> row = SGVector<float64_t>(num_lhs);

for (int32_t j=0; j!=num_lhs; j++)
{
row[j] = kernel(i,j);
}

return row;

}

/** get kernel matrix real
Expand Down Expand Up @@ -923,8 +914,8 @@ class CKernel : public CSGObject


#ifdef USE_SVMLIGHT
/**@ cache kernel evalutations to improve speed */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/**@ cache kernel evalutations to improve speed */
struct KERNEL_CACHE {
/** index */
int32_t *index;
Expand Down
1 change: 1 addition & 0 deletions src/shogun/kernel/MultitaskKernelMaskNormalizer.h
Expand Up @@ -13,6 +13,7 @@

#include <shogun/kernel/KernelNormalizer.h>
#include <shogun/kernel/Kernel.h>
#include <set>

namespace shogun
{
Expand Down

0 comments on commit 13468eb

Please sign in to comment.