Quantum/well/complex.h
2023-12-16 16:17:02 +01:00

23 lines
474 B
C++

#ifndef COMPLEX_H
#define COMPLEX_H
class complex {
public:
double re, im;
public:
complex (const double x=0.0, const double y=0.0);
complex & operator*= (const double a) {
re *= a; im *= a;
return * this;
}
complex & operator+= (const complex & a) {
re += a.re; im += a.im;
return * this;
}
complex & exp (const unsigned n);
double abs () const {
return re * re + im * im;
}
};
#endif // COMPLEX_H