Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matvec.h
Go to the documentation of this file.
1 /*
2  * matvec.h - matrix vector class definitions
3  *
4  * Copyright (C) 2004, 2005, 2006, 2007, 2009 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id$
22  *
23  */
24 
25 #ifndef __MATVEC_H__
26 #define __MATVEC_H__
27 
28 namespace qucs {
29 
30 class matrix;
31 class matvec;
32 
33 // forward declarations
34 matvec transpose (matvec);
35 matvec conj (matvec);
36 vector det (matvec);
37 matvec inverse (matvec);
38 matvec sqr (matvec);
39 matvec pow (matvec, int);
40 matvec pow (matvec, vector);
41 matvec twoport (matvec, char, char);
42 matvec real (matvec);
43 matvec imag (matvec);
44 matvec abs (matvec);
45 matvec dB (matvec);
46 matvec arg (matvec);
47 matvec adjoint (matvec);
48 vector rollet (matvec);
49 vector b1 (matvec);
50 matvec stos (matvec, nr_complex_t, nr_complex_t z0 = 50.0);
51 matvec stos (matvec, nr_double_t, nr_double_t z0 = 50.0);
52 matvec stos (matvec, vector, nr_complex_t z0 = 50.0);
53 matvec stos (matvec, nr_complex_t, vector);
54 matvec stos (matvec, vector, vector);
55 matvec stoz (matvec, nr_complex_t z0 = 50.0);
56 matvec stoz (matvec, vector);
57 matvec ztos (matvec, nr_complex_t z0 = 50.0);
58 matvec ztos (matvec, vector);
59 matvec ztoy (matvec);
60 matvec stoy (matvec, nr_complex_t z0 = 50.0);
61 matvec stoy (matvec, vector);
62 matvec ytos (matvec, nr_complex_t z0 = 50.0);
63 matvec ytos (matvec, vector);
64 matvec ytoz (matvec);
65 
66 class matvec
67 {
68  public:
69  matvec ();
70  matvec (int, int, int);
71  matvec (const matvec &);
72  ~matvec ();
73  int getSize (void) { return size; }
74  int getCols (void) { return cols; }
75  int getRows (void) { return rows; }
76  void setName (const char *);
77  char * getName (void);
78  void set (qucs::vector, int, int);
79  void set (matrix, int);
80  qucs::vector get (int, int);
81  matrix get (int);
82  static char * createMatrixString (const char *, int, int);
83  static char * createMatrixString (char, int, int);
84  static char * isMatrixVector (char *, int&, int&);
85  static matvec * getMatrixVector (qucs::vector *, char *);
86  static void getMatrixVectorSize (qucs::vector *, char *, int&, int&, int&);
87 
88  // operator functions
90  friend matvec operator + (matvec, matrix);
91  friend matvec operator + (matrix, matvec);
94  friend matvec operator + (matvec, nr_double_t);
95  friend matvec operator + (nr_double_t, matvec);
99  friend matvec operator - (matvec, matrix);
100  friend matvec operator - (matrix, matvec);
103  friend matvec operator - (matvec, nr_double_t);
104  friend matvec operator - (nr_double_t, matvec);
108  friend matvec operator / (matvec, nr_double_t);
114  friend matvec operator * (matvec, nr_double_t);
115  friend matvec operator * (nr_double_t, matvec);
116  friend matvec operator * (matvec, matvec);
117  friend matvec operator * (matvec, matrix);
118  friend matvec operator * (matrix, matvec);
119 
120  // intrinsic operator functions
124 
125  // other operations
126  friend matvec transpose (matvec);
127  friend matvec conj (matvec);
128  friend qucs::vector det (matvec);
129  friend matvec inverse (matvec);
130  friend matvec sqr (matvec);
131  friend matvec pow (matvec, int);
132  friend matvec pow (matvec, qucs::vector);
133  friend matvec twoport (matvec, char, char);
134  friend matvec real (matvec);
135  friend matvec imag (matvec);
136  friend matvec abs (matvec);
137  friend matvec dB (matvec);
138  friend matvec arg (matvec);
139  friend matvec adjoint (matvec);
140  friend qucs::vector rollet (matvec);
141  friend qucs::vector b1 (matvec);
142 
144  friend matvec stos (matvec, nr_double_t, nr_double_t);
148  friend matvec stoz (matvec, nr_complex_t);
149  friend matvec stoz (matvec, qucs::vector);
150  friend matvec ztos (matvec, nr_complex_t);
151  friend matvec ztos (matvec, qucs::vector);
152  friend matvec ztoy (matvec);
153  friend matvec stoy (matvec, nr_complex_t);
154  friend matvec stoy (matvec, qucs::vector);
155  friend matvec ytos (matvec, nr_complex_t);
156  friend matvec ytos (matvec, qucs::vector);
157  friend matvec ytoz (matvec);
158 
159  private:
160  int size;
161  int rows;
162  int cols;
163  char * name;
165 };
166 
167 } // namespace qucs
168 
169 #endif /* __MATVEC_H__ */
matrix inverse(matrix a)
Compute inverse matrix.
Definition: matrix.cpp:847
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
friend matvec sqr(matvec)
matrix adjoint(matrix a)
adjoint matrix
Definition: matrix.cpp:522
char * name
Definition: matvec.h:163
matrix ytos(matrix y, qucs::vector z0)
Admittance matrix to scattering parameters.
Definition: matrix.cpp:1133
matrix real(matrix a)
Real part matrix.
Definition: matrix.cpp:568
matrix abs(matrix a)
Computes magnitude of each matrix element.
Definition: matrix.cpp:531
friend matvec pow(matvec, int)
matrix ytoz(matrix y)
Convert admittance matrix to impedance matrix.
Definition: matrix.cpp:1380
friend matvec ztoy(matvec)
nr_complex_t pow(const nr_complex_t z, const nr_double_t d)
Compute power function with real exponent.
Definition: complex.cpp:238
matrix stos(matrix s, qucs::vector zref, qucs::vector z0)
S params to S params.
Definition: matrix.cpp:890
matrix * data
Definition: matvec.h:164
friend matvec stos(matvec, nr_complex_t, nr_complex_t)
friend matvec stoz(matvec, nr_complex_t)
friend matvec twoport(matvec, char, char)
matrix twoport(matrix m, char in, char out)
Generic conversion matrix.
Definition: matrix.cpp:1594
friend qucs::vector det(matvec)
nr_double_t rollet(matrix)
nr_double_t b1(matrix)
void setName(const char *)
Definition: matvec.cpp:95
nr_complex_t sqr(const nr_complex_t z)
Square of complex number.
Definition: complex.cpp:673
friend matvec imag(matvec)
matrix imag(matrix a)
Imaginary part matrix.
Definition: matrix.cpp:581
friend matvec dB(matvec)
static matvec * getMatrixVector(qucs::vector *, char *)
Definition: matvec.cpp:200
int rows
Definition: matvec.h:161
friend qucs::vector rollet(matvec)
matrix stoy(matrix s, qucs::vector z0)
Scattering parameters to admittance matrix.
Definition: matrix.cpp:1082
friend matvec inverse(matvec)
matvec operator+=(matvec)
Definition: matvec.cpp:337
friend matvec ztos(matvec, nr_complex_t)
matvec operator-=(matvec)
Definition: matvec.cpp:384
int getRows(void)
Definition: matvec.h:75
nr_double_t dB(const nr_complex_t z)
Magnitude in dB Compute .
Definition: complex.cpp:528
matrix ztos(matrix z, qucs::vector z0)
Convert impedance matrix scattering parameters.
Definition: matrix.cpp:1018
friend matvec conj(matvec)
friend matvec real(matvec)
friend matvec operator/(matvec, nr_complex_t)
friend qucs::vector b1(matvec)
friend matvec adjoint(matvec)
friend matvec arg(matvec)
nr_complex_t det(matrix a)
Compute determinant of the given matrix.
Definition: matrix.cpp:762
matvec operator-()
Definition: matvec.cpp:377
matrix transpose(matrix a)
Matrix transposition.
Definition: matrix.cpp:492
friend matvec operator*(matvec, qucs::vector)
Dense complex matrix class This class defines a matrix object with its methods, operators and operati...
Definition: matrix.h:92
int cols
Definition: matvec.h:162
char * getName(void)
Definition: matvec.cpp:101
friend matvec operator+(matvec, matvec)
friend matvec abs(matvec)
matrix stoz(matrix s, qucs::vector z0)
Scattering parameters to impedance matrix.
Definition: matrix.cpp:973
friend matvec ytos(matvec, nr_complex_t)
friend matvec ytoz(matvec)
List int
Definition: parse_citi.y:183
int getSize(void)
Definition: matvec.h:73
int getCols(void)
Definition: matvec.h:74
void set(qucs::vector, int, int)
Definition: matvec.cpp:107
matrix conj(matrix a)
Conjugate complex matrix.
Definition: matrix.cpp:505
friend matvec stoy(matvec, nr_complex_t)
matrix ztoy(matrix z)
impedance matrix to admittance matrix.
Definition: matrix.cpp:1050
static void getMatrixVectorSize(qucs::vector *, char *, int &, int &, int &)
Definition: matvec.cpp:174
int size
Definition: matvec.h:160
friend matvec transpose(matvec)
matrix arg(matrix a)
Computes the argument of each matrix element.
Definition: matrix.cpp:555
static char * isMatrixVector(char *, int &, int &)
Definition: matvec.cpp:148
static char * createMatrixString(const char *, int, int)
Definition: matvec.cpp:128