Ket, ket class definition. More...
#include <Ket.h>
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 Ket & | operator= (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; . |
Ket, ket class definition.
This class provides all the necessaries proprieties to work with kets and operators.
Ket::Ket | ( | int | dim_i = 1 |
) |
Ket::Ket | ( | int | dim_i, | |
complex< double > * | Vtab_i | |||
) |
Ket::Ket | ( | const Ket & | v | ) |
Constructor by copy.
To create a ket by copy, you need to pass the ket to be copied.
v | Ket to be copied. |
Ket::~Ket | ( | ) |
Destructor.
Destroy all ket data.
int Ket::getdim | ( | ) | const [inline] |
Send the Ket dimension.
double Ket::getnorme | ( | ) | const |
Send the vector norm.
complex< double > Ket::getscalarproduct | ( | Ket | right | ) | const |
Get the scalar product.
complex<double> Ket::operator() | ( | int | i | ) | const [inline] |
Read/Write vector elements.
complex<double>& Ket::operator() | ( | int | i | ) | [inline] |
Acces to vector elements.
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;.
Soustraction operator.
Allow the use of - operator, i.e.: a = a - b - ... - c;.
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.
Reimplemented in Bra.
void Ket::redim | ( | int | ndim | ) |
Modify the Ket dimension.
To modify the ket dimension you pass the new dimension.
ndim | New ket dimension. |
Ket - scalar double multiplication.
Ket - scalar complex multiplication.
Scalar double - ket multiplication.
Reimplemented in Bra.
Scalar complex - ket multiplication.
Reimplemented in Bra.
Ket - scalar double multiplication.
Ket - scalar complex multiplication.
EXPORTED_FUNCTION std::ostream& operator<< | ( | std::ostream & | out, | |
const Ket & | v | |||
) | [friend] |
Write to a flux, allow cout<<ket; .