Skip to content

Commit

Permalink
Improved arpack and LLE
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jan 26, 2012
1 parent 33cebea commit 4347344
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/shogun/converter/LocallyLinearEmbedding.cpp
Expand Up @@ -226,12 +226,17 @@ CFeatures* CLocallyLinearEmbedding::apply(CFeatures* features)

// construct weight matrix
SG_DEBUG("Constructing weight matrix\n");
CTime* time = new CTime();
SGMatrix<float64_t> weight_matrix = construct_weight_matrix(simple_features,W_matrix,neighborhood_matrix);
SG_DEBUG("Weight matrix construction took %.5fs\n", time->cur_time_diff());
neighborhood_matrix.destroy_matrix();

// find null space of weight matrix
SG_DEBUG("Finding nullspace\n");
time->start();
SGMatrix<float64_t> new_feature_matrix = construct_embedding(weight_matrix,m_target_dim);
SG_DEBUG("Eigenproblem solving took %.5fs\n", time->cur_time_diff());
delete time;
weight_matrix.destroy_matrix();

SG_UNREF(features);
Expand Down Expand Up @@ -415,6 +420,7 @@ SGMatrix<float64_t> CLocallyLinearEmbedding::construct_embedding(SGMatrix<float6
#ifdef HAVE_ARPACK
arpack_dsxupd(matrix.matrix,NULL,false,N,dimension+1,"LA",true,3,true,false,m_nullspace_shift,0.0,
eigenvalues_vector,matrix.matrix,eigenproblem_status);
matrix.num_rows = dimension+1;
#endif
if (eigenproblem_status)
SG_ERROR("ARPACK failed with code: %d", eigenproblem_status);
Expand Down
8 changes: 6 additions & 2 deletions src/shogun/mathematics/arpack.cpp
Expand Up @@ -108,7 +108,7 @@ void arpack_dsxupd(double* matrix, double* rhs, bool is_rhs_diag, int n, int nev
double* workl = SG_MALLOC(double, lworkl);

// init info holding status (1 means that residual vector is provided initially)
int info = 1;
int info = 0;

// which eigenpairs to find
char* which_ = strdup(which);
Expand Down Expand Up @@ -201,8 +201,12 @@ void arpack_dsxupd(double* matrix, double* rhs, bool is_rhs_diag, int n, int nev

// initialize options
set_default_options(&options);
options.Equil = YES;
//options.Equil = YES;
//options.SymmetricMode = YES;

options.SymmetricMode = YES;
options.ColPerm = MMD_AT_PLUS_A;
options.DiagPivotThresh = 0.001;
StatInit(&stat);

// factorize
Expand Down

0 comments on commit 4347344

Please sign in to comment.