Random thoughts, daily life, being a student, quantum computing.

2012-01-19

Approaching HUnit

My January goals for LQPL include using TDD practices to create the code for the LQPL server. I am doing that, and at this point, I am starting to see some of the "warts" with the way I am tackling the TDD. For example, to be able to parse a set of five input text commands, I've created 56 cases (assertions).  Each case is a single line, but that is a lot of reading. For the "error out" cases, I created a function that improved the readability quite a bit.

    
    expectLeftString :: Either String a -> Bool
    expectLeftString (Left _)  = True
    expectLeftString _ = False
    
    makeBoolParseError :: String -> Assertion
    makeBoolParseError s = assertBool ("'"++s++"' returns error") (expectLeftString (getCommand s))
This gets used in the test creation like this:  

    "parseL3 " ~: makeBoolParseError "load"


For the positive cases, however, it becomes quite a bit messier. For example:

    "parseL2aSpace " ~: "'load     /x/xxx addint.qpo' returns QCLoad" ~:
               Right (QCLoad "/a/bc with space.qpo") @=? (getCommand "load /a/bc with space.qpo") 


Multiple lines of this become rather difficult to parse.

One solution would be to create a helper function for creating the positive assertions as well. I'll give that a shot and see how it looks!

2012-01-02

Thesis, Here I come!

2012 is going to be a banner year for my research! I will be able to dedicate myself to it full-time starting in April, which is like a dream come true. To get ready for that, I've set myself some goals for the first three months of the year, while I am still working.

LQPL Goals:

  • January - Document new separated View and Controller interfaces for the new "server" type emulator.
  • January - Write tests in HUnit (or SmallCheck or QuickCheck) as part of the development of this server and client interface
  • January - Actually write the code!
  • January - Have Grover's Algorithm working as before.
  • February - Write a new HCAR entry
Inverse Categories Research Goals:

  • February - Review and update the proofs on lifting inverse product to a product and the equivalence proof
  • March - Beef up Inverse Co-Product paper
  • March - Get Inverse Products paper ready for submission to TAC
Other (things to support research):
  • Make physical fitness a habit.
  • Catch up on reading
  • Present something (Likely on reversible computing and linear logic)

2011-05-23

Quantum Mechanics and Cobordisms

In last weeks post, I noted that I was planning to do work every day, starting by getting up at 5:00 AM, put in a couple of hours on research and then go to work.

Did not pan out. Physically, I'm finding it tough to keep up that schedule. Since that is very important to me, I am doing something about it.

I did still manage to tackle a few things. I've started watching the excellent introduction to Quantum Mechanics by James Binney on iTunesU. While so far it is all review, it is nice to have it as something to watch on the bus into work or coming home.

As well, I have completed chapter 1 of Frobenius Algebras and 2-D Topological Quantum Field Theories (available as a Kindle eBook).

Finally, I did get the Message Passing Language to work on Linux. Interestingly, at the same time that I was struggling with wxHaskell on the mac, there were numerous posts about the issues with GUIs for Haskell (on Mac etc.). No real resolutions, a few pointers on getting wxHaskell and GTK2HS working on the Mac and lots of posts on Haskell Café.

The biggest thing not done is that I still haven't chosen a topic for FMCS '11. I would really like to start talking about coproducts in inverse categories, the next phase to my research on reversible computing and its relationship to quantum computing. The issue with that is that I haven't done any research on it yet.

So, main plans for this week include:
  • More on Frobenius Algebras.
  • Decide on FMCS '11 topic. Potentials include Coproducts in inverse categories, Cobordisms and their relationship to Frobenius Algebras, or possibly something on LQPL.
  • Don't be tempted and watch 3 sessions of the Quantum Mechanics course.

2011-05-15

Back in the saddle...?

After a few months of huge time commitments at work, I am once again making some time for research. I did a kickstart in a great way - the U Calgary Grad Studies faculty had a free seminar entitled "The seven secrets of a successful PhD student".

Being a sucker for all of these time management and self-improvement seminars, I went for it.

