vnl_complexify.h
Go to the documentation of this file.
1 // This is core/vnl/vnl_complexify.h
2 #ifndef vnl_complexify_h_
3 #define vnl_complexify_h_
4 //:
5 // \file
6 // \brief Functions to create complex vectors and matrices from real ones
7 // \author fsm
8 //
9 // \verbatim
10 // Modifications
11 // Peter Vanroose - 2 July 2002 - part of vnl_complex_ops.h moved here
12 // \endverbatim
13 
14 #include <complex>
15 #ifdef _MSC_VER
16 # include <vcl_msvc_warnings.h>
17 #endif
18 #include <vnl/vnl_vector.h>
19 #include <vnl/vnl_vector_fixed.h>
20 #include <vnl/vnl_matrix.h>
21 #include <vnl/vnl_matrix_fixed.h>
22 #include <vnl/vnl_diag_matrix.h>
24 #include <vnl/vnl_sym_matrix.h>
25 #include "vnl/vnl_export.h"
26 
27 //: Overwrite complex array C (of length n) with pairs from real arrays R and I.
28 template <class T> VNL_EXPORT
29 void
30  vnl_complexify(T const* R, T const* I, std::complex<T>* C, unsigned n);
31 //: Overwrite complex array C (sz n) with complexified version of real array R.
32 template <class T> VNL_EXPORT
33 void
34  vnl_complexify(T const* R, std::complex<T>* C, unsigned n);
35 
36 // Real Alone:
37 // - vnl_vector
38 // - vnl_vector_fixed
39 // - vnl_matrix
40 // - vnl_matrix_fixed
41 // - vnl_diag_matrix
42 // - vnl_diag_matrix_fixed
43 // - vnl_sym_matrix
44 
45 //: Return complexified version of real vector R.
46 // \relatesalso vnl_vector
47 template <class T> VNL_EXPORT
49  vnl_complexify(vnl_vector<T> const& R);
50 
51 
52 template <class T, unsigned int n> VNL_EXPORT
55 
56 //: Return complexified version of real fixed vector R.
57 // \relatesalso vnl_vector_fixed
58 template <class T, unsigned int n>
61 {
63  vnl_complexify(R.begin(), C.begin(), R.size());
64  return C;
65 }
66 
67 //: Return complexified version of real matrix R.
68 // \relatesalso vnl_matrix
69 template <class T> VNL_EXPORT
71  vnl_complexify(vnl_matrix<T> const& R);
72 
73 //: Return complexified version of real fixed matrix R.
74 // \relatesalso vnl_matrix_fixed
75 template <class T, unsigned int r, unsigned int c> VNL_EXPORT
78 
79 template <class T, unsigned int r, unsigned int c>
82 {
84  vnl_complexify(R.begin(), C.begin(), R.size());
85  return C;
86 }
87 
88 //: Return complexified version of real diagonal matrix R.
89 // \relatesalso vnl_diag_matrix
90 template <class T> VNL_EXPORT
93 
94 //: Return complexified version of real fixed diagonal matrix R.
95 // \relatesalso vnl_diag_matrix_fixed
96 template <class T, unsigned int n>
99 {
101  vnl_complexify(R.begin(), C.begin(), R.size());
102  return C;
103 }
104 
105 //: Return complexified version of real symmetric matrix R.
106 // \relatesalso vnl_sym_matrix
107 template <class T> VNL_EXPORT
110 
111 //----------------------------------------------------------------------
112 
113 // Real + Imaginary:
114 // - vnl_vector
115 // - vnl_vector_fixed
116 // - vnl_matrix
117 // - vnl_matrix_fixed
118 // - vnl_diag_matrix
119 // - vnl_diag_matrix_fixed
120 // - vnl_sym_matrix
121 
122 //: Return complex vector R+j*I from two real vectors R and I.
123 // \relatesalso vnl_vector
124 template <class T> VNL_EXPORT
126  vnl_complexify(vnl_vector<T> const& R, vnl_vector<T> const& I);
127 
128 //: Return complex fixed vector R+j*I from two real fixed vectors R and I.
129 // \relatesalso vnl_vector_fixed
130 template <class T, unsigned int n>
133 {
135  vnl_complexify(R.begin(), I.begin(), C.begin(), R.size());
136  return C;
137 }
138 
139 //: Return complex matrix R+j*I from two real matrices R and I.
140 // \relatesalso vnl_matrix
141 template <class T> VNL_EXPORT
143  vnl_complexify(vnl_matrix<T> const& R, vnl_matrix<T> const& I);
144 
145 //: Return complex fixed matrix R+j*I from two real fixed matrices R and I.
146 // \relatesalso vnl_matrix_fixed
147 template <class T, unsigned int r, unsigned int c>
150 {
152  vnl_complexify(R.begin(), I.begin(), C.begin(), R.size());
153  return C;
154 }
155 
156 //: Return complex diagonal matrix R+j*I from two real diagonal matrices R and I.
157 // \relatesalso vnl_diag_matrix
158 template <class T> VNL_EXPORT
161 
162 //: Return complex fixed diagonal matrix R+j*I from two real fixed diagonal matrices R and I.
163 // \relatesalso vnl_matrix_fixed
164 template <class T, unsigned int n>
167 {
169  vnl_complexify(R.begin(), I.begin(), C.begin(), R.size());
170  return C;
171 }
172 
173 //: Return complex diagonal matrix R+j*I from two real diagonal matrices R and I.
174 // \relatesalso vnl_diag_matrix
175 template <class T> VNL_EXPORT
178 
179 #endif // vnl_complexify_h_
An ordinary mathematical matrix.
unsigned int size() const
Length of the vector.
Fixed size, stack-stored, space-efficient matrix.
Definition: vnl_fwd.h:23
unsigned int size() const
Return the total number of elements stored by the matrix.
Contains class for symmetric matrices.
An ordinary mathematical matrix.
Definition: vnl_adjugate.h:22
Mathematical vector class, templated by type of element.
Definition: vnl_fwd.h:16
VNL_EXPORT vnl_vector< std::complex< T > > vnl_complexify(vnl_vector< T > const &R)
Return complexified version of real vector R.
Fixed length stack-stored, space-efficient vector.
Definition: vnl_fwd.h:22
fixed size matrix
Fixed length stack-stored vector.
iterator begin()
Iterator pointing to start of data.
stores a diagonal matrix as a single vector.
stores a diagonal matrix as a single vector.
Contains class for diagonal matrices.
iterator begin()
Iterator pointing to start of data.
unsigned int size() const
Return the total number of elements stored by the matrix.
stores a symmetric matrix as just the diagonal and lower triangular part.
Contains class for diagonal matrices.