Public Member Functions

QuCoSi::Vector Class Reference

Dynamic size vector of complex numbers. More...

Inheritance diagram for QuCoSi::Vector:

List of all members.

Public Member Functions

 Vector ()
 Constructs the two-dimensional vector (1 0)T
 Vector (const int dim)
 Constructs the null vector of dimension dim.
 Vector (const field &c0, const field &c1)
 Constructs the two-dimensional vector (c0 c1)T
Vectoroperator= (const VectorXc &v)
bool isNormalized () const
 Checks if this vector is an unit vector.
Vectorrandomize ()
 Sets all coefficients of this vector to random values.
Vector tensorDot (const Vector &v) const
 Computes the tensor product of this vector with v.
VectortensorDotSet (const Vector &v)
 Sets the tensor product of this vector and v as this vector.

Detailed Description

Dynamic size vector of complex numbers.

The Vector class is the base for all vectors and qubits used in QuCoSi. It is of dynamic size and uses complex numbers. Besides the standard methods that are inherited from the Eigen base class it offers some convenient methods like isNormalized() and randomize(). The most important feature of this class is the tensor product tensorDot() and tensorDotSet().

See also:
Qubit

Definition at line 38 of file Vector.


Constructor & Destructor Documentation

QuCoSi::Vector::Vector (  )  [inline]

Constructs the two-dimensional vector (1 0)T

Definition at line 43 of file Vector.

QuCoSi::Vector::Vector ( const int  dim  )  [inline]

Constructs the null vector of dimension dim.

Parameters:
dim the dimension of this vector

Definition at line 52 of file Vector.

QuCoSi::Vector::Vector ( const field c0,
const field c1 
) [inline]

Constructs the two-dimensional vector (c0 c1)T

Parameters:
c0 the first component of this vector
c1 the second component of this vector

Definition at line 59 of file Vector.


Member Function Documentation

Vector& QuCoSi::Vector::operator= ( const VectorXc v  )  [inline]

Reimplemented in QuCoSi::Qubit.

Definition at line 64 of file Vector.

bool QuCoSi::Vector::isNormalized (  )  const [inline]

Checks if this vector is an unit vector.

Returns:
true if this vector is an unit vector

Definition at line 74 of file Vector.

Here is the call graph for this function:

Vector& QuCoSi::Vector::randomize (  )  [inline]

Sets all coefficients of this vector to random values.

Returns:
a reference to *this

Definition at line 83 of file Vector.

Vector QuCoSi::Vector::tensorDot ( const Vector v  )  const [inline]

Computes the tensor product of this vector with v.

The tensor product $x \otimes y$ of the vectors $x \in K^n$ and $y \in K^m$ is defined as:

\[ \left(\begin{array}{c} x_1 \\ x_2 \\ \vdots \\ x_n \end{array}\right) \otimes \left(\begin{array}{c} y_1 \\ y_2 \\ \vdots \\ y_m \end{array}\right) = \left(\begin{array}{c} x_1 y_1 \\ \vdots \\ x_1 y_m \\ x_2 y_1 \\ \vdots \\ x_2 y_m \\ \vdots \\ x_n y_m \end{array}\right) \in K^{nm} \ . \]

Parameters:
v the right hand side operand of the tensor product
Returns:
the tensor product of this vector with Vector v

Definition at line 112 of file Vector.

Here is the caller graph for this function:

Vector& QuCoSi::Vector::tensorDotSet ( const Vector v  )  [inline]

Sets the tensor product of this vector and v as this vector.

This method computes the tensor product of this vector and Vector v and sets the result as this vector. For two vectors x and y

 x.tensorDotSet(y) 

is practically identical to

 x = x.tensorDot(y) 
Parameters:
v the right hand side operand of the tensor product
Returns:
a reference to *this
See also:
tensorDot()

Definition at line 134 of file Vector.

Here is the call graph for this function:


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs