Length of Array (and no we can’t always know that)

One way of checking whether an array is allocated correctly is the check if there are as many cells as you think there was going to be. In C++, this can be done using sizeof operator. Sizeof output the number of bytes an variable is taking up. So the size of an array can be found using the command

int num=5;
double array[num];


Hang on! What’s the size of *array? Usually the asterisk indicate you’re working with a pointer. Basically, this part output the size of the variable contained in the first cell of the array.sizeof(array) gives the size of the entire array, so the code gives you the number of cells.

However, this method doesn’t work if the array is allocated dynamically using

int num=5;
double* array;

array=new double[num];

If we try to find the size using


the result will be 1. Why is that? This is because array is declared as a pointer of type double, so it gives the size of a double variable, unlike when array is allocated statically. The sizeof(*array) will also give the size of a double variable. So no matter how large num is, this method will always give the size of 1.

How can we find the size of a dynamically allocated array? I don’t know a work around that doesn’t involve knowing the size of the array, because the array wouldn’t have any information that allows us to infer the size of the array.


Annotated Bibliography: Thomas-Peter’s Real-World Quantum Sensors: Evaluating Resources for Precision Measurement

Thomas-Peter, N., Smith, B. J., Datta, A., Zhang, L., Dorner, U., & Walmsley, I. A. (2011). Real-world quantum sensors: evaluating resources for precision measurement. Physical review letters, 107(11), 113603.

Type: Journal Article

Summary: The paper proposed a way of testing whether a measurement scheme breaks the standard quantum limit, because the normal limit is calculated using Fisher information and quantum Fisher information when the channel and the detection are ideal. The calculation in this paper included experimental imperfections.

How to Research a Machine Learning Algorithm – Reblog

Quantum Tunnel

How to Research a Machine Learning Algorithm

// A reblog from Machine Learning Mastery

Algorithms are a big part of the field of machine learning.

You need to understand what algorithms are out there, and how to use them effectively.

An easy way to shortcut this knowledge is to review what is already known about an algorithm, to research it.

In this post you will discover the importance of researching machine learning algorithms and the 5 different sources that you can use to accelerate your understanding of machine learning algorithms.

Research Machine Learning Algorithms

Research Machine Learning Algorithms
Photo by Anders Sandberg, some rights reserved

Why Research Machine Learning Algorithms

You need to understand algorithms to master machine learning.

Machine learning algorithms are not like other algorithms that you may be familiar with like sorting algorithms.

Not only are machine learning algorithms data-dependent, but they are adaptive. Often the heart of a given…

View original post 1,171 more words

Atomic Clocks: a really quick review

What is atomic clock?

An atomic clock is a time keeping device that uses the frequency of an atomic transition f_0 as the standard of time. This frequency is measured by measuring the probability of state transition after the atoms interact with an electromagnetic field of frequency f_p. The probability peaks when f_p=f_0. This frequency is set as the standard of 9,192,631,770 Hz for Cs-133 clock.

The measurement of the probability is done periodically determined by the time of flight of the atoms in the setup (going across the chamber in the beam clock, the time for the atom to travel up and down the path in the atomic fountain). f_p is set to different frequency each time.

What is the precision?

The precision of this method is equivalent to a shift of 1 second in 300 million years for cesium atomic fountain (10^{-16} Hz) [2].

Properties of transition and sources of noise

For a transition to be suitable for being a frequency standards, there are some properties [1] such as

  1. The linewidth of the transition has to be small. (Linewidth introduces noise in the frequency standard.)
  2. The interaction time between the atoms and light has to be long. (The signal is average over a long time.)
  3. The laser has small linewidth. (Again, linewidth introduces noise.)
  4. The signal-to-noise ratio for the transition is high.
  5. The transition should not be affected by electromagnetic field.
  6. Velocity of atoms has to be low. (Minimize the frequency error due to Doppler effect.)

Why do we need this precision?

The importance of atomic clocks is not in daily time keeping, but in applications like GPS where precise time keeping translate into a measure distance. With large conversion factor (the speed of light), the precision of the atomic clock is crucial in getting the position on the surface of the earth correctly.


  1. Bauch, Andreas. “Caesium atomic clocks: function, performance and applications.” Measurement Science and Technology 14.8 (2003): 1159.
  2. Laura Ost “NIST Launches a New U.S. Time Standard: NIST-F2 Atomic Clock.” (2014) Retrieved from http://www.nist.gov/pml/div688/nist-f2-atomic-clock-040314.cfm

Annotated Bibliography: Leoński’s Quantum Scissors — finite dimensional states engineering

W. Leoński, A. Kowalewska-Kudłaszyk, Chapter 3 – Quantum Scissors – Finite-Dimensional States Engineering, In: Emil Wolf, Editor(s), Progress in Optics, Elsevier, 2011, Volume 56, Pages 131-185. http://dx.doi.org/10.1016/B978-0-444-53886-4.00003-4. http://arxiv.org/abs/1312.0118 (Mickiewicz University, Poland)

Type: Book Chapter

Summary: They discuss methods of generating finite dimensional Fock-basis state from infinite-dimensional space and truncation. They describe coherent states (finite and infinite), squeezed state, and entangled state on Fock basis, as they use these states to generate a general state later. They go on to describe the method of generating truncated states using quantum scissors.

Linear quantum scissors (LQS) methods use the beam splitters as their main component in creating a general state of N photon. The state is controlled in part by the input state. One of the method uses Mach-Zehnder interferometer as the setup. The state is mostly post-selected with the exception of the BS-array scheme.

Nonlinear quantum scissors (NQS) methods involve Kerr medium inside high-Q cavity or Mach-Zehnder interferometer, fed by coherent and vacuum state. The state is post-selected. In this case, the photons are generated by the nonlinear medium and therefore cannot reach high number Fock state. The most shown in the paper is \left|2\right\rangle.

This work also include discussions on limitation and imperfection of the schemes of LQS and its connection to quantum teleportation.

Comments: This chapter is a review of the existing proposed techniques. Some of these techniques must have been implemented, but it is not clear which nor that seems to be the focus of the work.

From the perspective of quantum-enhanced metrology, NQS is not a very useful technique because the probability of getting high Fock states get progressively smaller because of the weak nonlinear interaction. LQS is more the way to go. although the input state requires might still be unrealistic (high number Fock state, for example).

Resources: Writing

Technical Writings:

  1. Michael Alley. The craft of scientific writing. Springer Science & Business Media, 1996.

Candidacy Proposal

  1. Holly Rushmeier. Preparing Your Thesis Proposal and Becoming a Ph.D. Candidate, Yale University, 2012. http://preview.tinyurl.com/mt26t5p

Resources: Quantum Information

Quantum Channel

  1. 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 Annotated Bibliography
  2. Leifer, Matt. “The Choi-Jamiolkowski Isomorphism: You’re Doing It Wrong!” (2011) http://mattleifer.info/2011/08/01/the-choi-jamiolkowski-isomorphism-youre-doing-it-wrong/

State Generation

  1. W. Leoński, A. Kowalewska-Kudłaszyk, Chapter 3 – Quantum Scissors – Finite-Dimensional States Engineering, In: Emil Wolf, Editor(s), Progress in Optics, Elsevier, 2011, Volume 56, Pages 131-185. http://dx.doi.org/10.1016/B978-0-444-53886-4.00003-4. http://arxiv.org/abs/1312.0118 (Mickiewicz University, Poland) Annotated Bibliography