예제 #1
0
 public static void normalize(complex[,] v)
 {
     for (int i = 0; i < v.GetLength(1); i++)
     {
         double length = 0;
         for (int j = 0; j < v.GetLength(0); j++)
         {
             length += v[j, i].real * v[j, i].real;
         }
         length = Math.Sqrt(length);
         for (int j = 0; j < v.GetLength(0); j++)
         {
             v[j, i].real = v[j, i].real / length;
         }
     }
 }
예제 #2
0
 public static double[][,] getEigenFaces(complex[,] eigenVector, double[][,] difFace)
 {
     double[][,] eFaces = new double[eigenVector.GetLength(1)][, ];
     for (int m = 0; m < eigenVector.GetLength(1); m++)
     {
         eFaces[m] = new double[difFace[0].GetLength(0), difFace[0].GetLength(1)];
         for (int k = 0; k < eigenVector.GetLength(0); k++)
         {
             for (int i = 0; i < difFace[k].GetLength(0); i++)
             {
                 for (int j = 0; j < difFace[k].GetLength(1); j++)
                 {
                     eFaces[m][i, j] += difFace[k][i, j] * eigenVector[m, k].real;
                 }
             }
         }
     }
     return(eFaces);
 }