-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
88 lines (79 loc) · 3.1 KB
/
Program.cs
File metadata and controls
88 lines (79 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ShefferMultioperationRank4
{
/// <summary>
/// Entry point class
/// </summary>
class Program1
{
/// <summary>
/// Main function
/// </summary>
/// <param name="args"></param>
private static void Main(string[] args)
{
// generate all multioperations of rank 4 (count = 2^16 = 65536)
var gen6 = (from a in Enumerable.Range(1, 2)
from b in Enumerable.Range(1, 64)
from c in Enumerable.Range(1, 64)
from d in Enumerable.Range(1, 64)
from e in Enumerable.Range(1, 64)
from f in Enumerable.Range(1, 64)
select new Multioperation6(a, b, c, d, e, f)).ToArray();
// contents multioperation f and number of elements
// in corresponging algebra of unary multioperations
//var results = new ConcurrentBag<Tuple<Multioperation4, int>>();
//var finished = new bool[1] { false };
//var thread = new Thread((obj) =>
//{
// var fin = (bool[])obj;
// using (var file = new FileStream("ops.txt", FileMode.Append, FileAccess.Write, FileShare.Read))
// using (var wr = new StreamWriter(file))
// {
// while (!fin[0])
// {
// Tuple<Multioperation4, int> tpl;
// while (results.TryTake(out tpl))
// {
// wr.WriteLine(tpl);
// Console.Out.WriteLine("Tuple = {0}, count = ", tpl.Item1, tpl.Item2);
// }
// wr.Flush();
// //Thread.Sleep(500);
// }
// }
//});
//thread.Priority = ThreadPriority.BelowNormal;
//thread.Start(finished);
//Parallel.ForEach(gen4, new ParallelOptions() { MaxDegreeOfParallelism = 8 }, op =>
//{
// var opCnt = ArrSet4.CheckOp4Arr(op);
// results.Add(new Tuple<Multioperation4, int>(op, opCnt));
//});
//finished[0] = true;
//Console.ReadKey();
Dictionary<Multioperation6, Multioperation6> dict = new Dictionary<Multioperation6, Multioperation6>();
int count = 0;
foreach (Multioperation6 op in gen6)
{
//if (dict.ContainsKey(op)) {
// continue;
//}
var isFirst = ArrSet6.IsFirstType(op);
if (isFirst)
{
count++;
//dict[!op] = op;
Console.WriteLine("{0}", op);
}
}
Console.WriteLine("{0}", count);
return;
}
}
}