// This is core/vnl/vnl_real.h #ifndef vnl_real_h_ #define vnl_real_h_ //: // \file // \brief Functions to return the real parts of complex arrays, vectors, matrices // // \verbatim // Modifications // Peter Vanroose - 2 July 2002 - part of vnl_complex_ops.h moved here // \endverbatim #include #include #include #include #include #include #include #include #include #include "vnl/vnl_export.h" //: Return array R of real parts of complex array C. template VNL_TEMPLATE_EXPORT void vnl_real(std::complex const* C, T* R, unsigned int n); // - vnl_vector // - vnl_vector_fixed // - vnl_matrix // - vnl_matrix_fixed // - vnl_diag_matrix // - vnl_diag_matrix_fixed // - vnl_sym_matrix //: Vector of real parts of vnl_vector >. // \relatesalso vnl_vector template VNL_TEMPLATE_EXPORT vnl_vector vnl_real(vnl_vector > const& C); //: Vector of real parts of vnl_vector_fixed, N >. // \relatesalso vnl_vector_fixed template VNL_TEMPLATE_EXPORT vnl_vector_fixed vnl_real(vnl_vector_fixed, N > const& C) { vnl_vector_fixed R; typename vnl_vector_fixed,N >::const_iterator cIt = C.begin(); typename vnl_vector_fixed::iterator rIt = R.begin(); for (; cIt != C.end(); ++cIt, ++rIt) *rIt = std::real(*cIt); return R; } //: Matrix of real parts of vnl_matrix >. // \relatesalso vnl_matrix template VNL_TEMPLATE_EXPORT vnl_matrix vnl_real(vnl_matrix > const& C); //: Matrix of real parts of vnl_matrix_fixed,NRow,NCol >. // \relatesalso vnl_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_matrix_fixed vnl_real(vnl_matrix_fixed,NRow,NCol > const& C) { vnl_matrix_fixed R; typename vnl_matrix_fixed,NRow,NCol >::const_iterator cIt = C.begin(); typename vnl_matrix_fixed::iterator rIt = R.begin(); for (; cIt != C.end(); ++cIt, ++rIt) *rIt = std::real(*cIt); return R; } //: Matrix of real parts of vnl_diag_matrix >. // \relatesalso vnl_diag_matrix template VNL_TEMPLATE_EXPORT vnl_diag_matrix vnl_real(vnl_diag_matrix > const& C); //: Matrix of real parts of vnl_diag_matrix_fixed >. // \relatesalso vnl_diag_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_diag_matrix_fixed vnl_real(vnl_diag_matrix_fixed,N > const& C) { vnl_diag_matrix_fixed R; typename vnl_diag_matrix_fixed,N >::const_iterator cIt = C.begin(); typename vnl_diag_matrix_fixed::iterator rIt = R.begin(); for (; cIt != C.end(); ++cIt, ++rIt) *rIt = std::real(*cIt); return R; } //: Matrix of real parts of vnl_sym_matrix >. // \relatesalso vnl_sym_matrix template VNL_TEMPLATE_EXPORT vnl_sym_matrix vnl_real(vnl_sym_matrix > const& C); #endif // vnl_real_h_