6 #ifndef TAPKEE_DIFFUSIONMAP_H_ 7 #define TAPKEE_DIFFUSIONMAP_H_ 16 namespace tapkee_internal
35 template <
class RandomAccessIterator,
class DistanceCallback>
48 #pragma omp parallel shared(diffusion_matrix,begin,callback) default(none) 51 #pragma omp for nowait 52 for (i_index_iter=0; i_index_iter<n_vectors; ++i_index_iter)
54 for (j_index_iter=i_index_iter; j_index_iter<n_vectors; ++j_index_iter)
56 ScalarType k = callback.distance(begin[i_index_iter],begin[j_index_iter]);
58 diffusion_matrix(i_index_iter,j_index_iter) = gk;
59 diffusion_matrix(j_index_iter,i_index_iter) = gk;
64 p = diffusion_matrix.colwise().sum();
70 diffusion_matrix(i,j) /= p(i)*p(j);
73 p = diffusion_matrix.colwise().sum().cwiseSqrt();
77 diffusion_matrix(i,j) /= p(i)*p(j);
81 return diffusion_matrix;
double ScalarType
default scalar value (can be overrided with TAPKEE_CUSTOM_INTERNAL_NUMTYPE define) ...
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, 1 > DenseVector
dense vector type (non-overridable)
int IndexType
indexing type (non-overridable) set to int for compatibility with OpenMP 2.0
DenseSymmetricMatrix compute_diffusion_matrix(RandomAccessIterator begin, RandomAccessIterator end, DistanceCallback callback, const ScalarType width)
Computes diffusion process matrix. Uses the following algorithm:
tapkee::DenseMatrix DenseSymmetricMatrix
dense symmetric matrix (non-overridable, currently just dense matrix, can be improved later) ...