The seminar was good, highly entertaining, but most important, I was reminded of two gems:
  • Do some work on the PhD, first thing in the AM, EVERY work day.
  • Create weekly, monthly and longer plans and review them
This is the old common sense world coming back in and it makes such a difference. In the couple of weeks since the seminar, I've made more progress that I did in the previous 6 months.

Current upcoming plans include:
  • Prepping a talk for FMCS '11
  • Studying "Frobenius Algebras and 2-D Topological Quantum Field Theories" by Kock once again
  • Submitting the paper on inverse products for publication
  • Updating LQPL to break the presentation code from the emulator code
  • Attending some upcoming conferences
Check back later, I'll update this in a couple of weeks.

2010-05-30

A new and better way to procrastinate

The most striking thing I find about my iPad is how effective I find it to use. The continuing refrain in the news - for example in a recent BBC article about the iPad's first day in the UK - is that it is a device for consuming, but not producing content.

I beg to differ.

I think the real issue is that we can't produce it in exactly the same way that we have grown used to with our current PCs because it is a much more structured device. This leads to having to relearn some of our paradigms and change our habits - always an uncomfortable thing to do.

This blog is an example of content creation. The iWork suite is a great example of apps for creating content and there will be more.

Latest reviews: (Canada Centric, eh?)
- silly that iBooks won't sell books in Canada
- BBC has a great free news app (helloooo CBC, CNN?)
- AccuWeather is pretty and great to use
- buying a Kindle book on Amazon is just too easy ;)
- a competitor for BlogPress wouldn't have much problem blowing it out of the water

- Posted using BlogPress from my iPad

Location:13 Ave SW,Calgary,Canada

2009-07-23

Upcoming plans for LQPL

Well, it has been a while, hasn't it.

I finally submitted the Linear Quantum Programming Languages project to HCAR as noted in a previous post. So that means I actually need to do something about it.

In the past, I had concentrated on performance and the UI things I wanted. Now that the public will actually get to see code, I thought the first thing to do would be to tidy the code a bit.

First step was to "cabalize" it (Cabal is the default Haskell build system). That was fun and not too tough.

Then, I finally made use of Neil Mitchell's great product, hlint. Lovely product and a great example of why functional languages are so great. Transforms are definable and after you transform the source you have the same program. Hah - try doing that in C.

The next big thing for the program - get it handling source files rather than just the compiled files. Right now, the compiler is a separate console program. Nobody likes a console program any more. (Except me - but I'm freakin' old :)

I'll just be doing the minimal work on that, using GtkSourceView in Gtk2Hs to display the file, have some way of compiling it, (menu item on the sourceview window? button there? menu item on the main window????) and an autoload of the compiled file.

Further plans can be found at my LQPL page.

2009-05-27

FMCS 2009 schedule

Schedule was just posted:


Thursday, May 28, 2009

3:00p.m. Gage residence rooms available for check-in

6:00p.m. Welcome Reception - Ruth Blair AB - Gage Residence


Friday, May 29, 2009

Tutorial Sessions - WMAX 240 - 1933 West Mall

9:00-10:30a.m. Ernie Manes - Equationally definable full subcategories of spaces.

10:30-11:00a.m. Break

11:00-12:30p.m. Vaughan Pratt - Axiomatizing affine and Euclidean space.

12:30-2:30p.m. Lunch

2:30-4:00p.m. Pieter Hofstra - Types, groupoids and homotopy.

4:00-4:30p.m. Break

4:30-5:30p.m. Dorette Pronk - The left and right adjoints of Span.


Saturday, May 30, 2009

Research talks - WMAX 240 - 1933 West Mall

9:00-9:50a.m. Mehrnoosh Sadrzadeh - What is the vector space content of
what we say? A compact categorical approach to distributed meaning.

9:50-10:30a.m. Robert Seely - The basics of Cartesian differential restriction
categories.

10:30-11:00a.m. Break

11:00-12:00 Michael Johnson - Monadicity, descent, and classical database view
updating.

