00001 /**************************************************************************** 00002 * CQEDSimulator, a dynamic library for C/C++ programs 00003 * Copyright (C) 2009 Stefano Carrazza. All rights reserved. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 *****************************************************************************/ 00019 00020 #ifndef QO_H 00021 #define QO_H 00022 00023 #ifdef WIN32 00024 #define EXPORTED_FUNCTION __declspec(dllexport) 00025 #else 00026 #define EXPORTED_FUNCTION 00027 #endif 00028 00029 #include "QOperators.h" 00030 00032 00037 EXPORTED_FUNCTION Ket basis(int dim_i,int comp); 00038 00039 00041 00042 class EXPORTED_FUNCTION TensorKet: public Ket 00043 { 00044 private: 00045 Ket *oprs; 00046 int *Hdim; 00047 int Htot; 00048 int nb; 00049 public: 00050 TensorKet(Ket a, Ket b); 00051 TensorKet(int Nb,Ket *ket); 00052 ~TensorKet(); //<! Destructor. 00053 int getNb() const { return nb; } 00054 int getHtot() const { return Htot; } 00055 int getHdim(int object) const { return Hdim[object-1]; } 00056 Ket getKet(int i) const { return oprs[i-1]; } 00057 Ket getPartialTrace(int respectto); 00058 }; 00059 00061 00062 class EXPORTED_FUNCTION TensorBra: public Bra 00063 { 00064 private: 00065 int *Hdim; 00066 int Htot; 00067 public: 00068 TensorBra(Bra a, Bra b); 00069 TensorBra(int Nb,Bra *bra); 00070 ~TensorBra(); 00071 }; 00072 00074 00075 class EXPORTED_FUNCTION TensorQOperator: public QOperator 00076 { 00077 private: 00078 QOperator *oprs; 00079 int *Hdim; 00080 int Htot; 00081 int nb; 00082 public: 00083 TensorQOperator(QOperator a,QOperator b); 00084 TensorQOperator(int Nb,QOperator *op); 00085 ~TensorQOperator(); 00086 int getNb() const { return nb; } 00087 int getHtot() const { return Htot; } 00088 int getHdim(int object) const { return Hdim[object-1]; } 00089 QOperator getQOperator(int i) const { return oprs[i-1]; } 00090 QOperator getPartialTrace(int respectto); 00091 }; 00092 00093 00094 #endif 00095