Implementing Steane [[7, 1, 3]] Code In (Microsoft) Liquid - quantum-computing

I am trying to implement some quantum error correcting codes in Liquid (please correct the tag if need be), and I thought I'd start by reproducing the Steane7 class discussed in the User's Manual here starting on page 55 (page 56 of the pdf). I have a couple of questions about the provided code though.
The overall structure of the file is unclear to me. The example starts out by defining "type Steane7". This is a class definition, so I assume all of the following code is indented under this? On page 58 (59), it makes a reference to going back to the class definition to add the overrides, which makes it seem like the above code is not indented under the type. I assume this is meant to me that it's indented under the type but not under the synd method?
In the previous mentioned overrides on page 58 (59), what is s and where does it come from? In F#, one can use words other than "this" and "self". Is that what s is supposed to be here, or is s referring to a value previously defined but not mentioned?
The drawing instructions in the prep gate on page 56 (57) say "Error! Hyperlink reference not valid." What are the proper drawing instructions here? I'm guessing that's supposed to read "\multigate{#%d}{%s}"?
The method "fix" has an else with no if on page 58. What's the proper reference to the parent here?
Are there any pieces of the Steane7 class missing from the User Manual? If I call this in a script, it's going to work exactly like the compiled version of the code?
For future codes I implement, are there any other methods which should be overridden? I am piecing together the QECC class by inspecting the compiled assembly through VS.
Frankly, all of these questions could be answered by someone simply pointing me to the source code for QECC and Steane7. The "source" folder I grabbed from the GitHub only has precompiled executables.

I just posted the source for Steane7 to the Liquid GitHub repo. I hope that helps!

Related

Translate into Apple Events AppleScript

I have an very simple applescript:
tell application "Opera"
get URL of active tab of window 1
end tell
I want to see Apple Events underlying. So I have launched it with these two environment variables enabled:
export AEDebugSends=1;
export AEDebugReceives=1
Now I am getting this output:
osascript browser.scpt
{core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID=15130}
I would expect to see calls to functions defined here: https://developer.apple.com/documentation/coreservices/apple_events?language=objc
My final goal is to translate that Applescript into c or Obj-C code.
Could someone help me to understand the meaning of the output?
Thanks in advance
would expect to see calls to functions defined here
Well, stop expecting that. What you have is the Apple event itself, expressed in AEPrint notation, as explained here:
https://developer.apple.com/library/archive/technotes/tn/tn2045.html
You can use that to construct the same Apple event, or you can form it in pieces using higher level commands. But either way, it is not up to the system to write your code for you! That is the Apple event, built for you by AppleScript. Learning to read AEPrint notation, learning the structure of an Apple event, learning to build the same Apple event by hand, is all something you must do yourself.
Just to give an example of the reasoning you will use:
Your Apple event starts with the verb coregetd. That is the Apple event equivalent of get (the first word in your AppleScript), as you learn from looking in the application's SDEF dictionary.
OK, now we know the verb; what's the direct object? It's an URLĀ  (note the space, these are four-letter codes); that is the Apple event equivalent of your URL (again, we learn this through the dictionary).
OK, but what URL? It's the URL of the acTa, which is the active tab (again, the dictionary shows us this equivalence).
OK, but the acTa of what? ...
And so on. Once you have broken down the Apple event into properties and elements and objects specifiers in this way, you can build it up again through Carbon or Cocoa commands.
You have chosen, for reasons that escape me, to embark on a very long journey. You have elected to throw away the simplicity of AppleScript notation and construct an Apple event yourself. You have chosen a long road involving much learning. There is no shortcut; the runtime is not going to write your code for you. The longest journey begins with the first step. Begin!

Add new experimenter match field in OVS source code

I would like to add new match field of type OXM_experimenter class OVS source code, could anyone share proper document or steps to do it. It needs changes in many of the files and functions and understanding OVS source is somewhat difficult. If any added already and tested, can you guide ?
I successfully did this before, however, I don't have access to the code anymore, only bookmarks to stuff. There is an old thread in the mailing lists that may help you: Link and Link.
I wanted to handle PACKET_IN events in OVS a bit differently, so I followed the way of packets from the data plane through the upcall bit to ofproto-dpif-xlate.c. On the way, I stumbled upon a lot of constants. After adding my own to the enums, the last bit missing was the experimenter field, which was somewhere in the python scripts as described in the links above.
I hope this helps, I'm in the process of getting access to the code again I'll update my answer then. If not, the OvS discuss mailing list and archives may help you too.

