// This is core/vnl/vnl_complexify.h #ifndef vnl_complexify_h_ #define vnl_complexify_h_ //: // \file // \brief Functions to create complex vectors and matrices from real ones // \author fsm // // \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" //: Overwrite complex array C (of length n) with pairs from real arrays R and I. template VNL_TEMPLATE_EXPORT void vnl_complexify(T const* R, T const* I, std::complex* C, unsigned n); //: Overwrite complex array C (sz n) with complexified version of real array R. template VNL_TEMPLATE_EXPORT void vnl_complexify(T const* R, std::complex* C, unsigned n); // Real Alone: // - vnl_vector // - vnl_vector_fixed // - vnl_matrix // - vnl_matrix_fixed // - vnl_diag_matrix // - vnl_diag_matrix_fixed // - vnl_sym_matrix //: Return complexified version of real vector R. // \relatesalso vnl_vector template VNL_TEMPLATE_EXPORT vnl_vector > vnl_complexify(vnl_vector const& R); //: Return complexified version of real fixed vector R. // \relatesalso vnl_vector_fixed template VNL_TEMPLATE_EXPORT vnl_vector_fixed,n> vnl_complexify(vnl_vector_fixed const& R) { vnl_vector_fixed,n> C; vnl_complexify(R.begin(), C.begin(), R.size()); return C; } //: Return complexified version of real matrix R. // \relatesalso vnl_matrix template VNL_TEMPLATE_EXPORT vnl_matrix > vnl_complexify(vnl_matrix const& R); //: Return complexified version of real fixed matrix R. // \relatesalso vnl_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_matrix_fixed,r,c > vnl_complexify(vnl_matrix_fixed const& R) { vnl_matrix_fixed,r,c> C; vnl_complexify(R.begin(), C.begin(), R.size()); return C; } //: Return complexified version of real diagonal matrix R. // \relatesalso vnl_diag_matrix template VNL_TEMPLATE_EXPORT vnl_diag_matrix > vnl_complexify(vnl_diag_matrix const& R); //: Return complexified version of real fixed diagonal matrix R. // \relatesalso vnl_diag_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_diag_matrix_fixed,n > vnl_complexify(vnl_diag_matrix_fixed const& R) { vnl_diag_matrix_fixed,n> C; vnl_complexify(R.begin(), C.begin(), R.size()); return C; } //: Return complexified version of real symmetric matrix R. // \relatesalso vnl_sym_matrix template VNL_TEMPLATE_EXPORT vnl_sym_matrix > vnl_complexify(vnl_sym_matrix const& R); //---------------------------------------------------------------------- // Real + Imaginary: // - vnl_vector // - vnl_vector_fixed // - vnl_matrix // - vnl_matrix_fixed // - vnl_diag_matrix // - vnl_diag_matrix_fixed // - vnl_sym_matrix //: Return complex vector R+j*I from two real vectors R and I. // \relatesalso vnl_vector template VNL_TEMPLATE_EXPORT vnl_vector > vnl_complexify(vnl_vector const& R, vnl_vector const& I); //: Return complex fixed vector R+j*I from two real fixed vectors R and I. // \relatesalso vnl_vector_fixed template VNL_TEMPLATE_EXPORT vnl_vector_fixed,n > vnl_complexify(vnl_vector_fixed const& R, vnl_vector_fixed const& I) { vnl_vector_fixed,n > C; vnl_complexify(R.begin(), I.begin(), C.begin(), R.size()); return C; } //: Return complex matrix R+j*I from two real matrices R and I. // \relatesalso vnl_matrix template VNL_TEMPLATE_EXPORT vnl_matrix > vnl_complexify(vnl_matrix const& R, vnl_matrix const& I); //: Return complex fixed matrix R+j*I from two real fixed matrices R and I. // \relatesalso vnl_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_matrix_fixed,r,c> vnl_complexify(vnl_matrix_fixed const& R, vnl_matrix_fixed const& I) { vnl_matrix_fixed,r,c > C; vnl_complexify(R.begin(), I.begin(), C.begin(), R.size()); return C; } //: Return complex diagonal matrix R+j*I from two real diagonal matrices R and I. // \relatesalso vnl_diag_matrix template VNL_TEMPLATE_EXPORT vnl_diag_matrix > vnl_complexify(vnl_diag_matrix const& R, vnl_diag_matrix const& I); //: Return complex fixed diagonal matrix R+j*I from two real fixed diagonal matrices R and I. // \relatesalso vnl_matrix_fixed template VNL_TEMPLATE_EXPORT vnl_diag_matrix_fixed,n> vnl_complexify(vnl_diag_matrix_fixed const& R, vnl_diag_matrix_fixed const& I) { vnl_diag_matrix_fixed,n > C; vnl_complexify(R.begin(), I.begin(), C.begin(), R.size()); return C; } //: Return complex diagonal matrix R+j*I from two real diagonal matrices R and I. // \relatesalso vnl_diag_matrix template VNL_TEMPLATE_EXPORT vnl_sym_matrix > vnl_complexify(vnl_sym_matrix const& R, vnl_sym_matrix const& I); #endif // vnl_complexify_h_