Skip to content
Snippets Groups Projects
Commit d3e1efe1 authored by Christian Engwer's avatar Christian Engwer
Browse files

add method to compute the conjugate complex value of k

[[Imported from SVN: r5658]]
parent db37a396
No related branches found
No related tags found
No related merge requests found
......@@ -9,15 +9,15 @@
#include <iostream>
#include <sstream>
#include <complex>
#include "exceptions.hh"
#include "deprecated.hh"
namespace Dune {
/** \brief Map an integer value to a type
This comes in handy if one tries to emulate member function specialization.
The idea how to do it is presented in "Modern C++ Design" by Alexandrescu.
This comes in handy if one tries to emulate member function specialization.
The idea how to do it is presented in "Modern C++ Design" by Alexandrescu.
*/
template <int N>
struct Int2Type {
......@@ -29,6 +29,23 @@ namespace Dune {
@{
*/
//! compute conjugate complex of x
// conjugate complex does nothing for non-complex types
template<class K>
inline K conjugateComplex (const K& x)
{
return x;
}
#ifndef DOXYGEN
// specialization for complex
template<class K>
inline std::complex<K> conjugateComplex (const std::complex<K>& c)
{
return std::complex<K>(c.real(),-c.imag());
}
#endif
//! Return the sign of the value
template <class T>
int sign(const T& val)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment