Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d8c9707

Browse files
Initial Commit
1 parent 760cd40 commit d8c9707

File tree

79 files changed

+24433
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+24433
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp1.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
9+
</ItemGroup>
10+
11+
</Project>

‎NanoQuantum.Core/QCode.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace NanoQuantum.Core
7+
{
8+
public class QCode
9+
{
10+
public string name = "";
11+
public string qasm = "";
12+
public string codeType = "QASM2";
13+
14+
public string deviceRunType = "simulator";
15+
public int shots = 1;
16+
public int seed = 1;
17+
18+
19+
public QCode(int coinUnderShellNumber)
20+
{
21+
//5 qubits and 5 classical registers
22+
string preCode = "include \"qelib1.inc\";qreg q[5];creg c[5];";
23+
24+
//everything starting at the "double Hadamard"
25+
string postControlledNot = @"h q[1];
26+
h q[2];
27+
x q[1];
28+
x q[2];
29+
h q[2];
30+
cx q[1], q[2];
31+
h q[2];
32+
x q[1];
33+
x q[2];
34+
h q[1];
35+
h q[2];
36+
measure q[1] -> c[1];
37+
measure q[2] -> c[2];";
38+
39+
string initCode = "";
40+
switch (coinUnderShellNumber)
41+
{
42+
43+
case 1: //#State=00
44+
initCode = @"h q[1];
45+
h q[2];
46+
s q[1];
47+
s q[2];
48+
h q[2];
49+
cx q[1],q[2];
50+
h q[2];
51+
s q[1];
52+
s q[2];
53+
";
54+
break;
55+
case 2: //#State=01
56+
initCode = @"h q[1];
57+
h q[2];
58+
s q[2];
59+
h q[2];
60+
cx q[1],q[2];
61+
h q[2];
62+
s q[2];";
63+
break;
64+
case 3: //#State=10
65+
initCode = @"h q[1];
66+
h q[2];
67+
s q[1];
68+
h q[2];
69+
cx q[1],q[2];
70+
h q[2];
71+
s q[1];";
72+
break;
73+
case 4: //#State=11
74+
initCode = @"h q[1];
75+
h q[2];
76+
h q[2];
77+
cx q[1],q[2];
78+
h q[2];
79+
";
80+
break;
81+
default:
82+
throw new Exception("There can only be 4 shells.");
83+
}
84+
this.qasm = preCode + initCode + postControlledNot;
85+
this.shots = 500;
86+
87+
}
88+
}
89+
}

‎NanoQuantum.Core/QExecutionOutput.cs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace NanoQuantum.Core
7+
{
8+
public class QExecutionOutput
9+
{
10+
public Result result { get; set; }
11+
public DateTime startDate { get; set; }
12+
public long modificationDate { get; set; }
13+
public double time { get; set; }
14+
public DateTime endDate { get; set; }
15+
public Status status { get; set; }
16+
public string deviceRunType { get; set; }
17+
public Ip ip { get; set; }
18+
public Calibration calibration { get; set; }
19+
public int shots { get; set; }
20+
public ParamsCustomize paramsCustomize { get; set; }
21+
public bool deleted { get; set; }
22+
public bool userDeleted { get; set; }
23+
public string id { get; set; }
24+
public string codeId { get; set; }
25+
public string deviceId { get; set; }
26+
public string userId { get; set; }
27+
public Code code { get; set; }
28+
29+
public class P
30+
{
31+
public List<int> qubits { get; set; }
32+
public List<string> labels { get; set; }
33+
public List<double> values { get; set; }
34+
}
35+
36+
public class AdditionalData
37+
{
38+
public int seed { get; set; }
39+
}
40+
41+
public class Data
42+
{
43+
public string creg_labels { get; set; }
44+
public P p { get; set; }
45+
public AdditionalData additionalData { get; set; }
46+
public string qasm { get; set; }
47+
public string serialNumberDevice { get; set; }
48+
public double time { get; set; }
49+
}
50+
51+
public class Result
52+
{
53+
public DateTime date { get; set; }
54+
public Data data { get; set; }
55+
}
56+
57+
public class Status
58+
{
59+
public string id { get; set; }
60+
}
61+
62+
public class Ip
63+
{
64+
public string ip { get; set; }
65+
public string country { get; set; }
66+
public string continent { get; set; }
67+
}
68+
69+
public class Calibration
70+
{
71+
}
72+
73+
public class ParamsCustomize
74+
{
75+
public int seed { get; set; }
76+
}
77+
78+
public class MeasureCreg
79+
{
80+
public int line { get; set; }
81+
public int bit { get; set; }
82+
}
83+
84+
public class Gate
85+
{
86+
public string name { get; set; }
87+
public string qasm { get; set; }
88+
public int position { get; set; }
89+
public MeasureCreg measureCreg { get; set; }
90+
public int? to { get; set; }
91+
}
92+
93+
public class Playground
94+
{
95+
public string name { get; set; }
96+
public int line { get; set; }
97+
public List<Gate> gates { get; set; }
98+
}
99+
100+
public class JsonQASM
101+
{
102+
public List<object> gateDefinitions { get; set; }
103+
public string topology { get; set; }
104+
public List<Playground> playground { get; set; }
105+
public int numberGates { get; set; }
106+
public bool hasMeasures { get; set; }
107+
public int numberColumns { get; set; }
108+
public string include { get; set; }
109+
}
110+
111+
public class Code
112+
{
113+
public string type { get; set; }
114+
public bool active { get; set; }
115+
public int versionId { get; set; }
116+
public string idCode { get; set; }
117+
public string name { get; set; }
118+
public JsonQASM jsonQASM { get; set; }
119+
public string qasm { get; set; }
120+
public string codeType { get; set; }
121+
public DateTime creationDate { get; set; }
122+
public bool deleted { get; set; }
123+
public long orderDate { get; set; }
124+
public bool userDeleted { get; set; }
125+
public string id { get; set; }
126+
public string userId { get; set; }
127+
}
128+
129+
130+
131+
132+
133+
}
134+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /