CimplTypes.cpp File Reference

#include "./CimplTypes.h"

Include dependency graph for CimplTypes.cpp:

Include dependency graph

Go to the source code of this file.

Functions

Vector< double > ToDouble (Vector< float > &m)
Matrix< double > ToDouble (Matrix< float > &m)
Vector< ComplexFloatToComplexFloat (Vector< float > &m)
Matrix< ComplexFloatToComplexFloat (Matrix< float > &m)
Vector< ComplexDoubleToComplexDouble (Vector< double > &m)
Matrix< ComplexDoubleToComplexDouble (Matrix< double > &m)
Vector< ComplexDoubleToComplexDouble (Vector< ComplexFloat > &m)
Matrix< ComplexDoubleToComplexDouble (Matrix< ComplexFloat > &m)
Vector< float > Real (Vector< ComplexFloat > &m)
Vector< float > Imag (Vector< ComplexFloat > &m)
Matrix< float > Real (Matrix< ComplexFloat > &m)
Matrix< float > Imag (Matrix< ComplexFloat > &m)
Vector< double > Real (Vector< ComplexDouble > &m)
Vector< double > Imag (Vector< ComplexDouble > &m)
Matrix< double > Real (Matrix< ComplexDouble > &m)
Matrix< double > Imag (Matrix< ComplexDouble > &m)
Vector< ComplexFloatComplex (Vector< float > &real, Vector< float > &imag)
Vector< ComplexDoubleComplex (Vector< double > &real, Vector< double > &imag)
Matrix< ComplexFloatComplex (Matrix< float > &real, Matrix< float > &imag)
Matrix< ComplexDoubleComplex (Matrix< double > &real, Matrix< double > &imag)
Vector< ComplexFloatConj (Vector< ComplexFloat > &c)
Vector< ComplexDoubleConj (Vector< ComplexDouble > &c)
Matrix< ComplexFloatConj (Matrix< ComplexFloat > &c)
Matrix< ComplexDoubleConj (Matrix< ComplexDouble > &c)


Function Documentation

Matrix<ComplexDouble> Complex Matrix< double > &  real,
Matrix< double > &  imag
 

Definition at line 317 of file CimplTypes.cpp.

References Matrix< T >::Columns(), ComplexDouble, Matrix< T >::ElemNC(), Matrix< T >::Length(), Matrix< T >::Rows(), and Utility::RunTimeError().

00318 {
00319     if(real.Rows() != imag.Rows() || real.Columns() != imag.Columns())
00320     {
00321         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00322         Utility::RunTimeError("Dimensions does not match!");
00323     }
00324     int r = real.Rows();
00325     int c = real.Columns();
00326     int l = real.Length();
00327     Matrix<ComplexDouble> temp(r,c);
00328     for(int i=0; i<l; i++)
00329     {
00330         temp.ElemNC(i) = ComplexDouble(real.ElemNC(i), imag.ElemNC(i));
00331     }
00332     return temp;
00333 }

Matrix<ComplexFloat> Complex Matrix< float > &  real,
Matrix< float > &  imag
 

Definition at line 299 of file CimplTypes.cpp.

00300 {
00301     if(real.Rows() != imag.Rows() || real.Columns() != imag.Columns())
00302     {
00303         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00304         Utility::RunTimeError("Dimensions does not match!");
00305     }
00306     int r = real.Rows();
00307     int c = real.Columns();
00308     int l = real.Length();
00309     Matrix<ComplexFloat> temp(r,c);
00310     for(int i=0; i<l; i++)
00311     {
00312         temp.ElemNC(i) = ComplexFloat(real.ElemNC(i), imag.ElemNC(i));
00313     }
00314     return temp;
00315 }

Vector<ComplexDouble> Complex Vector< double > &  real,
Vector< double > &  imag
 

Definition at line 283 of file CimplTypes.cpp.

00284 {
00285     if(real.Length() != imag.Length())
00286     {
00287         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00288         Utility::RunTimeError("Dimensions does not match!");
00289     }
00290     int l = real.Length();
00291     Vector<ComplexDouble> temp(l);
00292     for(int i=0; i<l; i++)
00293     {
00294         temp[i] = ComplexDouble(real[i], imag[i]);
00295     }
00296     return temp;
00297 }

Vector<ComplexFloat> Complex Vector< float > &  real,
Vector< float > &  imag
 

Definition at line 267 of file CimplTypes.cpp.

00268 {
00269     if(real.Length() != imag.Length())
00270     {
00271         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00272         Utility::RunTimeError("Dimensions does not match!");
00273     }
00274     int l = real.Length();
00275     Vector<ComplexFloat> temp(l);
00276     for(int i=0; i<l; i++)
00277     {
00278         temp[i] = ComplexFloat(real[i], imag[i]);
00279     }
00280     return temp;
00281 }

Matrix<ComplexDouble> Conj Matrix< ComplexDouble > &  c  ) 
 

Definition at line 370 of file CimplTypes.cpp.

References Matrix< T >::Clone(), Matrix< T >::Data(), and Matrix< T >::Length().

00371 {
00372     Matrix<ComplexDouble> copy = c.Clone();
00373     double *temp = reinterpret_cast<double*>(copy.Data());
00374     for(int i=1; i<2*copy.Length(); i+=2)
00375     {
00376         temp[i] = -temp[i];
00377     }
00378     return copy;
00379 }

Matrix<ComplexFloat> Conj Matrix< ComplexFloat > &  c  ) 
 

Definition at line 359 of file CimplTypes.cpp.

00360 {
00361     Matrix<ComplexFloat> copy = c.Clone();
00362     float *temp = reinterpret_cast<float*>(copy.Data());
00363     for(int i=1; i<2*copy.Length(); i+=2)
00364     {
00365         temp[i] = -temp[i];
00366     }
00367     return copy;
00368 }

Vector<ComplexDouble> Conj Vector< ComplexDouble > &  c  ) 
 

Definition at line 347 of file CimplTypes.cpp.

00348 {
00349     Vector<ComplexDouble> copy = c.Clone();
00350     double *temp = reinterpret_cast<double*>(copy.Data());
00351     for(int i=1; i<2*copy.Length(); i+=2)
00352     {
00353         temp[i] = -temp[i];
00354     }
00355     return copy;
00356 }

Vector<ComplexFloat> Conj Vector< ComplexFloat > &  c  ) 
 

Definition at line 336 of file CimplTypes.cpp.

00337 {
00338     Vector<ComplexFloat> copy = c.Clone();
00339     float *temp = reinterpret_cast<float*>(copy.Data());
00340     for(int i=1; i<2*copy.Length(); i+=2)
00341     {
00342         temp[i] = -temp[i];
00343     }
00344     return copy;
00345 }

Matrix<double> Imag Matrix< ComplexDouble > &  m  ) 
 

Definition at line 248 of file CimplTypes.cpp.

References Matrix< T >::Columns(), Matrix< T >::ElemNC(), Matrix< T >::Length(), and Matrix< T >::Rows().

00249 {
00250     int r = m.Rows();
00251     int c = m.Columns();
00252     int l = m.Length();
00253     Matrix<double> temp(r,c);
00254     for(int i=0; i<l; i++)
00255     {
00256         temp.ElemNC(i) = imag(m.ElemNC(i));
00257     }
00258     return temp;
00259 }

Vector<double> Imag Vector< ComplexDouble > &  m  ) 
 

Definition at line 224 of file CimplTypes.cpp.

00225 {
00226     int l = m.Length();
00227     Vector<double> temp(l);
00228     for(int i=0; i<l; i++)
00229     {
00230         temp[i] = imag(m[i]);
00231     }
00232     return temp;
00233 }

Matrix<float> Imag Matrix< ComplexFloat > &  m  ) 
 

Definition at line 196 of file CimplTypes.cpp.

00197 {
00198     int r = m.Rows();
00199     int c = m.Columns();
00200     int l = m.Length();
00201     Matrix<float> temp(r,c);
00202     for(int i=0; i<l; i++)
00203     {
00204         temp.ElemNC(i) = imag(m.ElemNC(i));
00205     }
00206     return temp;
00207 }

Vector<float> Imag Vector< ComplexFloat > &  m  ) 
 

Definition at line 172 of file CimplTypes.cpp.

00173 {
00174     int l = m.Length();
00175     Vector<float> temp(l);
00176     for(int i=0; i<l; i++)
00177     {
00178         temp[i] = imag(m[i]);
00179     }
00180     return temp;
00181 }

Matrix<double> Real Matrix< ComplexDouble > &  m  ) 
 

Definition at line 235 of file CimplTypes.cpp.

References Matrix< T >::Columns(), Matrix< T >::ElemNC(), Matrix< T >::Length(), and Matrix< T >::Rows().

00236 {
00237     int r = m.Rows();
00238     int c = m.Columns();
00239     int l = m.Length();
00240     Matrix<double> temp(r,c);
00241     for(int i=0; i<l; i++)
00242     {
00243         temp.ElemNC(i) = real(m.ElemNC(i));
00244     }
00245     return temp;
00246 }

Vector<double> Real Vector< ComplexDouble > &  m  ) 
 

Definition at line 213 of file CimplTypes.cpp.

00214 {
00215     int l = m.Length();
00216     Vector<double> temp(l);
00217     for(int i=0; i<l; i++)
00218     {
00219         temp[i] = real(m[i]);
00220     }
00221     return temp;
00222 }

Matrix<float> Real Matrix< ComplexFloat > &  m  ) 
 

Definition at line 183 of file CimplTypes.cpp.

00184 {
00185     int r = m.Rows();
00186     int c = m.Columns();
00187     int l = m.Length();
00188     Matrix<float> temp(r,c);
00189     for(int i=0; i<l; i++)
00190     {
00191         temp.ElemNC(i) = real(m.ElemNC(i));
00192     }
00193     return temp;
00194 }

Vector<float> Real Vector< ComplexFloat > &  m  ) 
 

Definition at line 161 of file CimplTypes.cpp.

00162 {
00163     int l = m.Length();
00164     Vector<float> temp(l);
00165     for(int i=0; i<l; i++)
00166     {
00167         temp[i] = real(m[i]);
00168     }
00169     return temp;
00170 }

Matrix<ComplexDouble> ToComplexDouble Matrix< ComplexFloat > &  m  ) 
 

Definition at line 145 of file CimplTypes.cpp.

References Matrix< T >::Columns(), Matrix< T >::ElemNC(), Matrix< T >::Length(), and Matrix< T >::Rows().

00146 {
00147     int r = m.Rows();
00148     int c = m.Columns();
00149     int l = m.Length();
00150     Matrix<ComplexDouble> temp(r,c);
00151     for(int i=0; i<l; i++)
00152     {
00153         temp.ElemNC(i) = (ComplexDouble) m.ElemNC(i);
00154     }
00155     return temp;
00156 }

Vector<ComplexDouble> ToComplexDouble Vector< ComplexFloat > &  m  ) 
 

Definition at line 134 of file CimplTypes.cpp.

00135 {
00136     int l = m.Length();
00137     Vector<ComplexDouble> temp(l);
00138     for(int i=0; i<l; i++)
00139     {
00140         temp[i] = (ComplexDouble)m[i];
00141     }
00142     return temp;
00143 }

Matrix<ComplexDouble> ToComplexDouble Matrix< double > &  m  ) 
 

Definition at line 121 of file CimplTypes.cpp.

00122 {
00123     int r = m.Rows();
00124     int c = m.Columns();
00125     int l = m.Length();
00126     Matrix<ComplexDouble> temp(r,c);
00127     for(int i=0; i<l; i++)
00128     {
00129         temp.ElemNC(i) = ComplexDouble(m.ElemNC(i),0);
00130     }
00131     return temp;
00132 }

Vector<ComplexDouble> ToComplexDouble Vector< double > &  m  ) 
 

Definition at line 110 of file CimplTypes.cpp.

00111 {
00112     int l = m.Length();
00113     Vector<ComplexDouble> temp(l);
00114     for(int i=0; i<l; i++)
00115     {
00116         temp[i] = ComplexDouble(m[i],0);
00117     }
00118     return temp;
00119 }

Matrix<ComplexFloat> ToComplexFloat Matrix< float > &  m  ) 
 

Definition at line 96 of file CimplTypes.cpp.

References Matrix< T >::Columns(), ComplexFloat, Matrix< T >::ElemNC(), Matrix< T >::Length(), and Matrix< T >::Rows().

00097 {
00098     int r = m.Rows();
00099     int c = m.Columns();
00100     int l = m.Length();
00101     Matrix<ComplexFloat> temp(r,c);
00102     for(int i=0; i<l; i++)
00103     {
00104         temp.ElemNC(i) = ComplexFloat(m.ElemNC(i),0);
00105     }
00106     return temp;
00107 }

Vector<ComplexFloat> ToComplexFloat Vector< float > &  m  ) 
 

Definition at line 85 of file CimplTypes.cpp.

00086 {
00087     int l = m.Length();
00088     Vector<ComplexFloat> temp(l);
00089     for(int i=0; i<l; i++)
00090     {
00091         temp[i] = ComplexFloat(m[i],0);
00092     }
00093     return temp;
00094 }

Matrix<double> ToDouble Matrix< float > &  m  ) 
 

Definition at line 71 of file CimplTypes.cpp.

References Matrix< T >::Columns(), Matrix< T >::ElemNC(), Matrix< T >::Length(), and Matrix< T >::Rows().

00072 {
00073     int r = m.Rows();
00074     int c = m.Columns();
00075     int l = m.Length();
00076     Matrix<double> temp(r,c);
00077     for(int i=0; i<l; i++)
00078     {
00079         temp.ElemNC(i) = (double)m.ElemNC(i);
00080     }
00081     return temp;
00082 }

Vector<double> ToDouble Vector< float > &  m  ) 
 

Definition at line 60 of file CimplTypes.cpp.

00061 {
00062     int l = m.Length();
00063     Vector<double> temp(l);
00064     for(int i=0; i<l; i++)
00065     {
00066         temp[i] = (double)m[i];
00067     }
00068     return temp;
00069 }


CIMPL 0.1 Code Reference. Copyright © 2004, Baris Sumengen. All rights reserved.