12:00-12:30p.m. Art Stone - What might Counter-bi-algebras be?

12:30-2:00p.m. Lunch

2:00-2:40p.m. Robin Cockett - Cartesian differential restriction categories.

2:40-3:05p.m. Brian Redmond - TBA

3:05-3:40p.m. Shusaku Tsumoto - Medical data mining.

3:40-4:10p.m. Break

4:10-4:35p.m. Brett Giles - Reversible computation and Frobenius algebras.

4:35-5:00p.m. Aaron Hunter - Algebraic considerations on the dynamics of belief.

6:00p.m. Banquet - Cedar Room in the Ponderosa Building


Sunday, May 31, 2005

Sunday talks will be in WMAX 240 - 1933 West Mall

9:00- 9:50a.m. Bob Rosebrugh - EASIK: Database design and manipulation
implemented categorically.

9:50-10:20a.m. Sean Nichols - On strong reduction in combinatory logic.

10:20-11:00a.m. Break

11:00-12:00 Vaughan Pratt - Euclid's postulates at all dimensions.

2009-05-13

The first HCAR submission

Taking a cue from others - an easy blogging entry :).

I've finally made a submission to the HCAR for L-QPL. Content below:

LQPL - A quantum programming language compiler and emulator

LQPL (Linear Quantum Programming Language) consists of two main pieces, a compiler for a functional quantum programming language and an associated assembler / emulator.

The system was the main subject of the author's master's thesis and was inspired by Peter Selinger's paper Towards a Quantum Programming Language. LQPL incorporates a simplified module / include system (more like C's include than Haskell's import), various predefined unitary transforms, algebraic data types, and operations on purely classical data. The compiler translates LQPL programs into an assembler like language. The emulator, written using Gtk2Hs, translates the assembler to machine code and provides visualization of the program as it executes.

For example, the following procedure implements quantum teleportation:

teleport::(n:Qubit, a:Qubit, b:Qubit ; b:Qubit) =
{
Not a <= n ;
Had n;
measure a of
0> => {}
1> => {Not b};
measure n of
0> => {}
1> => {RhoZ b}
}


The emulator will allow a person to step through this program, displaying the quantum values as a tree. The figure below is a screen shot showing the results after the first measure in
teleport.





Since the publication of the thesis, some time and attention has been spent on improving performance and the UI of the emulator.

We plan to release this to the public sometime this year. It will be made available from the author's website and the programming languages research group's website at
the University of Calgary.

2008-10-01

Grover's search algorithm, Part 1

So, as I've alluded to over the past while, I have written a quantum compiler and associated emulator. First, what's the difference between a simulator and an emulator. Well, to my mind, a simulator typically "roll's the dice" as it proceeds. Quantum algorithms tend to end with probabalistic results. For example, Grover's search with 3 qubits gives the correct result with a probability of .945. A simulator will use a random number generator to show the correct result 94.5% of the time, and the wrong result 5.5% of the time. Naturally, you have to run it a few times to be sure you have the correct result. (OK - not too many :).



With an emulator, you see all the potential results and their probabilities.


In the above diagram, you can see the desired result is 6 (110) and the probability of getting any other result is .007813 . (A green dot is a probabilistic integer, the blue dot is a leaf - think of it as an entry in the "matrix" describing the quantum state).

So - how do we do this... Well, with QPL, we write this code:


#Import gtrans.qpl
#Import qubitListToInt.qpl
#Import intToZeroQubitList.qpl

main ::()=
{
dataqbs = intToZeroQubitList(15|);
hadList dataqbs;
doNGrovers(4) dataqbs;
i = qubitListToInt(dataqbs);
}



The #Import constructs work similarly to Haskell's import, brining in the code at the named file.

The main function consists of 4 statements. The first creates what can be called a quantum integer, consisting of a list of qubits. The 15 is a classical value and represents the largest integer we would like to store (as an unsigned value). The next statement calls a function that will apply the Hadamard transform to each of the qubits. We then apply Grover's transform to the list (see the next posting), convert back to a probabilistic integer by measuring each of the qubits and voila - the answer appears.

