Ket Class Reference

Ket, ket class definition. More...

#include <Ket.h>

Inheritance diagram for Ket:
Bra TensorKet TensorBra

List of all members.

Public Member Functions

 Ket (int dim_i=1)
 Default constructor, creates a Ket with dimension igual 1.
 Ket (int dim_i, complex< double > *Vtab_i)
 Creates a Ket with dimension dim_i, and data Vtab_i.
 Ket (const Ket &v)
 Constructor by copy.
 ~Ket ()
 Destructor.
int getdim () const
 Send the Ket dimension.
void redim (int ndim)
 Modify the Ket dimension.
Bra getbra () const
 Send the respective Bra.
complex< double > getscalarproduct (Ket right) const
 Get the scalar product.
double getnorme () const
 Send the vector norm.
void print () const
 Print the vector in a column.
complex< double > & operator() (int i)
 Acces to vector elements.
complex< double > operator() (int i) const
 Read/Write vector elements.
const Ketoperator= (const Ket &v)
 Affectation operator.
Ket operator+ (const Ket &v) const
 Addition operator.
Ket operator- (const Ket &v) const
 Soustraction operator.
void operator+= (const Ket &v)
 += operator.

Friends

EXPORTED_FUNCTION Ket operator* (complex< double > a, const Ket &v)
 Scalar complex - ket multiplication.
EXPORTED_FUNCTION Ket operator* (double a, const Ket &v)
 Scalar double - ket multiplication.
EXPORTED_FUNCTION Ket operator* (const Ket &v, complex< double > a)
 Ket - scalar complex multiplication.
EXPORTED_FUNCTION Ket operator* (const Ket &v, double a)
 Ket - scalar double multiplication.
EXPORTED_FUNCTION Ket operator/ (const Ket &v, complex< double > a)
 Ket - scalar complex multiplication.
EXPORTED_FUNCTION Ket operator/ (const Ket &v, double a)
 Ket - scalar double multiplication.
EXPORTED_FUNCTION complex< double > operator* (const Bra &bra, const Ket &ket)
 Bra - Ket multiplication.
EXPORTED_FUNCTION QOperator operator* (const Ket &ket, const Bra &bra)
 Ket - Bra multiplication.
EXPORTED_FUNCTION std::ostream & operator<< (std::ostream &out, const Ket &v)
 Write to a flux, allow cout<<ket; .

Detailed Description

Ket, ket class definition.

This class provides all the necessaries proprieties to work with kets and operators.


Constructor & Destructor Documentation

Ket::Ket ( int  dim_i = 1  ) 

Default constructor, creates a Ket with dimension igual 1.

To create a ket with all elements 0, you need to pass a valid dimension (dim_i > 0).

Parameters:
dim_i Ket column dimension.
Ket::Ket ( int  dim_i,
complex< double > *  Vtab_i 
)

Creates a Ket with dimension dim_i, and data Vtab_i.

To create a ket with all elements 0, you need to pass a valid dimension and an array

Parameters:
dim_i Ket column dimension.
Vtab_i Array with data.
Ket::Ket ( const Ket v  ) 

Constructor by copy.

To create a ket by copy, you need to pass the ket to be copied.

Parameters:
v Ket to be copied.
Ket::~Ket (  ) 

Destructor.

Destroy all ket data.


Member Function Documentation

Bra Ket::getbra (  )  const

Send the respective Bra.

Returns:
Returns the respective Bra.
int Ket::getdim (  )  const [inline]

Send the Ket dimension.

double Ket::getnorme (  )  const

Send the vector norm.

Returns:
Returns the ket norm as the vector norm.
complex< double > Ket::getscalarproduct ( Ket  right  )  const

Get the scalar product.

Returns:
Returns the scalar product between 2 kets as 2 VECTORS, it's not the tensor product.
complex<double> Ket::operator() ( int  i  )  const [inline]

Read/Write vector elements.

complex<double>& Ket::operator() ( int  i  )  [inline]

Acces to vector elements.

Ket Ket::operator+ ( const Ket v  )  const

Addition operator.

Allow the use of the + operator, i.e.: a = a + b + ... + c;.

void Ket::operator+= ( const Ket v  ) 

+= operator.

Allow the use of += operator, i.e.: a += b;.

Ket Ket::operator- ( const Ket v  )  const

Soustraction operator.

Allow the use of - operator, i.e.: a = a - b - ... - c;.

const Ket & Ket::operator= ( const Ket v  ) 

Affectation operator.

Allow you to use the = operator, i.e.: Ket v = b; .

void Ket::print (  )  const

Print the vector in a column.

Allow you to print the ket as a column vector.

Returns:
Returns the ket output

Reimplemented in Bra.

void Ket::redim ( int  ndim  ) 

Modify the Ket dimension.

To modify the ket dimension you pass the new dimension.

Parameters:
ndim New ket dimension.
Returns:
Returns a modified ket.

Friends And Related Function Documentation

EXPORTED_FUNCTION QOperator operator* ( const Ket ket,
const Bra bra 
) [friend]

Ket - Bra multiplication.

Returns:
Returns a QOperator.
EXPORTED_FUNCTION complex<double> operator* ( const Bra bra,
const Ket ket 
) [friend]

Bra - Ket multiplication.

EXPORTED_FUNCTION Ket operator* ( const Ket v,
double  a 
) [friend]

Ket - scalar double multiplication.

EXPORTED_FUNCTION Ket operator* ( const Ket v,
complex< double >  a 
) [friend]

Ket - scalar complex multiplication.

EXPORTED_FUNCTION Ket operator* ( double  a,
const Ket v 
) [friend]

Scalar double - ket multiplication.

Reimplemented in Bra.

EXPORTED_FUNCTION Ket operator* ( complex< double >  a,
const Ket v 
) [friend]

Scalar complex - ket multiplication.

Reimplemented in Bra.

EXPORTED_FUNCTION Ket operator/ ( const Ket v,
double  a 
) [friend]

Ket - scalar double multiplication.

EXPORTED_FUNCTION Ket operator/ ( const Ket v,
complex< double >  a 
) [friend]

Ket - scalar complex multiplication.

EXPORTED_FUNCTION std::ostream& operator<< ( std::ostream &  out,
const Ket v 
) [friend]

Write to a flux, allow cout<<ket; .


The documentation for this class was generated from the following files:

Generated on Sun Sep 6 20:54:30 2009 for CQEDSimulator by  doxygen 1.6.1