# Annotated Bibliography: Griffiths’s Quantum Channels, Kraus Operators, POVMs

Griffiths, Robert B. “Quantum Channels, Kraus Operators, POVMs.” Quantum Computation and Quantum Information Theory Course Notes, Carnegie Mellon University (Spring 2010) (2010).
http://quantum.phys.cmu.edu/QCQI/qitd411.pdf

Type: Lecture note

Summary: The source describes key concepts relating to quantum channel and POVM. The examples are related to quantum communication channels and examples are that of a single-qubit channel. It also presents multiple representations of a quantum channel, but does not explicitly show the connection between them. The author briefly discuss POVM as extension of the channel formalism.

Comments: The source is intended as a summary of sort. It is not in itself complete and often refers to the course’s references. The mathematics is minimal for this type of subject and not rigorous. The source does not employ the standard terminologies of the field which can often cause confusion especially in the part of the representations.

# C programming: multiple function, multiple source code and multi-dimensional array

This will be another technical note, so I don’t need to search for the solution again in the future. It is frustrating that the solution to a particular technical problem often are hard to find on the internet. It seems to me that a lot of people are asking, a lot are answering, but there isn’t a good systematic categorization to make finding the relevant solution easier.

## Multiple function program

In the case where the program is long and complicated, but tend to repeating computing the same function, what can be done is we can write the repeating function and call it whenever we needed it. This reduce the tedious work of typing the same thing over and over again in the code.

A function  needs two things, the argument(s) and the return value. This is why the function itself has a type according to the value they return. The function, like variables, also needs to be declared before it can be called by the main function. (Just think about how would you know the phone number of a particular person whom you don’t know the person’s face or name!) If there is only one source file, declaring the function can be done in two ways:

1. function is declared and written before main function

#include <stdio.h>
#include <math.h>

double power_series(int d, /*order to truncate the series*/
double x)
{
double return=0;
int i=0;
for(i=0;i<=d;i++){
result=result+pow(x,i);
}
return(result);
}

int main(){
double result=0;
int d=4;
double x=3;
result=power_series(d,x);
return(0);

}

2. function is declared before the main function but written after the main function

#include <stdio.h>
#include <math.h>

double power_series(int d, double x); /*declaration of function*/<

int main(){
double result=0;
int d=4;
double x=3;
result=power_series(d,x);
return(0);

}
/*detail of the function*/
double power_series(int d, /*order to truncate the series*/
double x)
{
double return=0;
int i=0;
for(i=0;i<=d;i++){
result=result+pow(x,i);
}
return(result);
}

Similar principle goes for function on a different source file, the function must be declared before it can be called. Let’s say, we created source files called main.c for the main function and series.c for containing calculation of series. To link this together, we need a header called series.h to be added to both main.c and series.c. This header will contain all the necessary libraries and declaration of functions in series.c.

 main.c series.h series.c #include #include int main(){…} #include double series(int d, double x); #include double series(int d, double x){ … }

## Passing Array as Argument

The function can take as much argument as is needed, but can only return only one value. In a lot of cases, we need a function that can return multiple values of the calculation, an array of it even. To by pass the limitation of function return, we can instead instruction the function to place the value into a particular memory which is associated with a variable in the main function. What the function would need is a pointer to where they should place the function which can be passed into the function by

double power_series(int d, double x, double* y); /*passing location of y*/.

To pass the location to the function in, we use

power_series(d,x,&y); /*y is the variable that will hold the result from the function*/.

To assign the value to y inside the functions, we need to refer to *y instead of y.

Passing and array into the function is done on the same principle. When writing

power_series(d,x,y[ ]); /*passing y as array*/,

the function is receiving the pointer for array y[ ] which has to be a one-dimensional array (as limited as it is). The good thing is the handling of the array is easy in the function as it can just treat it as a variable. The problem, however, is when the array of more than one dimension has to be passed into the function.

A way to get around this we have to look at how an array is constructed in the memory. The elements of an array is stored consecutive to one another. In two-dimensional array, for example, will be stored as

|A[0][0]|A[0][1]|A[0][2]|A[1][0]|A[1][1]|A[1][2]|….

To access the element is then to call the correct value in the correct position which follows the relation

A[i][j]=*(A[i]+j).

This means in order to pass an array, only an address to an element in the array is needed regardless of the size and dimension of the array. So what we send into the function is then

power_series(d,x,&y[0][0]);

To assign value to the element of the array in the function is then

*(y+10)=result; /*assigning value to the 11th element of the array*/.

One thing to be careful about is how to address row and column. It is best to pass the dimensions of the array into the function in order to allow the computation of row and column.

Passing the array in this manner can also be used for structures. The difference is that the component has to be specified like this

(*(y+10)).component1=result;

The parenthesis before .component1 is absolutely essential to address the component correctly.

