/* * utility.h * * Created on: Mar 22, 2011 * Author: ditlevsen */ #ifndef UTILITY_H_ #define UTILITY_H_ /**********************************************************************************/ /* functions, etc. for handling different data types in mathematical expressions */ /**********************************************************************************/ // overloaded versions of conj() and real() for scalar values... // (not needed when compiled with gcc and -std_c++0x) template inline Type conj(Type f) { return f; } template inline Type real(Type f) { return f; } template inline Type imag(Type f) { return 0; } // sign function template inline T_comp sign(T_comp x) { T_scal ax = std::abs(x); if(ax > 0) return x/ax; else return 0; } #endif /* UTILITY_H_ */