1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
/*s***************************************************************************
*
* Copyright (c), Ilya Valuev 2005 All Rights Reserved.
*
* Author : Ilya Valuev, MIPT, Moscow, Russia
*
* Project : GridMD, ivutils
*
*
*
*****************************************************************************/
/*r @file vector_3.h @brief
*/
# ifndef CVECTOR_3A_H
# define CVECTOR_3A_H
# include <complex>
# include <cmath>
# include "vector_3.h"
using namespace std;
typedef complex<vec_type> cdouble;
typedef Vector_Nt<cdouble,3> cVector_3;
//------------------------------------------------------
// Overloads for cdouble
//------------------------------------------------------
inline cdouble operator*(int a, const cdouble &b){
return ((double)a)*b;
}
inline cdouble operator*(const cdouble &b,int a){
return a*b;
}
inline cdouble operator/(const cdouble &b,int a){
return (1./a)*b;
}
inline cdouble operator/(int a, const cdouble &b){
return (a)*(1./b);
}
//------------------------------------------------------
// Overloads for cVector_3
//------------------------------------------------------
inline cVector_3 operator*(const cdouble &a, const Vector_3 &v){
return cVector_3(a*v[0], a*v[1], a*v[2]); // a*cVector_3(v);
}
inline cVector_3 operator*(const Vector_3 &v, const cdouble &a){
return a*v;
}
inline Vector_3 real(const cVector_3 &cv){
return Vector_3(cv[0].real(), cv[1].real(), cv[2].real());
}
inline Vector_3 imag(const cVector_3 &cv){
return Vector_3(cv[0].imag(), cv[1].imag(), cv[2].imag());
}
inline cVector_3 conj(const cVector_3 &cv){
return cVector_3(conj(cv[0]), conj(cv[1]), conj(cv[2]));
}
inline cVector_3 rcell1(cVector_3& cv, Vector_3 &cell, int flags=0xffff) {
return cVector_3( real(cv).rcell1(cell, flags) ) + cdouble(0,1)*imag(cv);
}
# endif // __CVECTOR_3A_H
|