xdebug code coverage analysis with simpletest framework

I am doing unit testing with simpletest framework and using xdebug for code coverage reports. let me explain you my problem:
I have a class which I want to test lets assume name of class is pagination.php.
I write another class for testing. I wrote two test cases to test pagination class.
there are around 12 assertion in two test cases which giving me correct result "Pass".
Now I want to generate code coverage report, for this I use xdebug to show that my test cases covering all code or not. I use xdebug_start_code_coverage() function and for showing result I use xdebug_get_code_coverage() function.
Now the problem is that, when I print xdebug_get_code_coverage() Its give me 2 dimension assosiative array with filename, line no and execution times. the result is like this:
array
'path/to/file/pagination.php' =>
array
11 => int 1
113 => int 1
line 11 is start of class and line 113 is end of class. I don't know why it is not going inside class and why it is not giving the statement coverage for class functions. However, my test cases looks ok to me and I know all condition and branching covering are working.
I will really appreciate if you help me in this regard and guide me how to solve this problem.
Maybe I missed something here. If you want something more please let me know.
I implemented an XDebug-CC for a class with invoked methods and it works fine. Though I have to say that I am a bit confused about how this tool defines "executable code", it definitely takes account of methods.
You might check the location of your xdebug_start_code_coverage() and xdebug_get_code_coverage(), as those have to be invoked at the very beginning and the very end.
Also you might check your XDebug-version, as there has been some accuracy-improvements since the feature has been released.
Best
Raffael
SimpleTest has a coverage extension that is fairly easy to setup. IIRC it is only in svn and not the normal packaged downloads. (normally in simpletest/extensions/coverage/)
You can see articles for examples of how to implement it:
http://www.acquia.com/blog/calculating-test-coverage
http://drupal.org/node/1208382

Leopard Console logs for common files reference

I am using plugins for one of my Mac OS X(desktop) application. These plugins refer to a common file that contains base class implementation of both the plugins.
When the application refers to this common base class, the following message is displayed in the console by the system:
" is implemented in both and . One of the two will be used. Which one is undefined."
This console message is displayed from 10.5.x onwards.
However this does not cause any problem. But, I do not want my class name to be printed in the console. Can someone help to avoid this console message.
A possible way around is to #define the name of your class as something unrelated, so that it remains the same in your code, for your use, but is obfuscated in the executable.
I'd like a neater solution myself. I have searched quite a lot, and it seems that in general console messages are for solving problems, rather than for looking for them, and more specifically that this kind of message isn't really an issue.
One can also use an EXPORTED_SYMBOLS_FILE or an UNEXPORTED_SYMBOLS_FILE (these are the relevant build setting names) to state which symbols you do or don't want to export. Often, you want to export at least one, but it can reduce the number of names that are revealed.

Are there any limitations on what libraries can be imported in a t4 template?

We're trying to learn to use T4 Templates. I have a desire to use the System.Data.Entity.Design.PluralizationServices library in order to better pluralize some Entity Model names within my template, but I've come across some issues in the achievement of this goal.
Running code to generate output text. I think this is possible, but if it's not going to work, then there's no need to go any further. (I could call Date.Now.ToString() and get the expected result. I haven't tried anything much more complicated yet)
I am in a Silverlight App, and so I can't add a reference to the project for the PluralizationServices library in the place where I need the generated .cs file. I was planning on just moving the .tt file to a non-SL app, using the namespace and moving the generated file to the correct space. Haven't got that far yet, so I don't know how much trouble that will be, but it doesn't seem like it should be too hard.
My current problem is that when I import the namespace of the library, I get an "ErrorGeneratingOutput" and I haven't been able to move on past that yet.
I am having a hard time finding information about how the import command works, so I assume that it's just obvious. At the same time though, this one doesn't work so I wonder if it might be an exception to the standard.
<##import namespace="System.Data.Entity.Design.PluralizationServices" #>
I have no idea why adding this line (and only this line) causes everything to break. I haven't even started to try to use it yet! Is there something somewhere about libraries in T4 that I should know or read? Thanks!
Here a description of how the import directive works. Without knowing the actual error T4 reports when transofrming the template in your environment, I can only guess that you didn't add an assembly directive to reference the System.Data.Entity.Design assembly. If this doesn't work, look at the errors reported by T4 in the Error List of visual studio, which should be more helpful than "ErrorGeneratingOutput".

Resources