Next posting - more details about the doNGrovers function.

2008-09-29

What to do, what to do ...

Every few months, I feel like I go through a "blogspurt", where I just want to get out and blog.

Then, it tapers off and nothing appears for the next 6 months. I've had thoughts of posting daily, and those just peter out over time.


So, what next?

I'm back taking a class at the U of C.

Oh yes - the other thing is that I have Grover's search algorithm working for at least up to 8 qubits. I actually use that as a benchmark as I make changes / updates in my quantum stack compiler and emulator.

So, I keep thinking about this and that's what I'm going to do. Start blogging about the quantum algorithms I've been programming.

2008-02-24

Some of Washington's Wonders

So, while down visiting my sister here in the sunny state of Washington (No kidding - the weather is fantastic), I heard on the news that 16% of the drivers here are uninsured. I find that simply a manifestation of insanity. How can people tolerate this? What's more, how can they tolerate a government that does nothing about it? Apparently the fine for no insurance is a paltry $250. My god!

In Alberta, where I drive, you can't renew your license without proof that you are insured. In fact the penalty for even trying is a court appearance. I'm sure there are some drivers that let their insurance lapse, but in a recent thanksgiving blitz, only 13 drivers were found to be uninsured out of over 2000 infractions! We have some hefty fines if you fail to produce an insurance card and if you repeat offend, your license will be suspended.

But possibly what is more interesting is that our culture in Canada tends to make it unthinkable to even consider driving with no insurance. See for instance the PDF of uninsured drivers estimates at http://www.ircweb.org/News/20060628.pdf.

But enough shaking my head negatively in wonder, let's take a look at the Ferries! Fantastic items man. I'm currently sitting on the Kingston - Edmonds ferry (Near the start of the line - yay!) and what a cool thing. On top of that, I'm able to connect via their wireless network and post this little item - again - major coolness. BC Ferries just don't seem to compare.

Well - maybe not so cool. It is one of those pay for access plans. Guess I'll post later.

On a final note - what's with all the ColdFusion pages in government sites? Don't they know how to write JSP?

2008-02-20

Blogging by email

As I've said on other posts, I don't know where people find the time to live as well as blog.

Perhaps email blogging is the key!

Here I am sitting on the bus typing away on a Blackberry, filling in what I want to blog. I spend approximately an hour a day on the bus.

Lately that time has been devoted to studying type theory, but why not use some of it for the blog?


(Addendum - Sadly the bb I have appends a ton of corporate stuff - not that suitable for this. Sigh)

2008-02-19

64 Bits and lovin' it

So, I finally bought a recent computer and have a bit of memory now (8GB - Yay). Note that when you install a 32 bit OS, you just don't get to see those extra gigs (oops :).

A brief note about this thought, when you install some x86_64 apps outside of ubuntu's managed packages, you may need to install the package "ia32-libs". This happened to me when I finally gave up trying to get vmware 5.5 working and downloaded the 64bit version 6. It installed and ran, but when trying to start a machine it failed with the error "Failed to connect to process". Sheesh!

Luckily I found the fix eventually through google.

Now to see how the quantum orderfinding goes...

2007-07-30

Setting Goals

So, how do you set them? How do you determine what is or isn't important enough in your life to be a goal?

Stephen Covey gives a very simple method in his 7 habits book. Write your eulogy. Determine how you want to be remembered by family, friends and others.

I've done this in my past and the biggest thing that comes up for me is that I really want to get a doctorate and teach. So, that is my long term direction. At the same time, there are many other items in my life that are very important. Among them are:
  • Financial security

  • Family

  • Health


Obviously the list is at a higher level than "Get a Ph.D.". That one fits under an item probably called "Personal Improvement".

So, for a start, I have the four areas I want to concentrate on. Thinking somewhat more abstractly though, what are the principles and purpose I want to govern my life? Purpose is usually an angst filled discussion :). Typically, if someone asks me that, i would respond, "To fullfill god's will." (For god - feel free to replace with your higher power of choice. I was raised an Anglican, but feel more agnostic / Buddhist than anything else now) .

