As a part of my training duties, I have just started a course on Coursera.
It seems, it is actually just a copy of Intel's one but OK to me.
2020年8月13日木曜日
Coursera's FPGA + OpenCL course
2020年8月5日水曜日
ハンガリーで結婚式に参加した
妻の同僚のハンガリー人が結婚式に私も招待してくれたので、参加してきました。
ブダペストから更に来るまで1時間半もかかるようなところなので、
前泊(正確には前々日に移動だけ)して、ブダペスト観光しつつ、当日は新郎新婦の友人に車で送ってもらいました(外国人には公共交通機関での移動は無理っぽい)。
式が14時始まりで、披露宴が終わるのが4AMという死にそうな予定で、もちろん我々は途中で諦めましたが、それでも1時。翌日は新郎新婦の車に乗せてもらってウィーンまで帰ったのですが、途中で逃げた我々より新郎新婦のほうがしっかりしていた。体力の違いか、若さか。
写真は観光に行った、Gerbeaudという喫茶店、Matthias Church, 世界遺産になってるメトロ(M1線)、鎖橋、結婚式の式次第に式の様子。
2020年8月4日火曜日
List of gates available in Q#
I always lose the list of Q#, and so, I would like to put it as memo here.
Grover's algorithm (Algorithm 1, in Section 2)
Continuation of Q# practice (Bell state).
Grover's algorithm described in Section 2, Algorithm 1.
In this example, Oracle is expressed just with Toffoli (CCNOT) gate, and this is not a general implementation, as far as I understand.
In the literature, they constructed CCNOT with natively supported gates, but Q# has it, and I just used it (control and ancillary are a bit confusing to me though).
By running my sample code the numbers of measurements observed in 1000 trials are;
00:0, 01:0, 10:0, 11:1000
Unlike the previous one, the result is completely the same as the theory.
I feel I should split Q# and C# parts in a better way.
In any case, I am getting used to it, hopefully.
Sample codes are;
Q# (Program.qs)
/// # Summary
///
namespace Grover {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation Grover() : (Int,Int,Int,Int) {
Message("This is Q# implementation of Algorithm 1 in Quantum Algorithm Implementaions for Beginners");
mutable n00 = 0;
mutable n01 = 0;
mutable n10 = 0;
mutable n11 = 0;
for(trial in 1..1000){
using ( (qubit0, qubit1, qubit2) = (Qubit(), Qubit(),Qubit()) ){
// qubit0: ancillar
// qubit1, 2: x1, x2
//Initializaiton
X(qubit0);
H(qubit0);
H(qubit1);
H(qubit2);
// qubit0 is called ancillar, looking at the following site and the article, it should be the target
// https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates
CCNOT(qubit1,qubit2,qubit0); //Toffoli gate
// Grover diffusion operator
H(qubit1);
X(qubit1);
H(qubit1);
H(qubit2);
X(qubit2);
CNOT(qubit2,qubit1);
H(qubit1);
X(qubit1);
H(qubit1);
X(qubit2);
H(qubit2);
let res0 = M(qubit1);
let res1 = M(qubit2);
if(res0 == Zero){
if(res1 == Zero){
set n00 += 1;
}else{
set n01 += 1;
}
}else{
if(res1 == Zero){
set n10 += 1;
}else{
set n11 += 1;
}
}
Reset(qubit0);
Reset(qubit1);
Reset(qubit2);
}
}
return(n00,n01,n10,n11);
}
}
C# (Driver.cs)
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace Grover
{
class Driver
{
static void Main(string[] args)
{
using (var qsim = new QuantumSimulator())
{
long a,b,c,d;
(a,b,c,d) = Grover.Run(qsim).Result;
Console.WriteLine("{0},{1},{2},{3}",a,b,c,d);
}
}
}
}
2020年7月27日月曜日
研究費と審査員の関係
大久保三代さんのブログ:
https://web.archive.org/web/20200727150033/https://ameblo.jp/okb-34/entry-12613645240.html慶應の末端研究員だったころ、研究費の取り方を
教えてもらうために、当時医系技官だった愉一に
近づいた私。その努力実って獲得したのが
厚生労働省老人保健健康増進等事業 主任研究員
とか
申請書や予算書は、夫が書いてくれた。今だからいえる話。
というようなことが書いてある。
国会議員も勤めていらっしゃった方なので、いろいろとびっくりしている。
2020年7月17日金曜日
Rewriting sample codes in Quantum Algorithm Implementations for Beginners (Bell state)
I have changed the strategy of learning Quantum algorithms.
Now, I am following "Quantum Algorithm Implementations for Beginners".
The first trial is to construct Bell state and check if the understanding is correct.
By running my sample code the numbers of measurements observed in 1000 trials are;
|00>:494, |01>:0, |10>:0, |11>:506
There is a good agreement with the textbook
A sample code is;
Q# (Program.qs)
namespace Bell2 {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation Bell() : (Int,Int,Int,Int) {
Message("Hello quantum world!");
mutable n00 = 0;
mutable n01 = 0;
mutable n10 = 0;
mutable n11 = 0;
for(trian in 1..1000){
using ( (qubit0, qubit1) = (Qubit(), Qubit()) ){
H(qubit0);
CNOT(qubit0,qubit1);
let res0 = M(qubit0);
let res1 = M(qubit1);
if(res0 == Zero){
if(res1 == Zero){
set n00 += 1;
}else{
set n01 += 1;
}
}else{
if(res1 == Zero){
set n10 += 1;
}else{
set n11 += 1;
}
}
Reset(qubit0);
Reset(qubit1);
}
}
//Message("00:#, 01:#, 10:#, 11:#");
return(n00,n01,n10,n11);
}
}
C# (Driver.cs)
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace Bell2
{
class Driver
{
static void Main(string[] args)
{
using (var qsim = new QuantumSimulator())
{
long a,b,c,d;
(a,b,c,d) = Bell.Run(qsim).Result;
Console.WriteLine("{0},{1},{2},{3}",a,b,c,d);
}
}
}
}
Otherwise, files are created automatically when one creates a new project, namely,
- Go to View -> Command Palette
- Select Q#: Create New Project
- Select Standalone console application
- Navigate to the location on the file system where you would like to create the application
- Click on the Open new project... button, once the project has been created
2020年7月15日水曜日
Install GCC 10 with SPACK on Redhat 6
Spack looks good and I am playing around it.
However, the very basic component GCC10 cannot be installed with the following error by default;
"~binutils" conflicts with "gcc@7: arch=linux-rhel6-None" [New GCC cannot use system assembler on RHEL6]The circumvent is:
% spack install gcc+binutils
Still not completed, but looks installing.
登録:
投稿 (Atom)


