53 int i,
i1 = -1,
i2 = -1, off = 0, len = strlen (vec->
n1);
56 if (strstr (vec->
n1,
"re") == vec->
n1 ||
57 strstr (vec->
n1,
"im") == vec->
n1 ||
58 strstr (vec->
n1,
"db") == vec->
n1) {
62 else if (strstr (vec->
n1,
"mag") == vec->
n1 ||
63 strstr (vec->
n1,
"ang") == vec->
n1) {
66 for (i = off; i < len; i++)
if (!isalpha (vec->
n1[i]))
break;
69 if (isdigit (vec->
n1[i])) { i1 = vec->
n1[
i] -
'0'; vec->
n1[
i] =
'\0'; }
73 if (isdigit (vec->
n1[i])) {
i2 = vec->
n1[
i] -
'0'; vec->
n1[
i] =
'\0'; }
76 if (i1 >= 0 &&
i2 >= 0) {
77 sprintf (txt,
"%s[%d,%d]", &vec->
n1[off], i1,
i2);
80 sprintf (txt,
"%s[%d]", &vec->
n1[off], i1);
83 sprintf (txt,
"%s", &vec->
n1[off]);
99 for (rl = root->
d; rl; rl = nl) {
125 strlist * dep =
new strlist ();
133 vector * depn = (vector *) dep1->
getNext ();
137 for (equal =
true; depn != NULL; depn = (vector *) depn->getNext ()) {
138 if (depn->getSize () != dep1->getSize ()) {
142 for (
int i = 0;
i < depn->getSize ();
i++) {
143 if (depn->get (
i) != dep1->get (
i)) {
155 for (depn = (vector *) dep1->getNext (); depn != NULL; depn = ndep) {
156 ndep = (vector *) depn->
getNext ();
164 char txt[64];
int i = 1;
167 while (depn != NULL && varn != NULL) {
168 sprintf (txt,
"%s.%d", depn->getName (),
i);
171 depn = (vector *) depn->getNext ();
172 varn = (vector *) varn->getNext ();
180 for (; root != NULL; root = root->
next) {
183 vector *
var = vec->
vd;
int n;
185 if (!strcmp (hdr->
d_FMT,
"COMPLEX") && !strcmp (hdr->
d_UNT,
"dB")) {
186 for (n = 0; n < var->getSize (); n++) {
187 nr_double_t
r =
real (var->get (n));
188 nr_double_t
i =
imag (var->get (n));
193 else if (!strcmp (hdr->
d_FMT,
"MAGNITUDE") && !strcmp (hdr->
d_UNT,
"dB")) {
194 for (n = 0; n < var->getSize (); n++) {
195 nr_double_t
r =
real (var->get (n));
200 else if (!strcmp (hdr->
d_FMT,
"MA")) {
201 for (n = 0; n < var->getSize (); n++) {
202 nr_double_t
r =
real (var->get (n));
203 nr_double_t
i =
imag (var->get (n));
208 else if (!strcmp (hdr->
d_FMT,
"DB")) {
209 for (n = 0; n < var->getSize (); n++) {
210 nr_double_t
r =
real (var->get (n));
211 nr_double_t
i =
imag (var->get (n));
251 return errors ? -1 : 0;
std::complex< nr_double_t > nr_complex_t
matrix real(matrix a)
Real part matrix.
qucs::vector * getVariables(void)
static void zvr_finalize(void)
nr_complex_t pow(const nr_complex_t z, const nr_double_t d)
Compute power function with real exponent.
Global physical constants header file.
static char * zvr_vector_txt(struct zvr_vector_t *vec)
void appendVariable(qucs::vector *)
void delDependency(qucs::vector *)
void setDependencies(strlist *)
matrix imag(matrix a)
Imaginary part matrix.
void setName(const char *)
static strlist * zvr_create_dep(char *n)
void set(int, int, nr_complex_t)
Sets the matrix element at the given row and column.
#define rad(x)
Convert degree to radian.
struct zvr_data_t * zvr_root
void appendDependency(qucs::vector *)
nr_complex_t polar(const nr_double_t mag, const nr_double_t ang)
Construct a complex number using polar notation.
qucs::vector * getDependencies(void)
static void zvr_conversion(struct zvr_data_t *root)
static void zvr_check_dependencies(void)