Ejemplo n.º 1
0
 public static void FastAdd(BinaryVector acumalator, BinaryVector addent)
 {
     for (int idx = 0; idx < acumalator.data.Length; idx++)
     {
         acumalator.data[idx] ^= addent.data[idx];
     }
 }
Ejemplo n.º 2
0
        static void printarr(BinaryVector[] arr)
        {
            int rowLength = arr.Length;
            int colLength = 1;

            for (int i = 0; i < rowLength; i++)
            {
                if (!Object.ReferenceEquals(arr[i], null))
                {
                    colLength = arr[i].Length;
                    for (int j = 0; j < colLength; j++)
                    {
                        Console.Write(string.Format("{0} ", arr[i][j]));
                    }
                }
                else
                {

                    for (int j = 0; j < colLength; j++)
                    {
                        Console.Write(string.Format("{0} ", 0));
                    }
                }
                Console.WriteLine();
            }
        }
Ejemplo n.º 3
0
 public static void Gaussian(SolveRequest solvereq)
 {
     for (int i = 0; i < Math.Min(solvereq.B, solvereq.L); i++)
     {
         if (solvereq.Coefficients[i][i] == 0)
         {
             for (int j = i + 1; j < solvereq.B; j++)
             {
                 if (solvereq.Coefficients[j][i] == 1)
                 {
                     BinaryVector tmp = solvereq.Coefficients[j];
                     solvereq.Coefficients[j] = solvereq.Coefficients[i];
                     solvereq.Coefficients[i] = tmp;
                     break;
                 }
             }
         }
         if (solvereq.Coefficients[i][i] == 1)
         {
             solvereq.FirstFree = i;
             for (int j = 0; j < solvereq.B; j++)
             {
                 if (j != i)
                 {
                     if (solvereq.Coefficients[j][i] == 1)
                     {
                         BinaryVector.FastAdd(solvereq.Coefficients[j], solvereq.Coefficients[i]);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        public static void FastFill(bit bit, BinaryVector vector)
        {
            long fill = 0;

            if (bit == bit.ONE)
            {
                fill = ~fill;
            }
            for (int idx = 0; idx < vector.data.Length; idx++)
            {
                vector.data[idx] = fill;
            }
        }
Ejemplo n.º 5
0
 public static void FastFill(bit bit, BinaryVector vector)
 {
     long fill = 0;
     if (bit == bit.ONE)
     {
         fill = ~fill;
     }
     for (int idx = 0; idx < vector.data.Length; idx++)
     {
         vector.data[idx] = fill;
     }
 }
Ejemplo n.º 6
0
 public static void FastAdd(BinaryVector acumalator, BinaryVector addent)
 {
     for (int idx = 0; idx < acumalator.data.Length; idx++)
     {
         acumalator.data[idx] ^= acumalator.data[idx];
     }
 }