Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
Hack around real-to-complex cast issue in Ublas or gcc 4.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jan 8, 2010
1 parent d214410 commit 07115d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cpp/pyublasext/matrix_operator.hpp
Expand Up @@ -319,7 +319,8 @@ namespace pyublasext
void apply(const OperandType &operand, ResultType result) const
{
super::apply(operand, result);

typedef typename real_operator::result_type::value_type real_t;
typedef std::complex<real_t> complex_t;
typename real_operator::operand_type
operand_real(real(operand)), operand_imag(imag(operand));
typename real_operator::result_type
Expand All @@ -333,9 +334,9 @@ namespace pyublasext
m_imaginary.apply(operand_real, result_imag_1);
m_real.apply(operand_imag, result_imag_2);

result.assign(result_real_1 + result_real_2 +
std::complex<typename real_operator::result_type::value_type>(0,1)
* (result_imag_1 + result_imag_2));
OperandType result_imag_12 = result_imag_1 + result_imag_2;

result.assign(result_real_1 + result_real_2 + complex_t(0,1) * result_imag_12);
}
};

Expand Down

0 comments on commit 07115d1

Please sign in to comment.