6 #ifndef TAPKEE_DiffusionMapS_H_
7 #define TAPKEE_DiffusionMapS_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();
69 diffusion_matrix(i,j) /= pow(p(i)*p(j),timesteps);
72 p = diffusion_matrix.colwise().sum().cwiseSqrt();
76 diffusion_matrix(i,j) /= p(i)*p(j);
80 return diffusion_matrix;
double ScalarType
default scalar value (can be overrided with TAPKEE_CUSTOM_INTERNAL_NUMTYPE define) ...
DenseSymmetricMatrix compute_diffusion_matrix(RandomAccessIterator begin, RandomAccessIterator end, DistanceCallback callback, const IndexType timesteps, const ScalarType width)
Computes diffusion process matrix. Uses the following algorithm:
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
tapkee::DenseMatrix DenseSymmetricMatrix
dense symmetric matrix (non-overridable, currently just dense matrix, can be improved later) ...