Qucs-core
0.0.19
|
00001 /* 00002 * matvec.h - matrix vector class definitions 00003 * 00004 * Copyright (C) 2004, 2005, 2006, 2007, 2009 Stefan Jahn <stefan@lkcc.org> 00005 * 00006 * This is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2, or (at your option) 00009 * any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this package; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * $Id$ 00022 * 00023 */ 00024 00025 #ifndef __MATVEC_H__ 00026 #define __MATVEC_H__ 00027 00028 namespace qucs { 00029 00030 class matrix; 00031 class matvec; 00032 00033 // forward declarations 00034 matvec transpose (matvec); 00035 matvec conj (matvec); 00036 vector det (matvec); 00037 matvec inverse (matvec); 00038 matvec sqr (matvec); 00039 matvec pow (matvec, int); 00040 matvec pow (matvec, vector); 00041 matvec twoport (matvec, char, char); 00042 matvec real (matvec); 00043 matvec imag (matvec); 00044 matvec abs (matvec); 00045 matvec dB (matvec); 00046 matvec arg (matvec); 00047 matvec adjoint (matvec); 00048 vector rollet (matvec); 00049 vector b1 (matvec); 00050 matvec rad2deg (matvec); 00051 matvec deg2rad (matvec); 00052 matvec stos (matvec, nr_complex_t, nr_complex_t z0 = 50.0); 00053 matvec stos (matvec, nr_double_t, nr_double_t z0 = 50.0); 00054 matvec stos (matvec, vector, nr_complex_t z0 = 50.0); 00055 matvec stos (matvec, nr_complex_t, vector); 00056 matvec stos (matvec, vector, vector); 00057 matvec stoz (matvec, nr_complex_t z0 = 50.0); 00058 matvec stoz (matvec, vector); 00059 matvec ztos (matvec, nr_complex_t z0 = 50.0); 00060 matvec ztos (matvec, vector); 00061 matvec ztoy (matvec); 00062 matvec stoy (matvec, nr_complex_t z0 = 50.0); 00063 matvec stoy (matvec, vector); 00064 matvec ytos (matvec, nr_complex_t z0 = 50.0); 00065 matvec ytos (matvec, vector); 00066 matvec ytoz (matvec); 00067 00068 class matvec 00069 { 00070 public: 00071 matvec (); 00072 matvec (int, int, int); 00073 matvec (const matvec &); 00074 ~matvec (); 00075 int getSize (void) { return size; } 00076 int getCols (void) { return cols; } 00077 int getRows (void) { return rows; } 00078 void setName (const char *); 00079 char * getName (void); 00080 void set (qucs::vector, int, int); 00081 void set (matrix, int); 00082 qucs::vector get (int, int); 00083 matrix get (int); 00084 static char * createMatrixString (const char *, int, int); 00085 static char * createMatrixString (char, int, int); 00086 static char * isMatrixVector (const char *, int&, int&); 00087 static matvec * getMatrixVector (qucs::vector *, char *); 00088 static void getMatrixVectorSize (qucs::vector *, char *, int&, int&, int&); 00089 00090 // operator functions 00091 friend matvec operator + (matvec, matvec); 00092 friend matvec operator + (matvec, matrix); 00093 friend matvec operator + (matrix, matvec); 00094 friend matvec operator + (matvec, nr_complex_t); 00095 friend matvec operator + (nr_complex_t, matvec); 00096 friend matvec operator + (matvec, nr_double_t); 00097 friend matvec operator + (nr_double_t, matvec); 00098 friend matvec operator + (matvec, qucs::vector); 00099 friend matvec operator + (qucs::vector, matvec); 00100 friend matvec operator - (matvec, matvec); 00101 friend matvec operator - (matvec, matrix); 00102 friend matvec operator - (matrix, matvec); 00103 friend matvec operator - (matvec, nr_complex_t); 00104 friend matvec operator - (nr_complex_t, matvec); 00105 friend matvec operator - (matvec, nr_double_t); 00106 friend matvec operator - (nr_double_t, matvec); 00107 friend matvec operator - (matvec, qucs::vector); 00108 friend matvec operator - (qucs::vector, matvec); 00109 friend matvec operator / (matvec, nr_complex_t); 00110 friend matvec operator / (matvec, nr_double_t); 00111 friend matvec operator / (matvec, qucs::vector); 00112 friend matvec operator * (matvec, qucs::vector); 00113 friend matvec operator * (qucs::vector, matvec); 00114 friend matvec operator * (matvec, nr_complex_t); 00115 friend matvec operator * (nr_complex_t, matvec); 00116 friend matvec operator * (matvec, nr_double_t); 00117 friend matvec operator * (nr_double_t, matvec); 00118 friend matvec operator * (matvec, matvec); 00119 friend matvec operator * (matvec, matrix); 00120 friend matvec operator * (matrix, matvec); 00121 00122 // intrinsic operator functions 00123 matvec operator - (); 00124 matvec operator += (matvec); 00125 matvec operator -= (matvec); 00126 00127 // other operations 00128 friend matvec transpose (matvec); 00129 friend matvec conj (matvec); 00130 friend qucs::vector det (matvec); 00131 friend matvec inverse (matvec); 00132 friend matvec sqr (matvec); 00133 friend matvec pow (matvec, int); 00134 friend matvec pow (matvec, qucs::vector); 00135 friend matvec twoport (matvec, char, char); 00136 friend matvec real (matvec); 00137 friend matvec imag (matvec); 00138 friend matvec abs (matvec); 00139 friend matvec dB (matvec); 00140 friend matvec arg (matvec); 00141 friend matvec adjoint (matvec); 00142 friend qucs::vector rollet (matvec); 00143 friend qucs::vector b1 (matvec); 00144 friend matvec rad2deg (matvec); 00145 friend matvec deg2rad (matvec); 00146 00147 friend matvec stos (matvec, nr_complex_t, nr_complex_t); 00148 friend matvec stos (matvec, nr_double_t, nr_double_t); 00149 friend matvec stos (matvec, qucs::vector, nr_complex_t); 00150 friend matvec stos (matvec, nr_complex_t, qucs::vector); 00151 friend matvec stos (matvec, qucs::vector, qucs::vector); 00152 friend matvec stoz (matvec, nr_complex_t); 00153 friend matvec stoz (matvec, qucs::vector); 00154 friend matvec ztos (matvec, nr_complex_t); 00155 friend matvec ztos (matvec, qucs::vector); 00156 friend matvec ztoy (matvec); 00157 friend matvec stoy (matvec, nr_complex_t); 00158 friend matvec stoy (matvec, qucs::vector); 00159 friend matvec ytos (matvec, nr_complex_t); 00160 friend matvec ytos (matvec, qucs::vector); 00161 friend matvec ytoz (matvec); 00162 00163 private: 00164 int size; 00165 int rows; 00166 int cols; 00167 char * name; 00168 matrix * data; 00169 }; 00170 00171 } // namespace qucs 00172 00173 #endif /* __MATVEC_H__ */