|
Boost : |
From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2002-04-24 14:21:52
I made following change to numerics/ublas/functional.h to be able to assign
matrices of complex to a matrix of reals.
Joerg, would you mind integrating it in the CVS ?
Index: functional.h
===================================================================
RCS file: /cvsroot/boost/boost/boost/numeric/ublas/Attic/functional.h,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 functional.h
--- functional.h 26 Mar 2002 10:11:26 -0000 1.1.2.10
+++ functional.h 24 Apr 2002 13:16:39 -0000
@@ -160,6 +160,16 @@
struct assign_tag {};
struct computed_assign_tag {};
+ template < typename T1, typename T2 >
+ inline
+ void convert_and_assign(T1& target, const T2& source)
+ { target = source ; }
+
+ template <>
+ inline
+ void convert_and_assign(double& target, const std::complex< double >&
source)
+ { target = source.real() ; }
+
template<class T1, class T2>
struct scalar_assign:
public scalar_binary_functor<T1, T2> {
@@ -169,7 +179,7 @@
NUMERICS_INLINE
void operator () (argument1_type &t1, const argument2_type &t2)
const {
- t1 = t2;
+ convert_and_assign(t1,t2);
}
};
template<class T1, class T2>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk