Getting started

  1. Download and install QLib, as specified here.
  2. Run Matab
  3. Type the following at the Matlab prompt (the " >> ")

    addpath ('C:\QLib'); qlib;

    Do not forget that the path on your machine will probably be different. See here for details.
    Expect the following output:

    QLIB - Quantum Information computation library, v1.0

    (c) Shai Machnes 2006-2007, Quantum Information and Foundations Group, Tel-Aviv University
    email: machness at
    All computer programs/code/scripts are released under the terms of the GNU Lesser General Public License 3.x, except where explicitly stated otherwise.. Everything else (documentation, algorithms, etc) is licensed under the Creative Commons Attribution-Share Alike 2.5 License (see "LICENSE.txt" for details)
    If you use QLib in your research, please add an attribution in the form of the following reference: quant-ph/???????

    QLIB inited successfully.

    Type "help qlib" for intro and a list of functions.

We'll start with some very simple stuff. Try the following:

pure = param_pure_1_rand([2 2])     % Generate a random pure state of two qubits.
is_entangled_pt(pure)     % Is this state entangled? (Peres-Horodecki criteria)

Next, let's plot the negativity and concurrence of 1000 random DMs of two qubits:

neg = []; con = [];
for k=1:1000
    dm = param_dm_2x_rand([2 2]);
    neg(k) = negativity(dm);
    con(k) = concurrence(dm);

Now let us plot various measures for the Werner states.
Note: The "@(x)" syntax in Matlab, which is used below, means that what follows the @(x) is a function of x.

draw2d_func (steps(0,1,200), @(x) negativity(Werner(x)),'g-+','LineWidth',2); hold on;
draw2d_func (steps(0,1,200), @(x) concurrence(Werner(x)),'k-'); hold on;
draw2d_func (steps(0,1,200), @(x) S_Von_Neumann(Werner(x)),'r-'); hold on;
draw2d_func (steps(0,1,200), @(x) linear_entropy(Werner(x)),'c-'); hold on;
draw2d_func (steps(0,1,200), @(x) mutual_info_dm(Werner(x)),'c-+'); hold on;
draw2d_func (steps(0,1,200), @(x) dist_Bures(Werner(x), eye(4)/4),'m-'); hold on;
draw2d_func (steps(0,1,200), @(x) dist_Bures_angle(Werner(x), eye(4)/4),'m:','LineWidth',2); hold on;
draw2d_func (steps(0,1,200), @(x) dist_KL(Werner(x), eye(4)/4),'k:','LineWidth',2); hold on;
legend({'Concurrence','negativity','Von Neumann entropy','linear entropy', 'mutual information', 'Bures', 'Bures angle', 'Kullback-Leibler dist.'});

If you do not know what the concurrence function does, simply ask for help:

help concurrence

For a full list of functions:

help qlib

QLib includes a large veriaty of demos to help you along with more complex concepts such as parametrization and optimization. For these and more explanations, in greater detail, please see the features page.