Esempio n. 1
0
        public static double[] ComputeDistanceDiffusion(int originVertexIndex,
                                                        double parameterT,
                                                        Eigen eigens)
        {
            double[] diffusionDistance = new double[eigens.EigenVectorSize];
            for (int i = 0; i < diffusionDistance.Length; i++)
            {
                diffusionDistance[i] = 0;
            }
            double optParamterT = parameterT / (2 * eigens.GetEigenValue(1));

            for (int i = 1; i < eigens.Count; i++)
            {
                EigenPair     pair        = eigens.SortedEigens[i];
                double        eigenValue  = pair.EigenValue;
                List <double> eigenVector = pair.EigenVector;
                for (int j = 0; j < eigenVector.Count; j++)
                {
                    double orig = eigenVector[originVertexIndex];
                    double y    = eigenVector[j];
                    double res  = orig - y;
                    diffusionDistance[j] += Math.Exp(-2 * optParamterT * eigenValue)
                                            * (res * res);
                }
            }
            for (int i = 0; i < diffusionDistance.Length; i++)
            {
                diffusionDistance[i] = Math.Sqrt(diffusionDistance[i]);
            }
            return(diffusionDistance);
        }
Esempio n. 2
0
 public static double[] ComputeDistanceDiffusion(int originVertexIndex, 
                                                 double parameterT, 
                                                 Eigen eigens)
 {
     double[] diffusionDistance = new double[eigens.EigenVectorSize];
     for (int i = 0; i < diffusionDistance.Length; i++)
     {
         diffusionDistance[i] = 0;
     }
     double optParamterT =parameterT / (2 * eigens.GetEigenValue(1));
     for (int i = 1; i < eigens.Count; i++)
     {
         EigenPair pair = eigens.SortedEigens[i];
         double eigenValue = pair.EigenValue;
         List<double> eigenVector = pair.EigenVector;                          
         for (int j = 0; j < eigenVector.Count; j++)
         {
             double orig = eigenVector[originVertexIndex];
             double y = eigenVector[j];
             double res = orig - y;
             diffusionDistance[j] += Math.Exp(-2 * optParamterT * eigenValue) 
                                     * (res * res);                  
         }
                   
     }
     for (int i = 0; i < diffusionDistance.Length; i++)
     {
         diffusionDistance[i] = Math.Sqrt(diffusionDistance[i]);    
     }
     return diffusionDistance;
 }
Esempio n. 3
0
        private void InitEigenValue(Eigen eigen)
        {
            this.dataGridViewEigenValue.Rows.Clear();

            for (int i = 0; i < eigen.Count; i++)
            {
                this.dataGridViewEigenValue.Rows.Add(i.ToString(), eigen.GetEigenValue(i).ToString());
            }
        }
Esempio n. 4
0
        private void InitEigenValue(Eigen eigen)
        {
            this.dataGridViewEigenValue.Rows.Clear();

            for (int i = 0; i < eigen.Count; i++)
            {
                this.dataGridViewEigenValue.Rows.Add(i.ToString(), eigen.GetEigenValue(i).ToString());
            }
        }