Skip to content

Commit

Permalink
Improved memory usage efficiency in DR preprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Sep 25, 2011
1 parent 3f81b07 commit 134f863
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/shogun/preprocessor/HessianLocallyLinearEmbedding.cpp
Expand Up @@ -120,10 +120,10 @@ SGMatrix<float64_t> CHessianLocallyLinearEmbedding::apply_to_feature_matrix(CFea
m_distance->init(simple_features,simple_features);
SGMatrix<float64_t> distance_matrix = m_distance->get_distance_matrix();
SGMatrix<int32_t> neighborhood_matrix = get_neighborhood_matrix(distance_matrix);
distance_matrix.destroy_matrix();

// init W (weight) matrix
float64_t* W_matrix = SG_CALLOC(float64_t, N*N);
float64_t* W_matrix = distance_matrix.matrix;
memset(W_matrix,0,sizeof(float64_t)*N*N);

#ifdef HAVE_PTHREAD
int32_t num_threads = parallel->get_num_threads();
Expand Down
3 changes: 2 additions & 1 deletion src/shogun/preprocessor/KernelLocallyLinearEmbedding.cpp
Expand Up @@ -141,7 +141,8 @@ SGMatrix<float64_t> CKernelLocallyLinearEmbedding::apply_to_feature_matrix(CFeat
m_kernel->cleanup();

// init W (weight) matrix
float64_t* W_matrix = SG_CALLOC(float64_t, N*N);
float64_t* W_matrix = kernel_matrix.matrix;
memset(W_matrix,0,sizeof(float64_t)*N*N);

#ifdef HAVE_PTHREAD
int32_t num_threads = parallel->get_num_threads();
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/preprocessor/LocalTangentSpaceAlignment.cpp
Expand Up @@ -115,10 +115,10 @@ SGMatrix<float64_t> CLocalTangentSpaceAlignment::apply_to_feature_matrix(CFeatur
m_distance->init(simple_features,simple_features);
SGMatrix<float64_t> distance_matrix = m_distance->get_distance_matrix();
SGMatrix<int32_t> neighborhood_matrix = get_neighborhood_matrix(distance_matrix);
distance_matrix.destroy_matrix();

// init W (weight) matrix
float64_t* W_matrix = SG_CALLOC(float64_t, N*N);
float64_t* W_matrix = distance_matrix.matrix;
memset(W_matrix,0,sizeof(float64_t)*N*N);

#ifdef HAVE_PTHREAD
int32_t num_threads = parallel->get_num_threads();
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/preprocessor/LocallyLinearEmbedding.cpp
Expand Up @@ -158,10 +158,10 @@ SGMatrix<float64_t> CLocallyLinearEmbedding::apply_to_feature_matrix(CFeatures*
// dimension detection
if (m_target_dim == AUTO_TARGET_DIM)
m_target_dim = detect_dim(distance_matrix);
distance_matrix.destroy_matrix();

// init W (weight) matrix
float64_t* W_matrix = SG_CALLOC(float64_t, N*N);
float64_t* W_matrix = distance_matrix.matrix;
memset(W_matrix,0,sizeof(float64_t)*N*N);

#ifdef HAVE_PTHREAD
int32_t num_threads = parallel->get_num_threads();
Expand Down

0 comments on commit 134f863

Please sign in to comment.