Permalink
Browse files

formatting

  • Loading branch information...
ypnos committed Sep 4, 2013
1 parent d07762d commit 7aae44693d543e49600917937402b5bc78880a15
Showing with 15 additions and 29 deletions.
  1. +0 −18 csparse/BuildSettings.txt
  2. +0 −2 edge_detect/edge_detection_config.cpp
  3. +8 −5 edge_detect/som.cpp
  4. +2 −1 edge_detect/som.h
  5. +5 −3 rgb/rgb.cpp
View
@@ -1,18 +0,0 @@
set(this_module_name "csparse")
set(this_unit_memberships "core")
set(this_build_library "vole_csparse")
set(this_module_variable "vole_CSparse")
set(this_module_description "A Concise Sparse Matrix Package in C (sc.fsu.edu)")
set(this_module_general_requirements)
VoleRequiredModules()
VoleCompileLibrary(
"cs_add.c" "cs_fkeep.c" "cs_multiply.c" "cs_tdfs.c"
"cs_amd.c" "cs_ipvec.c" "cs_permute.c" "cs_transpose.c"
"cs_compress.c" "cs_leaf.c" "cs_post.c" "cs_usolve.c"
"cs_counts.c" "cs_lsolve.c" "cs_reach.c" "cs_util.c"
"cs_cumsum.c" "cs_lu.c" "cs_scatter.c"
"cs_dfs.c" "cs_lusol.c" "cs_spsolve.c"
"cs_etree.c" "cs_malloc.c" "cs_sqr.c"
)
@@ -7,9 +7,7 @@ using namespace boost::program_options;
namespace vole {
#ifdef WITH_BOOST
ENUM_MAGIC(somtype)
#endif
EdgeDetectionConfig::EdgeDetectionConfig(const std::string& p)
: Config(p), similarity(prefix + "similarity")
View
@@ -58,6 +58,8 @@ SOM* SOM::createSOM(const vole::EdgeDetectionConfig &conf,
return new SOM3d(conf, data, meta);
case vole::SOM_CONE:
return new SOMCone(conf, data, meta);
default:
return 0;
}
}
@@ -121,13 +123,14 @@ void SOM::closestN(const multi_img::Pixel &inputVec,
// iterate over all neurons in grid
for (SOM::iterator neuron = begin(); neuron != end(); ++neuron) {
double dist = distfun->getSimilarity(*neuron, inputVec);
// compare current distance with the maximum of the N shortest found distances
/* compare current distance with the maximum of the N shortest
* found distances */
if (dist < heap[0].first) {
// remove max. value in heap
std::pop_heap(heap.begin(), heap.end(), sortpair);
// max element is now on position "back" and should be popped
// we overrite it directly with the new element
/* max element is now on position "back" and should be popped
* instead we overwrite it directly with the new element */
std::pair<double, SOM::iterator> &back = heap.back();
back.first = dist;
back.second = neuron;
@@ -140,8 +143,8 @@ void SOM::closestN(const multi_img::Pixel &inputVec,
std::sort_heap(heap.begin(), heap.end(), sortpair); // sort ascending
}
// fallback method that should be overwritten, but can be used as reference
// calculates the exp function for all neurons -> slow
/* fallback method that should be overwritten, but can be used as reference
* calculates the exp function for all neurons -> slow */
int SOM::updateNeighborhood(SOM::iterator &neuron,
const multi_img::Pixel &input,
double sigma, double learnRate)
View
@@ -216,7 +216,8 @@ class SOM
double getDistance() const { return itr->getDistance(); }
double getDistanceSquared() const { return itr->getDistanceSquared(); }
double getFakeGaussianWeight(double sigma) const { return itr->getFakeGaussianWeight(sigma); }
double getFakeGaussianWeight(double sigma) const
{ return itr->getFakeGaussianWeight(sigma); }
protected:
NeighbourIteratorBase *itr;
View
@@ -222,7 +222,7 @@ struct SOMTBB {
SOMTBB (const multi_img& src, SOM *som, const std::vector<double>& w,
cv::Mat3f &dst, cv::Mat1f &stddevs, cv::Mat3d &avg_coords)
: src(src), som(som), weight(w), dst(dst), stddevs(stddevs), avg_coords(avg_coords) { }
: src(src), som(som), weight(w), dst(dst), stddevs(stddevs), avg_coords(avg_coords) {}
void operator()(const tbb::blocked_range<int>& r) const
{
@@ -356,8 +356,10 @@ cv::Mat3f RGB::executeSOM(const multi_img &input_img, vole::ProgressObserver *po
/* each weight is half of the preceeding weight in the ranking
examples; N=2: 0.667, 0.333; N=4: 0.533, 0.267, 0.133, 0.067 */
double normalization = (double)((1 << N) - 1); // 2^N - 1
for (int i = 0; i < N; ++i)
weights.push_back((double)(1 << (N - i - 1)) / normalization); // (2^[N-1..0]) / normalization
for (int i = 0; i < N; ++i) {
// (2^[N-1..0]) / normalization
weights.push_back((double)(1 << (N - i - 1)) / normalization);
}
}
cv::Mat1f stddevs;

0 comments on commit 7aae446

Please sign in to comment.