1 #ifndef CHROMSIMMATRIX_H 2 #define CHROMSIMMATRIX_H 7 #include "similarityMatrix.h" 17 namespace SimilarityMatrix
23 T operator()(
const T& Left,
const T& Right)
const 26 return (Left + Right*Right);
31 double meanVecOfVec(
const std::vector<std::vector<double>>& vov);
34 double eucLenVecOfVec(
const std::vector<std::vector<double>>& vov);
39 std::vector<double> perSampleEucLenVecOfVec(
const std::vector<std::vector<double>>& vec);
42 std::vector<double> perSampleSqrSumVecOfVec(
const std::vector<std::vector<double>>& vec);
45 std::vector<double> perSampleMeanVecOfVec(
const std::vector<std::vector<double>>& vec);
48 std::vector<double> perSampleSumVecOfVec(
const std::vector<std::vector<double>>& vec);
54 void clamp(std::vector<double>& vec,
double minValue,
double maxValue);
60 std::vector<std::vector<double>>
L2NormalizeVecOfVec(
const std::vector<std::vector<double>>& d);
63 std::vector<std::vector<double>>
divideVecOfVec(
const std::vector<std::vector<double>>& vov,
double num);
69 void ElemWiseSumOuterProdMeanSub(
const std::vector<double>& d1,
const std::vector<double>& d2,
SimMatrix& s,
const std::vector<double>& mean1,
const std::vector<double>& mean2);
75 void ElemWiseOuterCosine(
const std::vector<double>& d1,
const std::vector<double>& d2,
const std::vector<double>& d1_mag,
const std::vector<double>& d2_mag,
SimMatrix& s);
78 void SumOuterProd(
const std::vector<std::vector<double>>& d1,
const std::vector<std::vector<double>>& d2,
const std::string Normalization,
SimMatrix& s);
81 void SumOuterCov(
const std::vector<std::vector<double>>& d1,
const std::vector<std::vector<double>>& d2,
const std::string Normalization,
SimMatrix& s);
84 void SumOuterCorr(
const std::vector<std::vector<double>>& d1,
const std::vector<std::vector<double>>& d2,
const std::string Normalization,
SimMatrix& s);
87 void SumOuterEucl(
const std::vector<std::vector<double>>& d1,
const std::vector<std::vector<double>>& d2,
const std::string Normalization,
SimMatrix& s);
90 void SumOuterCosine(
const std::vector<std::vector<double>>& d1,
const std::vector<std::vector<double>>& d2,
const std::string Normalization,
SimMatrix& s);
102 const std::string Normalization,
const std::string SimType,
double cosAngleThresh,
103 double dotProdThresh);
108 #endif // CHROMSIMMATRIX_H void ElemWiseSumOuterEucl(const std::vector< double > &d1, const std::vector< double > &d2, SimMatrix &s)
Adds outer prodict of (d1-d2)*(d1-d2) in similarity matrix s.
Definition: chromSimMatrix.cpp:137
std::vector< std::vector< double > > meanNormalizeVecOfVec(const std::vector< std::vector< double >> &vov)
Returns a vector of vector with values divided by the output of meanVecOfVec().
Definition: chromSimMatrix.cpp:90
void clamp(std::vector< double > &vec, double minValue, double maxValue)
Limits values between minValue and maxValue.
Definition: chromSimMatrix.cpp:85
void ElemWiseSumOuterProd(const std::vector< double > &d1, const std::vector< double > &d2, SimMatrix &s)
Adds outer prodict of d1 and d2 in similarity matrix s.
Definition: chromSimMatrix.cpp:113
std::vector< std::vector< double > > L2NormalizeVecOfVec(const std::vector< std::vector< double >> &vov)
Returns a vector of vector with values divided by the output of eucLenVecOfVec(). ...
Definition: chromSimMatrix.cpp:97
Generic namespace for all classes and functions of DIAlign.
Definition: affinealignment.cpp:29
void distToSim(SimMatrix &s, double offset, double Numerator)
Calculates distance as Distance = Numerator/(Similarity score + offset).
Definition: chromSimMatrix.cpp:79
void SumOuterCosine(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, SimMatrix &s)
Given Normalization modifies d1 and d2, and subsequently sums ElemWiseOuterCosine() of d1 vectors wit...
Definition: chromSimMatrix.cpp:293
void SumOuterProd(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, SimMatrix &s)
Given Normalization modifies d1 and d2, and subsequently sums ElemWiseSumOuterProd() of d1 vectors wi...
Definition: chromSimMatrix.cpp:163
void ElemWiseSumOuterProdMeanSub(const std::vector< double > &d1, const std::vector< double > &d2, SimMatrix &s, const std::vector< double > &mean1, const std::vector< double > &mean2)
Adds outer prodict of (d1-mean1) and (d2-mean2) in similarity matrix s.
Definition: chromSimMatrix.cpp:125
void ElemWiseOuterCosine(const std::vector< double > &d1, const std::vector< double > &d2, const std::vector< double > &d1_mag, const std::vector< double > &d2_mag, SimMatrix &s)
Adds outer prodict of cosAng(d1,d2) in similarity matrix s.
Definition: chromSimMatrix.cpp:149
void SumOuterCov(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, SimMatrix &s)
Given Normalization modifies d1 and d2, and subsequently sums ElemWiseSumOuterProdMeanSub() of d1 vec...
Definition: chromSimMatrix.cpp:189
Similarity matrix.
Definition: similarityMatrix.h:14
SimMatrix getSimilarityMatrix(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, const std::string SimType, double cosAngleThresh, double dotProdThresh)
Returns a similarity matrix between d1 and d2 vector of vectors.
Definition: chromSimMatrix.cpp:324
Calculates sum of previous result and square of current element (useful for sum of squares)...
Definition: chromSimMatrix.h:21
void SumOuterEucl(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, SimMatrix &s)
Given Normalization modifies d1 and d2, and subsequently sums ElemWiseSumOuterEucl() of d1 vectors wi...
Definition: chromSimMatrix.cpp:262
void SumOuterCorr(const std::vector< std::vector< double >> &d1, const std::vector< std::vector< double >> &d2, const std::string Normalization, SimMatrix &s)
Given Normalization modifies d1 and d2, and subsequently sums correlation coefficient of d1 vectors w...
Definition: chromSimMatrix.cpp:218
std::vector< std::vector< double > > divideVecOfVec(const std::vector< std::vector< double >> &d, double num)
Returns a vector of vector with values divided by num.
Definition: chromSimMatrix.cpp:105