For further reading, see the reference.

# Compiling and Running MPI Programs on WestGrid

This document is intended to be for my own reference for most part, but I will try to go through it step-by-step just so anybody new to using ssh client and WestGrid like myself would know what to expect as well. I would recommend that new users read the official QuickStart guide here, if you have not yet done so, before proceeding.

In order to use WestGrid, we’ll need a SSH (Secure Shell) client which act as a terminal for us to access the server and a file transfer client (we can’t use the same terminal for both functions, I’m afraid). I use PuTTY as SSH client and PSFTP for file transfer. These two comes together in an installation package. Other SSH clients and file transfer clients work as well, but please check the list given in the QuickStart guide for compatibility.

## Transferring Files

In order to compile a program, we need to transfer the source code to the server first. The logging in is pretty simple as the terminal will guide you through it, but first you must choose the server to log into. In this case, I choose the Checkers on WestGrid. To decide which server to use depends on the task we want to do. I choose Checkers because I will be doing parallel processing using MPI and Checkers supports this.

To choose the server in PSFTP, simply type

open server-name.westgrid.ca

There are a number of commands that we can use and we can access the list by typing help. Here are some useful ones to remember:

lcd [directory] This is for accessing local directory like using cd in local command line.
put [file] This is for transferring a file from local machine to the server.
ls This is for listing the files in your directory on the server
bye This is for leaving the server and PSFTP

I found it easier to first go to the folder where the source file is using lcd then uploading the file by using put. We can check if the file is there by using ls. Once the file is up on the server, we switch to PuTTY to compile the source code. We can log in through PuTTY and PSFTP at the same time, but the login has to be done separately.

## Compiling the Source Code

Once the source files are on the server, we can use the compilers on the server. First, we log in using PuTTY. No extra setting is needed aside from specifying the server we want to log in. Once PuTTY starts to make the connection, it will ask for username and password again.

The exact command depend entirely on what language the program was written in. The full description of the programming including compiling on Checkers can be found here. Since I coded my test in C with MPI, I use the command

mpicc -O3 main.c -lm -o main

which I take from here. This command use gcc as the underlying compiler (if you are not familiar with that, it’s a common c compiler in Unix and Linux), therefore the options following mpicc are the same as what you would put in for gcc. -O3 (capital O) is an optimization option. You can find more detail here. -lm link the code to standard math library, and -o [file] simply specify the output.

## Submitting and Running the Program

To run the program on WestGrid, we need to send a job request to the system. This is because the computational resources are shared with other jobs and, especially in the case of the MPI, the number of processors and memories had to be put aside for large jobs. The resources on WestGrid is managed by TORQUE which takes the job request in form of batch job scripts. This has to be written on a separate file and uploaded onto the server into the same directory as the output of the compiler.

The .pbs file is written in shell script which always start with

#! /bin/bash

This command specify the path in which the code is to be interpret. It will try to find Bash execution in /bin.

The following lines specify the options for running the job which is written after #PBS. #PBS -S /bin/bash does pretty much the same thing as the line before which is specifying the shell to run the script in. Typically, WestGrid has default limit to how much processor, memory, and time we can use for a job. To specify our own limit we use the commands

#PBS -l procs=10 to specify number of processors for the job
#PBS -l mem=2000mb to specify the amount of memory needed
#PBS -l walltime=72:00:00 to specify the job runtime.

Different resources which can be set under -l can be done at once by separating them with commas or specify when submitting a job by putting the option after qsub command.

qsub -l procs=10,pmem=2gb,walltime=72:00:00 main.pbs

If the resources have already been specify, we can simply go qsub main.pbs. For details and options that WestGrid support, read here.

In the later part of the script # will be used as comment symbol.

cd \$PBS_O_WORKDIR find the directory where the job is (essentially where the .pbs file is). \$PBS_O_WORKDIR let TORQUE find the path automatically rather than typing the absolute path ourselves. The dollar sign indicates that it is a variable.

echo is used to display information of the job. However, the information is not displayed on the terminal and it is actually a better idea to store your output as a file on your server directory instead.

