C++ 错误:在';之前需要构造函数、析构函数或类型转换&';代币

C++ 错误:在';之前需要构造函数、析构函数或类型转换&';代币,c++,C++,我得到一个错误: Complex.h|87|error: expected constructor, destructor, or type conversion before '&' token| Complex.h|88|error: expected constructor, destructor, or type conversion before '&' token| State.h|67|error: expected constructor, destructor,

我得到一个错误:

Complex.h|87|error: expected constructor, destructor, or type conversion before '&' token|
Complex.h|88|error: expected constructor, destructor, or type conversion before '&' token|
State.h|67|error: expected constructor, destructor, or type conversion before '&' token|
State.h|68|error: expected constructor, destructor, or type conversion before '&' token|
这是一个图书馆

我尝试使用gcc/codeblocks/mingw编译simple.cc文件。下面有两块代码,分别是complex.h和state.h

// Complex.h     -*- C++ -*-

/*
Copyright (C) 1988 Free Software Foundation
    written by Doug Lea (dl@rocky.oswego.edu)

This file is part of the GNU C++ Library.  This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.  This library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/

// Modified by rschack

#ifndef _Complex_hhh
#define _Complex_hhh 1

#include <iostream>
#include <cmath>

class Complex
{
public:

//protected:

  double           re;
  double           im;

  double           real() const;
  double           imag() const;

                   Complex();
                   Complex(const Complex& y);
                   Complex(double r, double i=0);

                  ~Complex();

  Complex&         operator =  (const Complex& y);

  Complex&         operator += (const Complex& y);
  Complex&         operator += (double y);
  Complex&         operator -= (const Complex& y);
  Complex&         operator -= (double y);
  Complex&         operator *= (const Complex& y);
  Complex&         operator *= (double y);

  Complex&         operator /= (const Complex& y);
  Complex&         operator /= (double y);

  void             error(const char* msg) const;

  Complex&         timesI ();
  Complex&         timesMinusI ();
};


// non-inline functions

double    hypotenuse (double, double);

Complex   operator /  (const Complex& x, const Complex& y);
Complex   operator /  (const Complex& x, double y);
Complex   operator /  (double   x, const Complex& y);

Complex   cos(const Complex& x);
Complex   sin(const Complex& x);

Complex   cosh(const Complex& x);
Complex   sinh(const Complex& x);

Complex   exp(const Complex& x);
Complex   log(const Complex& x);

Complex   pow(const Complex& x, int p);
Complex   pow(const Complex& x, const Complex& p);
Complex   pow(const Complex& x, double y);
Complex   sqrt(const Complex& x);

istream&  operator >> (istream& s, Complex& x);
ostream&  operator << (ostream& s, const Complex& x);


// inline members

inline double  Complex::real() const { return re; }
inline double  Complex::imag() const { return im; }

inline Complex::Complex() {}
inline Complex::Complex(const Complex& y) :re(y.real()), im(y.imag()) {}
inline Complex::Complex(double r, double i) :re(r), im(i) {}

inline Complex::~Complex() {}

inline Complex&  Complex::operator =  (const Complex& y)
{
  re = y.real(); im = y.imag(); return *this;
}

inline Complex&  Complex::operator += (const Complex& y)
{
  re += y.real();  im += y.imag(); return *this;
}

inline Complex&  Complex::operator += (double y)
{
  re += y; return *this;
}

inline Complex&  Complex::operator -= (const Complex& y)
{
  re -= y.real();  im -= y.imag(); return *this;
}

inline Complex&  Complex::operator -= (double y)
{
  re -= y; return *this;
}

inline Complex&  Complex::operator *= (const Complex& y)
{
  double r = re * y.real() - im * y.imag();
  im = re * y.imag() + im * y.real();
  re = r;
  return *this;
}

inline Complex&  Complex::operator *= (double y)
{
  re *=  y; im *=  y; return *this;
}


//  functions

inline int  operator == (const Complex& x, const Complex& y)
{
  return x.real() == y.real() && x.imag() == y.imag();
}

inline int  operator == (const Complex& x, double y)
{
  return x.imag() == 0.0 && x.real() == y;
}

inline int  operator != (const Complex& x, const Complex& y)
{
  return x.real() != y.real() || x.imag() != y.imag();
}

inline int  operator != (const Complex& x, double y)
{
  return x.imag() != 0.0 || x.real() != y;
}

inline Complex  operator - (const Complex& x)
{
  return Complex(-x.real(), -x.imag());
}

inline Complex  conj(const Complex& x)
{
  return Complex(x.real(), -x.imag());
}

inline Complex  operator + (const Complex& x, const Complex& y)
{
  return Complex(x.real() + y.real(), x.imag() + y.imag());
}

inline Complex  operator + (const Complex& x, double y)
{
  return Complex(x.real() + y, x.imag());
}

inline Complex  operator + (double x, const Complex& y)
{
  return Complex(x + y.real(), y.imag());
}

inline Complex  operator - (const Complex& x, const Complex& y)
{
  return Complex(x.real() - y.real(), x.imag() - y.imag());
}

inline Complex  operator - (const Complex& x, double y)
{
  return Complex(x.real() - y, x.imag());
}

inline Complex  operator - (double x, const Complex& y)
{
  return Complex(x - y.real(), -y.imag());
}

inline Complex  operator * (const Complex& x, const Complex& y)
{
  return Complex(x.real() * y.real() - x.imag() * y.imag(),
                 x.real() * y.imag() + x.imag() * y.real());
}

inline Complex  operator * (const Complex& x, double y)
{
  return Complex(x.real() * y, x.imag() * y);
}

inline Complex  operator * (double x, const Complex& y)
{
  return Complex(x * y.real(), x * y.imag());
}

inline double  real(const Complex& x)
{
  return x.real();
}

inline double  imag(const Complex& x)
{
  return x.imag();
}

inline double  abs(const Complex& x)
{
  return hypotenuse(x.real(), x.imag());
}

inline double  norm(const Complex& x)
{
  return (x.real() * x.real() + x.imag() * x.imag());
}

inline double  arg(const Complex& x)
{
  return atan2(x.imag(), x.real());
}

inline Complex  polar(double r, double t)
{
  return Complex(r * cos(t), r * sin(t));
}

#endif //_Complex_hhh



//   State.h -*- C++ -*- State algebra in Hilbert space.
//     
//   Copyright (C) 1995  Todd Brun and Ruediger Schack
//   
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version.
//   
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//   
//   You should have received a copy of the GNU General Public License
//   along with this program; if not, write to the Free Software
//   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//   ----------------------------------------------------------------------
//   If you improve the code or make additions to it, or if you have
//   comments or suggestions, please contact us:
//
//   Dr. Todd Brun                  Tel    +44 (0)171 775 3292
//   Department of Physics                      FAX    +44 (0)181 981 9465
//   Queen Mary and Westfield College           email  t.brun@qmw.ac.uk
//   Mile End Road, London E1 4NS, UK
//
//   Dr. Ruediger Schack                        Tel    +44 (0)1784 443097
//   Department of Mathematics                  FAX    +44 (0)1784 430766
//   Royal Holloway, University of London       email  r.schack@rhbnc.ac.uk
//   Egham, Surrey TW20 0EX, UK
/////////////////////////////////////////////////////////////////////////////

#ifndef _State_hhh
#define _State_hhh 1

#include "Complex.h"

enum FreedomType{ ALL, FIELD, SPIN, ATOM };
// FreedomType lists the different types of physical systems specifically
// recognized by this program; more may be added if necessary.
// FIELD is an oscillator degree of freedom, which is described in the
//   Fock state or Excited Coherent State basis;
// SPIN is a spin 1/2 or two-level atom;
// ATOM is an atom or N-level system;
// ALL leaves the physical type of system unspecified.
// Note that certain member functions will only work for degrees of freedom
// of a particular type.

enum ImaginaryUnit{ IMAGINARY_UNIT, MINUS_IMAGINARY_UNIT };
const ImaginaryUnit IM = IMAGINARY_UNIT;
const ImaginaryUnit M_IM = MINUS_IMAGINARY_UNIT;
// For efficiency, special routines have been included allowing States
// and Operators to be multiplied by i and -i without invoking the full
// Complex arithmetic.  Note that multiplication by ImaginaryUnit is
// define ONLY for States and Operators; 3*IM is not a legal
// expression.

#ifndef NON_GNU_PROTOTYPE
  class PrimaryOperator;
#else
  extern class PrimaryOperator;
#endif

// I/O functions for FreedomType

ostream& operator<<( ostream&, FreedomType );
istream& operator>>( istream&, FreedomType& );

class State{
// The State class represents quantum states in a particular choice of
// Hilbert space; this can include varying numbers of physical degrees
// of freedom, described by varying numbers of basis states.

public:                     // public functions

// constructors and destructors

  State();
    // Default constructor; produces a State of size 0.
  State(const State& state);
    // Copy constructor.
  State(int n, FreedomType form=FIELD);
    // Produces a single degree-of-freedom State with n basis states;
    // all basis states have amplitude 0 except the ground state,
    // which has amplitude 1; form gives the FreedomType of the State
    // (default is FIELD).
  State(int n, int* dimensions, FreedomType* forms);
    // Multiple degree of freedom ground State.  n gives the number of
    // degrees of freedom; dimensions is an array of n integers, which
    // specify the number of basis states to allocate for each degree
    // of freedom; forms is an array of n FreedomTypes, giving the
    // physical type of each degree of freedom.  The basis of the full
    // n-freedom state is given by the products of the basis states of
    // the n freedoms; all have amplitude 0 except for the ground state.
  State(int n, Complex* elements, FreedomType form=FIELD);
    // Produces a one degree-of-freedom State with n basis
    // states.  elements is an array of n Complex numbers, representing
    // the amplitudes of the n basis states; form gives the FreedomType
    // of the State (default is FIELD).
  State(int n, int nstate, FreedomType form=FIELD); // Fock state
    // Produces a single degree-of-freedom State with n basis states;
    // all basis states have amplitude 0 except state number nstate,
    // which has amplitude 1; form gives the FreedomType of the State
    // (default is FIELD).
  State(int n, Complex alpha, FreedomType form=FIELD);  // Coherent state
    // Produces a one degree-of-freedom State with n basis
    // states in a coherent state given by the Complex number alpha.
    // The State is represented in a Fock (number) state basis.
    // form gives the FreedomType of the State (default is FIELD).
  State(int n, int nstate, Complex alpha, FreedomType form=FIELD);
    // Excited coherent state.  Produces a single degree-of-freedom State
    // with n basis states.  Basis state number nstate has amplitude 1,
    // all others have amplitude 0, and the state is in the excited coherent
    // state or displaced Fock state basis, centered at alpha in phase space.
    // form gives the FreedomType of the State (default is FIELD).
  State(int n, State* stateList);       // Product state
    // Produces an n degree-of-freedom state.  stateList is an array of
    // n one-freedom states.  The n-freedom state will be produced in a
    // product state of the n states in stateList.  The FreedomTypes and
    // dimensions of the different freedoms of the n-freedom state will
    // match those of the one-freedom states in stateList.
  ~State();                 // destructor

// public functions used by constructors and destructors

  void fock(int n, int nstate);         // create a Fock state
  void coherent(int n, Complex alpha);      // create a Coherent state
  void productState(int n, State* stateList);   // create a product state

// Member arithmetic operations

  inline Complex& operator[](int n) {           // subscript operator; gives
     if( nSkip != 1 )               // access to the amplitude
       return myPointer[nSkip*n];       // of the nth basis state
     else                   // Note that this amplitude
       return myPointer[n];         // can be changed as well as
  };                        // read.  Usage: psi[n]
                        // Note the presence of nSkip;
                        // this is part of the
                        // SkipVector structure, used
                        // for multiple freedom states
  Complex elem(const int*) const;
    // MultiDim subscripting; takes as an argument an array of integers
    // of length equal to the number of degrees of freedom.  Returns
    // the amplitude of the corresponding basis state.  Note that this
    // subscripting is read-only.  Usage: psi.elem(n_array)
  Complex& operator[](int*);
    // same as elem (above), but also permits the amplitudes to be
    // changed.  Usage:  psi[n_array]
  State& operator=(const State&);       // assignment
  State& operator=(int);
    // zero assignment; enables one to type psi=0 to set all amplitudes
    // to 0.  Gives an error for any int other than 0.
  Complex operator*(const State&) const;    // inner product
  State& operator*=(const Complex&);        // multiply by Complex scalar
  State& operator*=(double);            // multiply by real scalar
  State& operator*=(ImaginaryUnit);     // multiply by ImaginaryUnit
  State& operator+=(const State&);      // add a State
  State& operator-=(const State&);      // subtract State

// Friend arithmetic operations

  friend State operator*(const Complex&, const State&);
    // multiply a State by a Complex scalar:  z*psi
  friend State operator*(const State&, const Complex&);
    // multiply a State by a Complex scalar (other order): psi*z
  friend State operator*(double, const State&);
    // multiply a State by a real scalar:  x*psi
  friend State operator*(const State&, double);
    // multiply a State by a real scalar (other order):  psi*x
  friend State operator*(ImaginaryUnit, const State&);
    // multiply a State by an ImaginaryUnit (i or -i)
  friend State operator*(const State&, ImaginaryUnit);
    // multiply a State by an ImaginaryUnit (i or -i) (other order)
  friend State operator+(const State&, const State&);
    // add two States
  friend State operator-(const State&, const State&);
    // subtract one State from another
  friend State operator+(const State&);     // unary +
  friend State operator-(const State&);     // unary -

// Friend I/O operations

  friend ostream& operator<<( ostream&, const State&);
    // outputs a state in a standard ASCII form.  This can be used to
    // save and recover results of a calculation.
  friend istream& operator>>( istream&, State& );
    // inputs a state in a standard ASCII form.  This can be used to
    // save and recover results of a calculation.

// Information-returning and utility member functions

  void xerox(const State& a);
    // make MINIMAL copy of State (for use in temps).  Improves efficiency
    // when dynamical allocation of basis states is being used.  Chiefly
    // used by the Operator class; should not be needed by ordinary users.
    // For an explanation of the dynamical allocation see adjustCutoff
    // below.
  int size();           // length of data array
  int getSize(int = 0);     // size of nth degree of freedom
  void diagnostic();        // debugging info
  void normalize();     // normalize state, i.e., psi*psi = 1

// Member functions accessing coordinates; for a full explanation of
// this, see the basis-changing member functions below.

  Complex centerCoords();
    // return center of coordinates
  Complex getCoords(int = 0);
    // center of coordinates of nth freedom (default 0)
  void setCoords(Complex&,int=0);
    // set the value of the coords for a freedom (default 0)
  void displaceCoords(Complex&, int=0);
    // adds a Complex displacement to the center of
    // coordinates of a freedom (default freedom is 0)
  double checkBounds(int, int=2);
    // check amplitudes of top basis states
    // (default: top 2 basis states)

// Basis-changing member functions

// This QSD library makes use of the localization property to greatly
// improve the efficiency of calculations.  In QSD, for a wide variety
// of problems, field states tend towards highly localized wavepackets
// in phase space.  These wave packets are closely centered on some point
// alpha (a Complex number) which is given by the expectation value
// alpha = <a>, where a is the harmonic oscillator annihilation operator.
//
// If alpha is large, it requires a great many ordinary Fock states to
// represent such a wavepacket; the number of Fock states n goes like
// |alpha|^2.  By choosing a different set of basis states an enormous
// savings is possible.
//
// We use the excited coherent state basis |alpha,n> to represent our
// states, choosing alpha=<a> for maximum efficiency.  (Ordinary Fock
// states would correspond to alpha=0.)  As the value of <a> will change
// with time, the basis must also be changed fairly often.  This adds to
// the cost of a calculation; but the savings from the moving basis
// far outweigh this added complexity.
//
// Note that this only applies to freedoms of type FIELD.  For multiple
// degree-of-freedom states, each FIELD degree of freedom can be moved
// separately.  Trying to move the basis of a non-FIELD freedom will
// produce an error.
//
// Note also that the user is not required to use the moving basis.  For
// problems without strong localization, the moving basis adds to the
// computational overhead while producing little benefit, and should not
// be invoked.
//
// For further details, see J. Phys. A 28, 5401-5413 (1995).

  void moveCoords(const Complex& displacement, int theFreedom=0,
      double shiftAccuracy=1e-4);
    // Relative shift of the center of coordinates.  displacement
    // gives the amount by which to shift alpha, theFreedom indicates
    // which degree of freedom is to be shifted.  shiftAccuracy
    // gives the accuracy with which to make the shift
    // (default 1e-4).  The physical state is unchanged, but it is
    // represented in a new basis |alpha+displacement,n>
    // Uses private moveStep member function.
  void recenter(int theFreedom=0,double shiftAccuracy=1e-4);
    // Recenters freedom theFreedom at its expectation value in phase space.
    // The physical state is unchanged, but is represented in a new
    // basis |<a>,n>, a being the annihilation operator for the
    // selected degree of freedom.  Uses moveCoords.
  void moveToCoords(const Complex& alpha, int theFreedom=0,
      double shiftAccuracy=1e-4);
    // Like moveCoords, but instead of shifting by a Complex displacement
    // it moves the basis to a new absolute position alpha in phase space.
    // Uses moveCoords.
  void centerOn(State& psi,double shiftAccuracy=1e-4);
    // Leaves the physical state unchanged, but represents it in the
    // same basis as the given state psi.  Uses moveCoords.  Can be used
    // with multiple degree-of-freedom states, though the states must
    // have the same number and type of freedoms; it will change the
    // basis only of the FIELD degrees of freedom.

// Cutoff-adjusting member functions

// For efficiency, it is possible to restrict the number of basis vectors
// actually used by including only those with amplitudes appreciably
// greater than zero.  The criterion used is based on two parameters:
// epsilon and padSize.  All of the top states of a freedom whose total
// probability is less than epsilon are excluded except for a number of
// "buffer" basis states, or "pad", equal to padSize.  If the "pad" begins
// to gain appreciable probability (i.e., probability over epsilon) the
// number of basis states can be dynamically increased.  In this way,
// no more basis states are used than are necessary.  This is particularly
// useful in conjunction with the moving basis.

  void adjustCutoff(int theFreedom=0, double epsilon=1e-4, int padSize=2);
    // adjust amount of storage used by the State by adjusting the
    // cutoff for freedom number theFreedom.
  void fullSize();  // makes size of state match physical size of storage

private:            // private data and functionss

// SkipVector part -- used to act on single degree of freedom in memory
//
// The QSD code assumes that all Operators are defined in terms of Primary
// Operators which act on a single degree of freedom.  In order for this
// to work successfully, it must be possible to loop over a single degree
// of freedom, leaving all the others unchanged.  This is embodied in the
// notion of a SkipVector -- a data structure which is treated like an
// ordinary array, but steps through memory by an ``skip'' larger than one.

  Complex* myPointer;       // pointer to storage
  int mySize;           // array size
  int nSkip;            // steps between elements (the ``skip'')

// One dimensional state part --
// used for greater efficiency in 1 Freedom problems

  int totalDim;         // total number of elements
  int maxSize;          // number of elements actually used
  FreedomType myType;       // type of freedom
  Complex* data;        // element storage; this points to an array
                // of complex numbers giving the amplitudes
                // of the basis states
  Complex coord;        // center of coordinates in phase space
                // (see the moving basis, above)

// MultiState part -- used for >1 degrees of freedom
//
// The basis states for a multiple-degree-of-freedom state are the
// products of the basis states of the individual degrees of freedom
// which make up the total state.  If there are n_i basis states to
// represent the ith degree of freedom, then a particular basis state
// of the total state is given by indices {i_0,...,i_N} for an N+1 freedom
// state.
//
// The amplitudes for these basis states are stored in the array data,
// just as for single degree-of-freedom states.  The amplitude for the
// basis state {i_0,...,i_N} is stored at the location
//
//   loc = i_0 + i_1*n_0 + i_2*n_0*n_1 + ... + i_N*n_0*...*n_(N-1).
//
// where i_m ranges from 0 to n_m-1.
//
// Incrementing the mth index by 1 is equivalent to stepping through
// the data array by an amount
//
//   nSkips[m] = n_0*n_1*...*n_(m-1).

  int nFreedoms;        // number of degrees of freedom
  int* nDims;           // number of dimensions (basis states)
                // for each freedom
  int* sizes;           // number of dimensions (basis states)
                // actually used by each freedom
  int* nSkips;          // index spacing in data field of ith freedom
  int* partDims;        // subspace dim of first i freedoms
  FreedomType* freedomTypes;    // types of degrees of freedom (FIELD, SPIN, etc.)
  Complex* coords;      // centers of coordinates in phase space

// Private member functions

  void apply(PrimaryOperator&, int, int, FreedomType, double);
    // apply a PrimaryOperator to a State
  void copy(const State&);      // copy a state
  void free();              // recycle storage
  void moveStep(Complex&, Complex&);    // shift coords by infinitesimal step
  void stretchFreedom(int,int);     // increase storage used by a freedom
  void shrinkFreedom(int,int);      // compact storage used by a freedom
  void error(const char*) const;    // print out error message and exit

  friend class Operator;            // friend class
};

#endif
<代码> //复合物.H*-C++ +*- /* 版权(C)1988免费软件基金会 作者:道格·李(dl@rocky.oswego.edu) 这个文件是GNU C++库的一部分。这个图书馆是免费的 软件;您可以根据以下条款对其进行重新分发和/或修改: 免费提供的GNU库通用公共许可证 软件基础;许可证的第2版,或(在您的 选项)任何更高版本。这个图书馆是在霍普分发的 它将是有用的,但没有任何保证;甚至没有 对特定产品的适销性或适用性的默示保证 目的。有关更多详细信息,请参阅GNU库通用公共许可证。 您应该已经收到一份GNU公共图书馆的副本 与此库一起使用的许可证;如果没有,请写信给自由软件 基金会,675弥撒大道,剑桥,马02139,USA. */ //由rschack修改 #ifndef_综合体 #定义复杂度1 #包括 #包括 阶级情结 { 公众: //受保护: 双re; 双im; 双实()常数; 双imag()常量; 复合物(); 综合体(const Complex&y); 复合物(双r,双i=0); ~Complex(); 复数和运算符=(常数复数和y); 复数和运算符+=(常数复数和y); 复数&运算符+=(双y); 复数和运算符-=(常数复数和y); 复合运算符-=(双y); 复数和运算符*=(常数复数和y); 复数和运算符*=(双y); 复数和运算符/=(常数复数和y); 复数和运算符/=(双y); 无效错误(常量字符*消息)常量; 复杂×I(); Complex&i(); }; //非内联函数 双斜边(双,双); 复数运算符/(常数复数&x,常数复数&y); 复数运算符/(常数复数&x,双y); 复算子/(双x,常数复&y); 复cos(const-Complex&x); 复sin(const-Complex&x); 复cosh(const-Complex&x); 复合sinh(const Complex&x); 复杂经验(常数复杂&x); 复杂日志(const Complex&x); 复杂功率(常数复杂&x,整数p); 复杂功率(常数复杂和x、常数复杂和p); 复功率(常数复x,双y); 复杂sqrt(常数复杂和x); istream&operator>>(istream&s、Complex&x); ostream&运营商代表我们的 //状态,选择alpha=以获得最大效率。(普通福克) //状态将对应于alpha=0。),因为的值将发生变化 //随着时间的推移,基础也必须经常改变。这增加了 //计算的成本;但是移动基础的节省 //这远远超过了增加的复杂性。 // //请注意,这仅适用于类型字段的自由度。多次 //自由度状态下,每个场的自由度都可以移动 //分开。尝试移动非场自由的基础将 //产生错误。 // //还请注意,用户不需要使用移动基准。对于 //问题没有很强的局部化,移动的基础会增加问题的严重性 //计算开销虽然产生的效益很小,但不应 //被调用。 // //有关更多详细信息,请参见J.Phys。A 285401-5413(1995年)。 void moveCoords(常数复数和位移,int-theFreedom=0, 双移位精度=1e-4); //坐标中心的相对位移。取代 //给出移动alpha的量,自由度表示 //哪种自由度将被改变。移位准确性 //提供进行换档的精度 //(默认为1e-4)。物理状态不变,但它是 //以新基表示|α+位移,n> //使用私有moveStep成员函数。 无效重新居中(int-theFreedom=0,双移位精度=1e-4); //在相空间中将自由度重新居中于其期望值。 //物理状态不变,但以新的形式表示 //基|,n>,a是 //选定的自由度。使用moveCoords。 void moveToCoords(const Complex&alpha,int theFreedom=0, 双移位精度=1e-4); //与moveCoords类似,但不是通过复杂位移进行移动 //它将基础移动到相空间中新的绝对位置alpha。 //使用moveCoords。 真空中心(状态和psi,双位移精度=1e-4); //保持物理状态不变,但在 //与给定状态psi相同的基础。使用moveCoords。可以使用 //具有多个自由度状态,但这些状态必须 //拥有相同数量和类型的自由;它将改变世界 //仅以场自由度为基础。 //切断调节件功能 //为了提高效率,可以限制基向量的数量 //实际使用时,仅包括振幅明显的那些 //大于零。使用的标准基于两个参数: //ε和焊盘尺寸。一个自由的所有最高状态 //概率小于epsilon,但排除了一些 //“缓冲区”基态或“焊盘”,等于焊盘大小。如果“pad”开始 //为了获得可观的概率(即ε上的概率) //可以动态增加基态的数量。这样,, //使用的基态不超过所需的基态。这尤其重要 //与移动基础结合使用非常有用。 空隙调整切断(int自由度=0,双ε=1e-4,int焊盘尺寸=2); //通过调整 //库托
operator >>
operator>>
std::istream&  operator >> (std::istream& s, Complex& x);
std::istream&  operator >> (std::istream& s, Complex& x);
std::ostream&  operator << (std::ostream& s, const Complex& x);