At times, I have felt this was a cop-out. What if my purpose really is to teach math and computer science. (I am quite good at teaching this stuff, and really enjoy it)

Well, time will tell. The next post(s) will explore how to turn the concentration areas into actual goals.

2007-07-09

Haskell and Java

In my day job, I program with Java. In my grad studies, where I'm working on a Ph.D. in Computer Science, I program with Haskell. Most of my research involves computer languages, my Masters thesis was on creating a quantum programming language, including an operational semantics, a simulator and a compiler. The compiler and simulator were written in Haskell.

I like Haskell. It appeals to the way my brain works. Being a functional language, it tends to be less verbose and "It just works." The last part refers to the fact that once you have the types defined correctly and the compiler accepts your program, it often is correct. The amount of debugging tends to be minimal.

Java, as you may know, requires a lot of debugging. Null pointer exceptions, class cast exceptions in collection objects (we are still stuck at 1.4 at work), and general algorithm problems.

So, when I get any chance, I sing the praises of Haskell vs. Java. This last week, I needed to create a small tool that would check consistency of the CVS Repositories in a project. Sometimes, my developers get a bit excited, copy over code or supporting files to a new directory and neglect to remove the CVS information from the copied files. (Sigh!). So, a nice simple directory walker that checks the consistency is all I needed. I thought - why not Haskell? So, I wrote it up in Haskell, using GTK2HS for the interface.

After showing it to my team, one said "Gee, that would be nice to have as an ant task". I thought so too, so I resolved to do that on the weekend.

Much to my dismay (and depression). The Java code was shorter, simpler and faster to write. Why?

Well, some of it is due to the interface documentation. My GTK2hs code involved using a tree list, which is new with the latest release ot GTK2HS and required a bit of trial and error. The Ant task documentation in the O'Reilly ant book is excellent.

Some of it is due to the interface. Any one who has programmed with gtk knows that there is a lot of setting up to do the simplest screen. Ant tasks, on the other hand, have a pretty direct and simple interface to the world.

Lastly, and this is the really sad part, I'm probably faster with Java lately, as that is what I use day to day. Sigh.

2007-07-07

Love, Love, Love.

What is the nature of love? I've been married for almost 10 years now, and it feels like I'm more in love than ever. I also feel more loved than ever. I consider myself quite blessed.

I think it may be trite, but true, that love comes from commitment. I was committed, she was, and so our love grew. Very cool. Sometimes it takes work and sacrifice, sometimes not. I can be moody, as can she. Sometimes it requires distance, sometimes we just can't get close enough.

So, why do I feel more loved than ever? A simple example happened this morning. I swore up and down yesterday that today I was going to be glued to my desk and nothing she could do would get me out and about. (Yes, I'm Canadian, eh!) However, this morning, I remembered I had left my O'Reilly Ant book at work, and I have to write a custom ant task for Monday. I needed the book. Because of my ankle (see post from a few days ago), I had to have her drive me.

This was love. She just said: "Sure - let's go".

So, that's the nature of love.

2007-07-06

Analysis paralysis

In my day-to-day job, I'm a computer consultant.

One of our pet phrases in the management / PM end of things is Paralysis by analysis. In case you have never heard of that, or just don't work in the industry, it works like this: System development in larger companies often follows a few set phases:
  • Initiation (Gather requirements, sponsorship, estimates)
  • Analysis and design (Detail what needs to be done, what will the system look like)
  • Development (Code!)
  • QA andimplementation (Test and start using it)
Of course, this is quite an oversimplification. If you are interested in this sort of stuff, a good starting point is wikipedia.

Paralysis by analysis refers to the penchant for certain developers to never move out of the analysis or investigation phase. This is a common trap to fall into, because there is always more to know.

Since my last blog almost a week ago, I've fallen into that myself - with respect to blogging. I would spend some time thinking about what I should write and then do nothing.

So, my resolution is to just not do that, or stealing from Nike - "Just blog it!"