The command to run the program in my case is mpiexec ./main. Number of processors can also be specified here if it hasn’t been previously by using option -n [# of procs] before ./main. More option for command mpiexec can be found here.

## Transferring Output File

Once WestGrid finish running the job, we should have the output file ready in the server directory. To move this file to local machine, we once again switched to PSFTP and use command get [file]. This will move the file to your local directory which is presumably the source code directory from earlier. Once we’re satisfy that that we have the correct result, we can log out from PSFTP using the command bye and from PuTTY by simply shutting down the window.

Sierra Leone was one of the most inhospitable country in recent history, so naturally nobody look to Sierra Leone for the latest technological invention.

But necessity is the mother of invention, and this young engineer does it better than anybody.

# CAP Congress 2012

I was at the Canadian Association of Physicists Congress for 2012 at University of Calgary last week, partly volunteering and just running amok listening to talks from different fields. It’s a good change that once in a while you get to listen to something that is completely outside your field, like thermophotonic imaging or string […]

# TEDTalk: Susan Cain’s power of introverts

I’m an introvert, typical of people in science. I work best in solitude and feel relax being alone. Funny that it didn’t get me any look back home where solitude is rarely found and valued. Of course, people tend to think I’m slightly antisocial, but it is not off-putting. It was quite an eye-opener to move across the globe and found people having a much stronger opinion about me being an introvert. It is mostly because I don’t like hanging out the way people here hang out. I find stimulation, especially noises and smell, both distracting and overwhelming. I get migraines at pubs and bars because of dim light and noisy conversations. I both sympathize with and admire Susan Cain for trying to be an extrovert even just a period of time. It’s much harder than you think to be in an environment catered for extroverts when you are on the end spectrum of introversion. Boy, I even have a small breakdown once complete with tears and causing a bit of a scene. Anyway, what I want to say is be more tolerating and accepting of other people modus operandi, because everyone has their own different balances. Einstein liked being on his own while working, while Feynman would be in a bar if he wanted productivity. They were both great minds, but no mind works alike.

# ‘You’re not special’ graduation speech by David McCullough Jr.

From David McCullough Jr. to graduates of Wellesley High School graduates, class of 2012.

For original article on Yahoo, go to here.

This is a very inspiring speech. It humbles, encourages, and put things in perspective. I think we all needed to be reminded like this once in a while that we are the ones that make our lives special. Here are some recap of the speech from Boston Herald:

“No, commencement is life’s great ceremonial beginning, with its own attendant and highly appropriate symbolism. Fitting, for example, for this auspicious rite of passage, is where we find ourselves this afternoon, the venue. Normally, I avoid cliches like the plague, wouldn’t touch them with a ten-foot pole, but here we are on a literal level playing field. That matters. That says something. And your ceremonial costume… shapeless, uniform, one-size-fits-all. Whether male or female, tall or short, scholar or slacker, spray-tanned prom queen or intergalactic X-Box assassin, each of you is dressed, you’ll notice, exactly the same. And your diploma… but for your name, exactly the same. All of this is as it should be, because none of you is special.You are not special. You are not exceptional.”

“In our unspoken but not so subtle Darwinian competition with one another–which springs, I think, from our fear of our own insignificance, a subset of our dread of mortality — we have of late, we Americans, to our detriment, come to love accolades more than genuine achievement. We have come to see them as the point — and we’re happy to compromise standards, or ignore reality, if we suspect that’s the quickest way, or only way, to have something to put on the mantelpiece, something to pose with, crow about, something with which to leverage ourselves into a better spot on the social totem pole.”

“If you’ve learned anything in your years here I hope it’s that education should be for, rather than material advantage, the exhilaration of learning. You’ve learned, too, I hope, as Sophocles assured us, that wisdom is the chief element of happiness. (Second is ice cream… just an fyi) I also hope you’ve learned enough to recognize how little you know… how little you know now… at the moment… for today is just the beginning. It’s where you go from here that matters.”

“As you commence, then, and before you scatter to the winds, I urge you to do whatever you do for no reason other than you love it and believe in its importance. Don’t bother with work you don’t believe in any more than you would a spouse you’re not crazy about, lest you too find yourself on the wrong side of a Baltimore Orioles comparison. Resist the easy comforts of complacency, the specious glitter of materialism, the narcotic paralysis of self-satisfaction. Be worthy of your advantages. And read… read all the time… read as a matter of principle, as a matter of self-respect. Read as a nourishing staple of life. Develop and protect a moral sensibility and demonstrate the character to apply it. Dream big. Work hard. Think for yourself. Love everything you love, everyone you love, with all your might. And do so, please, with a sense of urgency, for every tick of the clock subtracts from fewer and fewer; and as surely as there are commencements there are cessations, and you’ll be in no condition to enjoy the ceremony attendant to that eventuality no matter how delightful the afternoon.”

“Like accolades ought to be, the fulfilled life is a consequence, a gratifying byproduct. It’s what happens when you’re thinking about more important things. Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. Go to Paris to be in Paris, not to cross it off your list and congratulate yourself for being worldly. Exercise free will and creative, independent thought not for the satisfactions they will bring you, but for the good they will do others, the rest of the 6.8 billion–and those who will follow them. And then you too will discover the great and curious truth of the human experience is that selflessness is the best thing you can do for yourself. The sweetest joys of life, then, come only with the recognition that you’re not special.”

“The sweetest joys of life, then, come only with the recognition that you’re not special. Because everyone is.”