diff --git a/qucs-core/configure.ac b/qucs-core/configure.ac index 4e278eed7b..cb0c945488 100644 --- a/qucs-core/configure.ac +++ b/qucs-core/configure.ac @@ -21,6 +21,7 @@ test "x$prefix" = xNONE && prefix="/usr/local" dnl Checks for programs. AC_PROG_CXX +AX_CXX_COMPILE_STDCXX_11 AC_PROG_CC AC_CHECK_TOOL(AR, ar, :) diff --git a/qucs-core/m4/ax_cxx_compile_stdcxx_11.m4 b/qucs-core/m4/ax_cxx_compile_stdcxx_11.m4 new file mode 100644 index 0000000000..af37acdb5c --- /dev/null +++ b/qucs-core/m4/ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,133 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXXFLAGS to enable support. +# +# The first argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The second argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline C++11 support is required and that the macro +# should error out if no mode with that support is found. If specified +# 'optional', then configuration proceeds regardless, after defining +# HAVE_CXX11 if and only if a supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 3 + +m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; +]) + +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl + m4_if([$1], [], [], + [$1], [ext], [], + [$1], [noext], [], + [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl + m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], + [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], + [$2], [optional], [ax_cxx_compile_cxx11_required=false], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++11 features by default, + ax_cv_cxx_compile_cxx11, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [ax_cv_cxx_compile_cxx11=yes], + [ax_cv_cxx_compile_cxx11=no])]) + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + m4_if([$1], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++11 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$1], [ext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=c++11 -std=c++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) + fi + else + if test x$ac_success = xno; then + HAVE_CXX11=0 + AC_MSG_NOTICE([No compiler with C++11 support was found]) + else + HAVE_CXX11=1 + AC_DEFINE(HAVE_CXX11,1, + [define if the compiler supports basic C++11 syntax]) + fi + + AC_SUBST(HAVE_CXX11) + fi +]) diff --git a/qucs-core/src/acsolver.cpp b/qucs-core/src/acsolver.cpp index 503c4b8c04..943be0cce1 100644 --- a/qucs-core/src/acsolver.cpp +++ b/qucs-core/src/acsolver.cpp @@ -139,10 +139,10 @@ void acsolver::init (void) { /* This function saves the results of a single solve() functionality (for the given frequency) into the output dataset. */ void acsolver::saveAllResults (nr_double_t freq) { - vector * f; + ::vector * f; // add current frequency to the dependency of the output dataset if ((f = data->findDependency ("acfrequency")) == NULL) { - f = new vector ("acfrequency"); + f = new ::vector ("acfrequency"); data->addDependency (f); } if (runs == 1) f->add (freq); @@ -156,7 +156,7 @@ void acsolver::saveAllResults (nr_double_t freq) { /* The function computes the final noise results and puts them into the output dataset. */ -void acsolver::saveNoiseResults (vector * f) { +void acsolver::saveNoiseResults (::vector * f) { int N = countNodes (); int M = countVoltageSources (); for (int r = 0; r < N + M; r++) { diff --git a/qucs-core/src/acsolver.h b/qucs-core/src/acsolver.h index ff9a3fe289..45a90cca82 100644 --- a/qucs-core/src/acsolver.h +++ b/qucs-core/src/acsolver.h @@ -42,7 +42,7 @@ class acsolver : public nasolver static void calc (acsolver *); void init (void); void saveAllResults (nr_double_t); - void saveNoiseResults (vector *); + void saveNoiseResults (::vector *); private: sweep * swp; diff --git a/qucs-core/src/analysis.h b/qucs-core/src/analysis.h index 3f33e5c858..69c4398c56 100644 --- a/qucs-core/src/analysis.h +++ b/qucs-core/src/analysis.h @@ -228,7 +228,7 @@ class analysis : public object * Saves the given variable into the dataset associated with the * analysis. Creates the dataset vector if necessary. */ - void saveVariable (const char *, nr_complex_t, vector *); + void saveVariable (const char *, nr_complex_t, ::vector *); /*! \fn getProgress * \brief get diff --git a/qucs-core/src/check_citi.cpp b/qucs-core/src/check_citi.cpp index c95db24774..bb172ae4fc 100644 --- a/qucs-core/src/check_citi.cpp +++ b/qucs-core/src/check_citi.cpp @@ -49,7 +49,7 @@ struct citi_package_t * citi_root = NULL; /* Returns the number of vectors in a package. */ static int citi_count_vectors (struct citi_package_t * p) { int i = 0; - for (vector * v = p->data; v != NULL; v = (vector *) v->getNext ()) i++; + for (::vector * v = p->data; v != NULL; v = (::vector *) v->getNext ()) i++; return i; } @@ -63,9 +63,9 @@ static int citi_count_variables (struct citi_package_t * p) { } /* Returns the n-th vector in the package. */ -static vector * citi_get_vector (struct citi_package_t * p, int n) { - vector * v = p->data; - for (int i = 0; v != NULL; v = (vector *) v->getNext (), i++) { +static ::vector * citi_get_vector (struct citi_package_t * p, int n) { + ::vector * v = p->data; + for (int i = 0; v != NULL; v = (::vector *) v->getNext (), i++) { if (i == n) return v; } return NULL; @@ -87,11 +87,11 @@ static char * citi_get_package (struct citi_package_t * p) { } /* Create a valid vector for the dataset. */ -static vector * citi_create_vector (struct citi_package_t * p, int i, +static ::vector * citi_create_vector (struct citi_package_t * p, int i, char * n, char * type) { - vector * vec; + ::vector * vec; vec = citi_get_vector (p, i); // fetch vector - vec = new vector (*vec); // copy vector + vec = new ::vector (*vec); // copy vector vec->reverse (); // reverse vector // convert data if necessary @@ -123,14 +123,14 @@ static int citi_vector_length (strlist deps) { return 0; // calculate length of resulting dependent variable for (int i = 0; i < deps.length(); i++) { - vector * v = citi_result->findDependency (deps.get (i)); + ::vector * v = citi_result->findDependency (deps.get (i)); if (v != NULL) n *= v->getSize (); } return n; } /* Checks length of variable vectors. */ -static int citi_check_dep_length (vector * v, strlist deps, char * package) { +static int citi_check_dep_length (::vector * v, strlist deps, char * package) { int rlength = v->getSize (); int dlength = citi_vector_length (deps); if (rlength != dlength) { @@ -156,10 +156,10 @@ void citi_finalize (void) { hn = h->next; free (h); } - vector * v, * vn; + ::vector * v, * vn; /* go through each vector */ for (v = p->data; v != NULL; v = vn) { - vn = (vector *) v->getNext (); + vn = (::vector *) v->getNext (); delete v; } pn = p->next; @@ -209,7 +209,7 @@ int citi_check (void) { /* go through each header */ for (h = p->head; h != NULL; h = h->next) { - vector * v; + ::vector * v; if (h->var != NULL) { char txt[256]; if (h->i1 >= 0) { diff --git a/qucs-core/src/check_citi.h b/qucs-core/src/check_citi.h index 631545433b..ea79e488f3 100644 --- a/qucs-core/src/check_citi.h +++ b/qucs-core/src/check_citi.h @@ -42,7 +42,7 @@ struct citi_header_t { struct citi_package_t { struct citi_header_t * head; - vector * data; + ::vector * data; struct citi_package_t * next; }; diff --git a/qucs-core/src/check_csv.cpp b/qucs-core/src/check_csv.cpp index dbab83040c..8ebf463367 100644 --- a/qucs-core/src/check_csv.cpp +++ b/qucs-core/src/check_csv.cpp @@ -44,14 +44,14 @@ #include "check_csv.h" strlist * csv_header = NULL; -vector * csv_vector = NULL; +::vector * csv_vector = NULL; dataset * csv_result = NULL; /* Removes temporary data items from memory if necessary. */ static void csv_finalize (void) { - vector * root, * next; + ::vector * root, * next; for (root = csv_vector; root != NULL; root = next) { - next = (vector *) root->getNext (); + next = (::vector *) root->getNext (); delete root; } csv_vector = NULL; @@ -76,7 +76,7 @@ static void csv_validate_str (char * n) { /* Creates dataset from CSV vectors. */ static void csv_create_dataset (int len) { - vector * dep, * indep, * v; + ::vector * dep, * indep, * v; char * n, depn[256]; strlist * s; @@ -84,7 +84,7 @@ static void csv_create_dataset (int len) { csv_result = new dataset (); // add dependency vector - indep = new vector (); + indep = new ::vector (); csv_result->appendDependency (indep); s = new strlist (); n = csv_header ? csv_header->get (0) : (char *) "x"; @@ -94,7 +94,7 @@ static void csv_create_dataset (int len) { // create variable vector(s) for (int i = 1; i < len; i++) { - v = new vector (); + v = new ::vector (); n = csv_header ? csv_header->get (i) : NULL; if (n == NULL) { sprintf (depn, "y%d", i); @@ -107,12 +107,12 @@ static void csv_create_dataset (int len) { } // fill all vectors in dataset - for (v = csv_vector; v != NULL; v = (vector *) v->getNext ()) { + for (v = csv_vector; v != NULL; v = (::vector *) v->getNext ()) { dep = csv_result->getVariables (); int l; for (l = 0; l < v->getSize () - 1; l++) { dep->add (v->get (l)); - dep = (vector *) dep->getNext (); + dep = (::vector *) dep->getNext (); } indep->add (v->get (l)); } @@ -135,7 +135,7 @@ int csv_check (void) { // data lines available else { // check number of columns in each data line - for (vector * v = csv_vector; v != NULL; v = (vector *) v->getNext ()) { + for (::vector * v = csv_vector; v != NULL; v = (::vector *) v->getNext ()) { if (len == -1) len = v->getSize (); else { if (v->getSize () != len) { diff --git a/qucs-core/src/check_csv.h b/qucs-core/src/check_csv.h index 2227859a5b..98097319df 100644 --- a/qucs-core/src/check_csv.h +++ b/qucs-core/src/check_csv.h @@ -30,7 +30,7 @@ class vector; class strlist; extern dataset * csv_result; -extern vector * csv_vector; +extern ::vector * csv_vector; extern strlist * csv_header; /* Externalize variables used by the scanner and parser. */ diff --git a/qucs-core/src/check_netlist.cpp b/qucs-core/src/check_netlist.cpp index c584aa8a7e..f59466dd94 100644 --- a/qucs-core/src/check_netlist.cpp +++ b/qucs-core/src/check_netlist.cpp @@ -230,7 +230,7 @@ static variable * checker_add_variable (environment * env, c->d = 0.0; // initialize the variable break; case TAG_VECTOR: - c->v = new vector (); + c->v = new ::vector (); break; } v->setConstant (c); diff --git a/qucs-core/src/check_touchstone.cpp b/qucs-core/src/check_touchstone.cpp index df3b176df3..80b31f76ef 100644 --- a/qucs-core/src/check_touchstone.cpp +++ b/qucs-core/src/check_touchstone.cpp @@ -47,7 +47,7 @@ strlist * touchstone_idents = NULL; dataset * touchstone_result = NULL; -vector * touchstone_vector = NULL; +::vector * touchstone_vector = NULL; /* default touchstone options */ struct touchstone_t touchstone_options = { @@ -61,13 +61,13 @@ static const char * touchstone_valid_options[] = { input and output list of vectors of this function is the touchstone_vector variable. */ static void touchstone_join (void) { - vector * yroot, * xroot, * next = NULL; + ::vector * yroot, * xroot, * next = NULL; /* go through each vector */ for (yroot = touchstone_vector; yroot != NULL; yroot = next) { /* go through each trailing vector */ - next = (vector *) yroot->getNext (); + next = (::vector *) yroot->getNext (); for (xroot = next; xroot != NULL; xroot = next) { - next = (vector *) xroot->getNext (); + next = (::vector *) xroot->getNext (); /* append xroot vector to yroot vector (even no. of values) ? */ if ((xroot->getSize () & 1) == 0) { /* yes, delete the xroot vector and adjust list */ @@ -89,7 +89,7 @@ static void touchstone_join (void) { matrix. The function return zero on success and non-zero otherwise. */ static int touchstone_vector_check (void) { - vector * root = touchstone_vector, * next; + ::vector * root = touchstone_vector, * next; int even = 0, errors = 0, size = root->getSize (), noise = 0, lines = 1; nr_double_t f = real (root->get (0)); @@ -111,8 +111,8 @@ static int touchstone_vector_check (void) { } /* go through each vector */ - for (root = (vector *) root->getNext (); root != NULL; root = next) { - next = (vector *) root->getNext (); + for (root = (::vector *) root->getNext (); root != NULL; root = next) { + next = (::vector *) root->getNext (); nr_double_t freq = real (root->get (0)); /* check increasing frequency value */ @@ -214,21 +214,21 @@ static char * touchstone_create_set (int r, int c) { /* The function actually creates the resulting dataset. */ static void touchstone_create (void) { - vector * f, * v, * root, * next, * nf = NULL; + ::vector * f, * v, * root, * next, * nf = NULL; int ports = touchstone_options.ports, n; nr_complex_t val; strlist * s; /* create dataset and frequency vector */ touchstone_result = new dataset (); - f = new vector ("frequency"); + f = new ::vector ("frequency"); touchstone_result->appendDependency (f); s = new strlist (); s->add (f->getName ()); /* create variable vectors for the resulting dataset */ for (int r = 0; r < ports; r++) { for (int c = 0; c < ports; c++) { - v = new vector (); + v = new ::vector (); v->setName (touchstone_create_set (r, c)); v->setDependencies (new strlist (*s)); touchstone_result->appendVariable (v); @@ -238,18 +238,18 @@ static void touchstone_create (void) { /* create noise vectors if necessary */ if (touchstone_options.noise) { - nf = new vector ("nfreq"); + nf = new ::vector ("nfreq"); touchstone_result->appendDependency (nf); s = new strlist (); s->add (nf->getName ()); /* append noise parameters to dataset */ - v = new vector ("Fmin"); + v = new ::vector ("Fmin"); v->setDependencies (new strlist (*s)); touchstone_result->appendVariable (v); - v = new vector ("Sopt"); + v = new ::vector ("Sopt"); v->setDependencies (new strlist (*s)); touchstone_result->appendVariable (v); - v = new vector ("Rn"); + v = new ::vector ("Rn"); v->setDependencies (new strlist (*s)); touchstone_result->appendVariable (v); delete s; @@ -257,7 +257,7 @@ static void touchstone_create (void) { /* go through each vector */ for (n = 0, root = touchstone_vector; root != NULL; root = next, n++) { - next = (vector *) root->getNext (); + next = (::vector *) root->getNext (); // handle data lines if (n < touchstone_options.lines) { /* fill frequency vector */ @@ -286,7 +286,7 @@ static void touchstone_create (void) { rad (real (root->get (pos + 1)))); } v->add (val); - v = (vector *) v->getNext (); + v = (::vector *) v->getNext (); } } } @@ -320,7 +320,7 @@ static void touchstone_create (void) { impedance 50 Ohms. */ static void touchstone_normalize_sp (void) { int ports = touchstone_options.ports; - vector * v = touchstone_result->getVariables (); + ::vector * v = touchstone_result->getVariables (); int i, j, n, len = v->getSize (); matrix s = matrix (ports); @@ -331,7 +331,7 @@ static void touchstone_normalize_sp (void) { for (i = 0; i < ports; i++) { for (j = 0; j < ports; j++) { s.set (i, j, v->get (n)); - v = (vector *) v->getNext (); + v = (::vector *) v->getNext (); } } // convert the temporary matrix @@ -341,7 +341,7 @@ static void touchstone_normalize_sp (void) { for (i = 0; i < ports; i++) { for (j = 0; j < ports; j++) { v->set (s.get (i, j), n); - v = (vector *) v->getNext (); + v = (::vector *) v->getNext (); } } } @@ -350,7 +350,7 @@ static void touchstone_normalize_sp (void) { /* The function transforms the reference impedance given in the touchstone file to the internal reference impedance 50 Ohms. */ static void touchstone_normalize (void) { - vector * v = touchstone_result->getVariables (); + ::vector * v = touchstone_result->getVariables (); int ports = touchstone_options.ports; // transform S-parameters if necessary @@ -382,16 +382,16 @@ static void touchstone_normalize (void) { *v /= touchstone_options.resistance; break; } - v = (vector *) v->getNext (); + v = (::vector *) v->getNext (); } } } /* Removes temporary data items from memory if necessary. */ static void touchstone_finalize (void) { - vector * root, * next; + ::vector * root, * next; for (root = touchstone_vector; root != NULL; root = next) { - next = (vector *) root->getNext (); + next = (::vector *) root->getNext (); delete root; } touchstone_vector = NULL; diff --git a/qucs-core/src/check_touchstone.h b/qucs-core/src/check_touchstone.h index 49cb06337e..c4718eaad4 100644 --- a/qucs-core/src/check_touchstone.h +++ b/qucs-core/src/check_touchstone.h @@ -42,7 +42,7 @@ class vector; class strlist; extern dataset * touchstone_result; -extern vector * touchstone_vector; +extern ::vector * touchstone_vector; extern strlist * touchstone_idents; struct touchstone_t { diff --git a/qucs-core/src/circuit.cpp b/qucs-core/src/circuit.cpp index 936af36c95..039cccace5 100644 --- a/qucs-core/src/circuit.cpp +++ b/qucs-core/src/circuit.cpp @@ -651,7 +651,9 @@ void circuit::setMatrixS (matrix s) { circuit. */ matrix circuit::getMatrixS (void) { matrix res (size); - memcpy (res.getData (), MatrixS, sizeof (nr_complex_t) * size * size); + for(unsigned int i=0; i < size; ++i) + for(unsigned int j=0; i < size; ++j) + res(i,j) = MatrixS[i*size + j]; return res; } @@ -670,7 +672,9 @@ void circuit::setMatrixN (matrix n) { matrix of the circuit. */ matrix circuit::getMatrixN (void) { matrix res (size); - memcpy (res.getData (), MatrixN, sizeof (nr_complex_t) * size * size); + for(unsigned int i=0; i < size; ++i) + for(unsigned int j=0; i < size; ++j) + res(i,j) = MatrixN[i*size + j]; return res; } @@ -689,7 +693,9 @@ void circuit::setMatrixY (matrix y) { circuit. */ matrix circuit::getMatrixY (void) { matrix res (size); - memcpy (res.getData (), MatrixY, sizeof (nr_complex_t) * size * size); + for(unsigned int i=0; i < size; ++i) + for(unsigned int j=0; i < size; ++j) + res(i,j) = MatrixY[i*size + j]; return res; } diff --git a/qucs-core/src/circuit.h b/qucs-core/src/circuit.h index 350eefe20d..6fbaea951f 100644 --- a/qucs-core/src/circuit.h +++ b/qucs-core/src/circuit.h @@ -245,7 +245,7 @@ class circuit : public object, public integrator static char * createInternal (const char *, const char *); void setInternalNode (int, const char *); - // matrix operations + // operations void allocMatrixS (void); void allocMatrixN (int sources = 0); void allocMatrixMNA (void); diff --git a/qucs-core/src/components/digital/digisource.cpp b/qucs-core/src/components/digital/digisource.cpp index a92c6a69a2..be7d980f89 100644 --- a/qucs-core/src/components/digital/digisource.cpp +++ b/qucs-core/src/components/digital/digisource.cpp @@ -57,7 +57,7 @@ void digisource::initAC (void) { } void digisource::initTR (void) { - vector * values = getPropertyVector ("times"); + ::vector * values = getPropertyVector ("times"); T = real (sum (*values)); initDC (); } @@ -65,7 +65,7 @@ void digisource::initTR (void) { void digisource::calcTR (nr_double_t t) { char * init = getPropertyString ("init"); nr_double_t v = getPropertyDouble ("V"); - vector * values = getPropertyVector ("times"); + ::vector * values = getPropertyVector ("times"); bool lo = !strcmp (init, "low"); nr_double_t ti = 0; diff --git a/qucs-core/src/components/ifile.cpp b/qucs-core/src/components/ifile.cpp index 2c9159056f..1a5df5402e 100644 --- a/qucs-core/src/components/ifile.cpp +++ b/qucs-core/src/components/ifile.cpp @@ -85,8 +85,8 @@ void ifile::prepare (void) { file); return; } - vector * is = data->getVariables(); // current - vector * ts = data->getDependencies(); // time + ::vector * is = data->getVariables(); // current + ::vector * ts = data->getDependencies(); // time inter = new interpolator (); inter->rvectors (is, ts); inter->prepare (interpolType, dataType); diff --git a/qucs-core/src/components/microstrip/cpwline.cpp b/qucs-core/src/components/microstrip/cpwline.cpp index 0b402e594e..a11124bf1e 100644 --- a/qucs-core/src/components/microstrip/cpwline.cpp +++ b/qucs-core/src/components/microstrip/cpwline.cpp @@ -36,16 +36,20 @@ cpwline::cpwline () : circuit (2) { type = CIR_CPWLINE; } -/* The function computes the complete elliptic integral of first kind +/*! K(k) + + The function computes the complete elliptic integral of first kind K() and the second kind E() using the arithmetic-geometric mean - algorithm (AGM) by Abramowitz and Stegun. */ + algorithm (AGM) by Abramowitz and Stegun. +\todo move to common math +*/ void cpwline::ellipke (nr_double_t arg, nr_double_t &k, nr_double_t &e) { int iMax = 16; if (arg == 1.0) { k = NR_INF; // infinite e = 0; } - else if (isinf (arg) && arg < 0) { + else if (std::isinf (arg) && arg < 0) { k = 0; e = NR_INF; // infinite } diff --git a/qucs-core/src/components/mutualx.cpp b/qucs-core/src/components/mutualx.cpp index 2f434346a4..8318612d2b 100644 --- a/qucs-core/src/components/mutualx.cpp +++ b/qucs-core/src/components/mutualx.cpp @@ -63,8 +63,8 @@ matrix mutualx::calcMatrixY (nr_double_t frequency) { matrix mutualx::calcMatrixZ (nr_double_t frequency) { int inductors = getSize () / 2; int r, c, state; - vector * L = getPropertyVector ("L"); - vector * C = getPropertyVector ("k"); + ::vector * L = getPropertyVector ("L"); + ::vector * C = getPropertyVector ("k"); nr_double_t o = 2 * M_PI * frequency; matrix z = matrix (inductors); @@ -87,8 +87,8 @@ void mutualx::initAC (void) { void mutualx::calcAC (nr_double_t frequency) { int inductors = getSize () / 2; int r, c, state; - vector * L = getPropertyVector ("L"); - vector * C = getPropertyVector ("k"); + ::vector * L = getPropertyVector ("L"); + ::vector * C = getPropertyVector ("k"); nr_double_t o = 2 * M_PI * frequency; // fill D-Matrix @@ -120,8 +120,8 @@ void mutualx::initTR (void) { void mutualx::calcTR (nr_double_t) { int inductors = getSize () / 2; int r, c, state; - vector * L = getPropertyVector ("L"); - vector * C = getPropertyVector ("k"); + ::vector * L = getPropertyVector ("L"); + ::vector * C = getPropertyVector ("k"); nr_double_t * veq = new nr_double_t[inductors * inductors]; nr_double_t * req = new nr_double_t[inductors * inductors]; diff --git a/qucs-core/src/components/spfile.cpp b/qucs-core/src/components/spfile.cpp index 8739c2a3d1..c54346d7c5 100644 --- a/qucs-core/src/components/spfile.cpp +++ b/qucs-core/src/components/spfile.cpp @@ -49,7 +49,7 @@ spfile_vector::~spfile_vector () { } // Passes vectors and their data types to the S-parameter file vector. -void spfile_vector::prepare (vector * _v, vector * _f, +void spfile_vector::prepare (::vector * _v, ::vector * _f, bool _isreal, int it, int dt) { v = _v; f = _f; @@ -341,8 +341,8 @@ void spfile::createVector (int r, int c) { int i = r * getSize () + c; spara[i].r = r; spara[i].c = c; - vector * v = new vector (matvec::createMatrixString ("S", r, c), - sfreq->getSize ()); + ::vector * v = new ::vector (matvec::createMatrixString ("S", r, c), + sfreq->getSize ()); v->setDependencies (new strlist ()); v->getDependencies()->add (sfreq->getName ()); data->addVariable (v); @@ -354,11 +354,11 @@ void spfile::createVector (int r, int c) { frequency vector. It also tries to find the noise parameter data. */ void spfile::createIndex (void) { - vector * v; int s = getSize (); char * n; + ::vector * v; int s = getSize (); char * n; int r, c, i; // go through list of dependency vectors and find frequency vectors - for (v = data->getDependencies (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getDependencies (); v != NULL; v = (::vector *) v->getNext ()) { if ((n = v->getName ()) != NULL) { if (!strcmp (n, "frequency")) sfreq = v; else if (!strcmp (n, "nfreq")) nfreq = v; @@ -369,7 +369,7 @@ void spfile::createIndex (void) { spara = new spfile_vector[s * s] (); // go through list of variable vectors and find matrix entries - for (v = data->getVariables (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getVariables (); v != NULL; v = (::vector *) v->getNext ()) { if ((n = matvec::isMatrixVector (v->getName (), r, c)) != NULL) { // save matrix vector indices i = r * s + c; diff --git a/qucs-core/src/components/spfile.h b/qucs-core/src/components/spfile.h index c7705a744f..88a78cf2e6 100644 --- a/qucs-core/src/components/spfile.h +++ b/qucs-core/src/components/spfile.h @@ -37,12 +37,12 @@ class spfile_vector ~spfile_vector (); public: - void prepare (vector *, vector *, bool, int, int); + void prepare (::vector *, ::vector *, bool, int, int); nr_complex_t interpolate (nr_double_t); public: - vector * v; - vector * f; + ::vector * v; + ::vector * f; int isreal; interpolator * inter; int r; @@ -77,8 +77,8 @@ class spfile : public circuit private: dataset * data; - vector * sfreq; - vector * nfreq; + ::vector * sfreq; + ::vector * nfreq; spfile_vector * spara; spfile_vector * RN; spfile_vector * FMIN; diff --git a/qucs-core/src/components/tswitch.cpp b/qucs-core/src/components/tswitch.cpp index ae8e862d3c..f3ceef20ad 100644 --- a/qucs-core/src/components/tswitch.cpp +++ b/qucs-core/src/components/tswitch.cpp @@ -79,7 +79,7 @@ void tswitch::initAC (void) { } void tswitch::initTR (void) { - vector * values = getPropertyVector ("time"); + ::vector * values = getPropertyVector ("time"); T = real (sum (*values)); repeat = (values->getSize () % 2) == 0 ? true : false; initDC (); @@ -89,7 +89,7 @@ void tswitch::calcTR (nr_double_t t) { char * init = getPropertyString ("init"); nr_double_t ron = getPropertyDouble ("Ron"); nr_double_t roff = getPropertyDouble ("Roff"); - vector * values = getPropertyVector ("time"); + ::vector * values = getPropertyVector ("time"); bool on = !strcmp (init, "on"); nr_double_t ti = 0; diff --git a/qucs-core/src/components/vfile.cpp b/qucs-core/src/components/vfile.cpp index e7a6d54115..39cec602a6 100644 --- a/qucs-core/src/components/vfile.cpp +++ b/qucs-core/src/components/vfile.cpp @@ -87,8 +87,8 @@ void vfile::prepare (void) { file); return; } - vector * vs = data->getVariables(); // voltage - vector * ts = data->getDependencies(); // time + ::vector * vs = data->getVariables(); // voltage + ::vector * ts = data->getDependencies(); // time inter = new interpolator (); inter->rvectors (vs, ts); inter->prepare (interpolType, dataType); diff --git a/qucs-core/src/converter/matlab_producer.cpp b/qucs-core/src/converter/matlab_producer.cpp index b9d7567c4f..78ec0e4a51 100644 --- a/qucs-core/src/converter/matlab_producer.cpp +++ b/qucs-core/src/converter/matlab_producer.cpp @@ -88,7 +88,7 @@ static void matlab_header (nr_int32_t rows, nr_int32_t cols, char * name) { } // Writes a Matlab v4 vector. -static void matlab_vector (vector * v) { +static void matlab_vector (::vector * v) { int n; // real part @@ -124,7 +124,7 @@ static void matlab_matrix (matrix * m) { } // Saves a dataset vector into a Matlab file. -static void matlab_save (vector * v) { +static void matlab_save (::vector * v) { int r, c; char * n, * sn; char * vn = v->getName (); @@ -170,18 +170,18 @@ static void matlab_save (vector * v) { void matlab_producer (void) { dataset * data = qucs_data; - vector * v; + ::vector * v; // initialize endianness initendian (); // independent vectors and matrices - for (v = data->getDependencies (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getDependencies (); v != NULL; v = (::vector *) v->getNext ()) { matlab_save (v); } // dependent vectors and matrices - for (v = data->getVariables (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getVariables (); v != NULL; v = (::vector *) v->getNext ()) { matlab_save (v); } } diff --git a/qucs-core/src/converter/touchstone_producer.cpp b/qucs-core/src/converter/touchstone_producer.cpp index 1383d211ed..a0fe34da35 100644 --- a/qucs-core/src/converter/touchstone_producer.cpp +++ b/qucs-core/src/converter/touchstone_producer.cpp @@ -46,12 +46,12 @@ struct touchstone_data_t { int ports; // number of S-parameter ports double resistance; // reference impedance const char * format; // data format - vector * vd; // appropriate dependency vector + ::vector * vd; // appropriate dependency vector matvec * mv; // appropriate data matrix vector - vector * fmin; // minimum noise figure - vector * sopt; // optimum input refelction for minimum noise figure - vector * rn; // effective noise resistance - vector * vf; // dependency vector for noise + ::vector * fmin; // minimum noise figure + ::vector * sopt; // optimum input refelction for minimum noise figure + ::vector * rn; // effective noise resistance + ::vector * vf; // dependency vector for noise } touchstone_data; @@ -176,13 +176,13 @@ void touchstone_print (void) { type (G, H, Y, Z, etc.) matrix from the given dataset and stores it into the global Touchstone structure. */ void touchstone_find_data (dataset * data, const char * name) { - vector * v; + ::vector * v; char * n, * vn, * vd = NULL, * vf = NULL; strlist * deps; int r, c, rs = -1, cs = -1, s = 0; // find parameter matrix data and its dimensions - for (v = data->getVariables (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getVariables (); v != NULL; v = (::vector *) v->getNext ()) { vn = v->getName (); // requested matrix vector name found? if (strstr (vn, name) == vn) { @@ -222,7 +222,7 @@ void touchstone_find_data (dataset * data, const char * name) { matvec * mv = new matvec (s, ss + 1, ss + 1); mv->setName (name); // fill in matrix vectors - for (v = data->getVariables (); v; v = (vector *) v->getNext ()) { + for (v = data->getVariables (); v; v = (::vector *) v->getNext ()) { vn = v->getName (); if (strstr (vn, name) == vn) { if ((n = matvec::isMatrixVector (vn, r, c)) != NULL) { @@ -235,7 +235,7 @@ void touchstone_find_data (dataset * data, const char * name) { touchstone_data.mv = mv; touchstone_data.parameter = toupper (mv->getName ()[0]); // look for dependency (frequency) vector - for (v = data->getDependencies (); v; v = (vector *) v->getNext ()) { + for (v = data->getDependencies (); v; v = (::vector *) v->getNext ()) { if (vd && !strcmp (v->getName (), vd)) { touchstone_data.vd = v; } diff --git a/qucs-core/src/dataset.h b/qucs-core/src/dataset.h index ac0615c44c..4d24bdefef 100644 --- a/qucs-core/src/dataset.h +++ b/qucs-core/src/dataset.h @@ -34,32 +34,32 @@ class dataset : public object dataset (char *); dataset (const dataset &); ~dataset (); - void addDependency (vector *); - void addDependencies (vector *); - void appendDependency (vector *); - void appendDependencies (vector *); - void addVariable (vector *); - void addVariables (vector *); - void appendVariable (vector *); - void appendVariables (vector *); - void applyDependencies (vector * v); - void delDependency (vector *); - void delVariable (vector *); + void addDependency (::vector *); + void addDependencies (::vector *); + void appendDependency (::vector *); + void appendDependencies (::vector *); + void addVariable (::vector *); + void addVariables (::vector *); + void appendVariable (::vector *); + void appendVariables (::vector *); + void applyDependencies (::vector * v); + void delDependency (::vector *); + void delVariable (::vector *); void assignDependency (char *, char *); char * getFile (void); void setFile (const char *); void print (void); - void printData (vector *, FILE *); - void printDependency (vector *, FILE *); - void printVariable (vector *, FILE *); - vector * findDependency (const char *); - vector * findVariable (const char *); - vector * getDependencies (void) { return dependencies; } - vector * getVariables (void) { return variables; } - int isDependency (vector *); - int isVariable (vector *); - vector * findOrigin (char *); + void printData (::vector *, FILE *); + void printDependency (::vector *, FILE *); + void printVariable (::vector *, FILE *); + ::vector * findDependency (const char *); + ::vector * findVariable (const char *); + ::vector * getDependencies (void) { return dependencies; } + ::vector * getVariables (void) { return variables; } + int isDependency (::vector *); + int isVariable (::vector *); + ::vector * findOrigin (char *); static dataset * load (const char *); static dataset * load_touchstone (const char *); static dataset * load_csv (const char *); @@ -72,8 +72,8 @@ class dataset : public object private: char * file; - vector * dependencies; - vector * variables; + ::vector * dependencies; + ::vector * variables; }; #endif /* __DATASET_H__ */ diff --git a/qucs-core/src/environment.cpp b/qucs-core/src/environment.cpp index 8b0058bf40..2a6044c4e2 100644 --- a/qucs-core/src/environment.cpp +++ b/qucs-core/src/environment.cpp @@ -349,7 +349,7 @@ void environment::updateReferences (environment * up) { } // Returns vector of an assignment in the equation checker. -vector environment::getVector (char * ident) { +::vector environment::getVector (char * ident) { return checkee->getVector (ident); } diff --git a/qucs-core/src/environment.h b/qucs-core/src/environment.h index 92ed222a2b..8a8c851768 100644 --- a/qucs-core/src/environment.h +++ b/qucs-core/src/environment.h @@ -64,7 +64,7 @@ class environment void equationSolver (void); // subcircuit specific - vector getVector (char *); + ::vector getVector (char *); void setDoubleConstant (char *, nr_double_t); nr_double_t getDoubleConstant (char *); void setDouble (char *, nr_double_t); diff --git a/qucs-core/src/eqnsys.cpp b/qucs-core/src/eqnsys.cpp index f61f11fc4e..3f74c2852e 100644 --- a/qucs-core/src/eqnsys.cpp +++ b/qucs-core/src/eqnsys.cpp @@ -869,7 +869,7 @@ nr_double_t eqnsys::euclidian_r (int r, int c) { template inline nr_type_t cond_conj (nr_type_t t) { - return std::tr1::conj(t); + return std::conj(t); } template <> diff --git a/qucs-core/src/equation.cpp b/qucs-core/src/equation.cpp index 0b330495e4..7623fc0aab 100644 --- a/qucs-core/src/equation.cpp +++ b/qucs-core/src/equation.cpp @@ -91,7 +91,7 @@ constant::constant (const constant & o) : node (o) { c = dataref ? o.c : new nr_complex_t (*o.c); break; case TAG_VECTOR: - v = dataref ? o.v : new vector (*o.v); + v = dataref ? o.v : new ::vector (*o.v); break; case TAG_MATRIX: m = dataref ? o.m : new matrix (*o.m); @@ -1007,15 +1007,15 @@ nr_complex_t node::getResultComplex (void) { /* Returns an immediate vector depending on the type of the equation nodes result type. */ -vector node::getResultVector (void) { +::vector node::getResultVector (void) { constant * c = getResult (); - vector v; + ::vector v; if (c != NULL) { switch (getType ()) { case TAG_MATRIX: { int ro, co, n = 0; - v = vector (c->m->getRows () * c->m->getCols ()); + v = ::vector (c->m->getRows () * c->m->getCols ()); for (co = 0; co < c->m->getCols (); co++) for (ro = 0; ro < c->m->getRows (); ro++) v (n++) = c->m->get (ro, co); @@ -1024,11 +1024,11 @@ vector node::getResultVector (void) { case TAG_VECTOR: v = *(c->v); break; case TAG_DOUBLE: - v = vector (1); v (0) = c->d; break; + v = ::vector (1); v (0) = c->d; break; case TAG_COMPLEX: - v = vector (1); v (0) = *(c->c); break; + v = ::vector (1); v (0) = *(c->c); break; case TAG_BOOLEAN: - v = vector (1); v (0) = c->b ? 1.0 : 0.0; break; + v = ::vector (1); v (0) = c->b ? 1.0 : 0.0; break; } } return v; @@ -1629,7 +1629,7 @@ void solver::evaluate (void) { /* This function adds the given dataset vector to the set of equations stored in the equation solver. */ -node * solver::addEquationData (vector * v, bool ref) { +node * solver::addEquationData (::vector * v, bool ref) { constant * con = new constant (TAG_VECTOR); con->v = v; con->dataref = ref; @@ -1644,12 +1644,12 @@ node * solver::addEquationData (vector * v, bool ref) { /* The function puts the given vector into the equation set. The resulting data vector is going to be copied and exported - given a generated name based upon the second argument. */ -node * solver::addGeneratedEquation (vector * v, const char * n) { +node * solver::addGeneratedEquation (::vector * v, const char * n) { // create generated name char * str = (char *) malloc (strlen (n) + 6); sprintf (str, "%s.%04d", n, ++generated); // copy data vector - vector * c = new vector (*v); + ::vector * c = new ::vector (*v); c->setName (str); // put vector into the equation set and ensure data export as // independent variable @@ -1666,24 +1666,24 @@ node * solver::addGeneratedEquation (vector * v, const char * n) { /* Depending on the type of equation result the function converts the given equation node to one or more valid dataset vector(s). */ -vector * solver::dataVector (node * eqn) { - vector * v = NULL; +::vector * solver::dataVector (node * eqn) { + ::vector * v = NULL; if (!eqn->getResult ()) return NULL; switch (eqn->getType ()) { case TAG_VECTOR: // simple vector - v = new vector (* (eqn->getResult()->v)); + v = new ::vector (* (eqn->getResult()->v)); v->setNext (NULL); v->setPrev (NULL); break; case TAG_DOUBLE: // double value - v = new vector (); + v = new ::vector (); v->add (eqn->getResult()->d); break; case TAG_BOOLEAN: // boolean value - v = new vector (); + v = new ::vector (); v->add (eqn->getResult()->b ? 1 : 0); break; case TAG_COMPLEX: // complex value - v = new vector (); + v = new ::vector (); v->add (* (eqn->getResult()->c)); break; case TAG_MATVEC: // matrix vector @@ -1694,7 +1694,7 @@ vector * solver::dataVector (node * eqn) { for (int r = 0; r < mv->getRows (); r++) { for (int c = 0; c < mv->getCols (); c++) { // name gets automatically assigned - vector * t = new vector (mv->get (r, c)); + ::vector * t = new ::vector (mv->get (r, c)); // chain the vectors appropriately t->setNext (v); v = t; } @@ -1707,7 +1707,7 @@ vector * solver::dataVector (node * eqn) { matrix * m = eqn->getResult()->m; for (int r = 0; r < m->getRows (); r++) { for (int c = 0; c < m->getCols (); c++) { - vector * t = new vector (); + ::vector * t = new ::vector (); t->setName (matvec::createMatrixString (A(eqn)->result, r, c)); t->add (m->get (r, c)); // chain the vectors appropriately @@ -1727,10 +1727,10 @@ vector * solver::dataVector (node * eqn) { these to the list of equation node inside the equation solver. */ void solver::checkinDataset (void) { if (data == NULL) return; - vector * v; + ::vector * v; findMatrixVectors (data->getDependencies ()); findMatrixVectors (data->getVariables ()); - for (v = data->getDependencies (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getDependencies (); v != NULL; v = (::vector *) v->getNext ()) { if (v->getRequested () != -1) { node * eqn = addEquationData (v, true); strlist * deps = new strlist (); @@ -1739,7 +1739,7 @@ void solver::checkinDataset (void) { delete deps; } } - for (v = data->getVariables (); v != NULL; v = (vector *) v->getNext ()) { + for (v = data->getVariables (); v != NULL; v = (::vector *) v->getNext ()) { if (v->getRequested () != -1) { node * eqn = addEquationData (v, true); eqn->setDataDependencies (v->getDependencies ()); @@ -1751,21 +1751,21 @@ void solver::checkinDataset (void) { for possible matrix vectors. These are detected by the vectors' names (e.g. S[1,1]). The matrix vectors found in the dataset get converted and saved into the set of equations. */ -void solver::findMatrixVectors (vector * v) { - vector * vec; +void solver::findMatrixVectors (::vector * v) { + ::vector * vec; strlist * deps; char * p, * cand; int s, r, c, a, b, n = 1; // initialize the 'found' flag - for (vec = v; vec != NULL; vec = (vector *) vec->getNext ()) + for (vec = v; vec != NULL; vec = (::vector *) vec->getNext ()) vec->setRequested (0); // loop through the dataset vector until no more matrix vector is found do { r = c = s = -1; cand = NULL; deps = NULL; // go through the dataset - for (vec = v; vec != NULL; vec = (vector *) vec->getNext ()) { + for (vec = v; vec != NULL; vec = (::vector *) vec->getNext ()) { // skip detected vectors if (vec->getRequested ()) continue; // is the vector a possible matrix vector element ? @@ -1800,7 +1800,7 @@ void solver::findMatrixVectors (vector * v) { matvec * mv = new matvec (s, r + 1, c + 1); mv->setName (cand); // go through the dataset vector once again - for (vec = v; vec != NULL; vec = (vector *) vec->getNext ()) { + for (vec = v; vec != NULL; vec = (::vector *) vec->getNext ()) { // and collect the vectors with the same 'found' flags if (vec->getRequested () == n) { p = matvec::isMatrixVector (vec->getName (), a, b); @@ -1886,8 +1886,8 @@ int solver::dataSize (strlist * deps) { int size = 1; for (int i = 0; deps != NULL && i < deps->length (); i++) { char * str = deps->get (i); - vector * dep = data->findDependency (str); - vector * var = data->findVariable (str); + ::vector * dep = data->findDependency (str); + ::vector * var = data->findVariable (str); size *= dep ? dep->getSize () : var ? var->getSize () : 1; } return size; @@ -1896,8 +1896,8 @@ int solver::dataSize (strlist * deps) { /* The function returns the data vector in the dataset according to the given variable name. If there is no such variable, it returns NULL. */ -vector * solver::getDataVector (char * str) { - vector * var; +::vector * solver::getDataVector (char * str) { + ::vector * var; /* search for variables in dataset */ if (data != NULL) { if ((var = data->findVariable (str)) != NULL) @@ -1981,7 +1981,7 @@ void solver::checkoutDataset (void) { // is the equation result already in the dataset ? if (!findEquationResult (eqn)) { - vector * v = dataVector (eqn); + ::vector * v = dataVector (eqn); if (v == NULL) continue; // collect inherited dataset dependencies @@ -2236,11 +2236,11 @@ void checker::setDouble (char * ident, nr_double_t val) { /* The functions looks through the set of equations for a vector result and returns it. If there is no such assignment, an empty vector is returned. */ -vector checker::getVector (char * ident) { +::vector checker::getVector (char * ident) { foreach_equation (eqn) { if (!strcmp (ident, eqn->result)) { return eqn->getResultVector (); } } - return vector (); + return ::vector (); } diff --git a/qucs-core/src/equation.h b/qucs-core/src/equation.h index 61259da268..1034311794 100644 --- a/qucs-core/src/equation.h +++ b/qucs-core/src/equation.h @@ -87,7 +87,7 @@ class node constant * getResult (void) { return res; } nr_double_t getResultDouble (void); nr_complex_t getResultComplex (void); - vector getResultVector (void); + ::vector getResultVector (void); void setResult (constant *); char * getInstance (void); void setInstance (const char *); @@ -164,7 +164,7 @@ class constant : public node union { nr_double_t d; nr_complex_t * c; - vector * v; + ::vector * v; matrix * m; matvec * mv; char chr; @@ -302,7 +302,7 @@ class checker bool containsVariable (char *); nr_double_t getDouble (char *); void setDouble (char *, nr_double_t); - vector getVector (char *); + ::vector getVector (char *); void setDefinitions (struct definition_t * d) { defs = d; } struct definition_t * getDefinitions (void) { return defs; } node * findProperty (char *); @@ -326,10 +326,10 @@ class solver void setData (dataset * d) { data = d; } dataset * getDataset (void) { return data; } void evaluate (void); - node * addEquationData (vector *, bool ref = false); + node * addEquationData (::vector *, bool ref = false); node * addEquationData (matvec *); - node * addGeneratedEquation (vector *, const char *); - vector * dataVector (node *); + node * addGeneratedEquation (::vector *, const char *); + ::vector * dataVector (node *); void checkinDataset (void); void checkoutDataset (void); static int dataSize (constant *); @@ -337,8 +337,8 @@ class solver int getDataSize (char *); strlist * collectDataDependencies (node *); int dataSize (strlist *); - vector * getDataVector (char *); - void findMatrixVectors (vector *); + ::vector * getDataVector (char *); + void findMatrixVectors (::vector *); char * isMatrixVector (char *, int&, int&); int findEquationResult (node *); int solve (dataset *); diff --git a/qucs-core/src/evaluate.cpp b/qucs-core/src/evaluate.cpp index 81be88b5ed..68db8f6229 100644 --- a/qucs-core/src/evaluate.cpp +++ b/qucs-core/src/evaluate.cpp @@ -79,7 +79,7 @@ using namespace fspecial; #define _D(var,idx) nr_double_t (var) = D (_ARES (idx)); #define _BO(var,idx) bool (var) = B (_ARES (idx)); #define _CX(var,idx) nr_complex_t * (var) = C (_ARES (idx)); -#define _V(var,idx) vector * (var) = V (_ARES (idx)); +#define _V(var,idx) ::vector * (var) = V (_ARES (idx)); #define _M(var,idx) matrix * (var) = M (_ARES (idx)); #define _MV(var,idx) matvec * (var) = MV (_ARES (idx)); #define _I(var,idx) int (var) = INT (_ARES (idx)); @@ -123,14 +123,14 @@ using namespace fspecial; #define _RETD(var) res->d = (var); return res; #define _RETB(var) res->b = (var); return res; #define _RETC(var) res->c = new nr_complex_t (var); return res; -#define _RETV(var) res->v = new vector (var); return res; +#define _RETV(var) res->v = new ::vector (var); return res; #define _RETM(var) res->m = new matrix (var); return res; #define _RETMV(var) res->mv = new matvec (var); return res; #define _RETR(var) res->r = (var); return res; // Return value macros without arguments. #define __RETC() res->c = new nr_complex_t (); return res; -#define __RETV() res->v = new vector (); return res; +#define __RETV() res->v = new ::vector (); return res; #define __RETM() res->m = new matrix (); return res; #define __RETMV() res->mv = new matvec (); return res; @@ -1283,7 +1283,7 @@ constant * evaluate::deg2rad_c (constant * args) { constant * evaluate::deg2rad_v (constant * args) { _ARV0 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) v->add (rad (real (v1->get (i)))); res->v = v; return res; @@ -1304,7 +1304,7 @@ constant * evaluate::rad2deg_c (constant * args) { constant * evaluate::rad2deg_v (constant * args) { _ARV0 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) v->add (deg (real (v1->get (i)))); res->v = v; return res; @@ -1794,7 +1794,7 @@ constant * evaluate::rtoswr_c (constant * args) { constant * evaluate::rtoswr_v (constant * args) { _ARV0 (v1); _DEFV (); - res->v = new vector (v1->getSize ()); + res->v = new ::vector (v1->getSize ()); for (int i = 0; i < v1->getSize (); i++) res->v->set ((1 + abs (v1->get (i))) / (1 - abs (v1->get (i))), i); return res; @@ -2032,9 +2032,9 @@ constant * evaluate::index_mv_2 (constant * args) { sprintf (txt, "matvec indices [%d,%d] out of bounds [1-%d,1-%d]", r, c, mv->getRows (), mv->getCols ()); THROW_MATH_EXCEPTION (txt); - res->v = new vector (mv->getSize ()); + res->v = new ::vector (mv->getSize ()); } else { - res->v = new vector (mv->get (r - 1, c - 1)); + res->v = new ::vector (mv->get (r - 1, c - 1)); } return res; } @@ -2068,7 +2068,7 @@ void evaluate::extract_vector (constant * args, int idx, int &skip, int &size, _ARV0 (v); int i = INT (_ARES (idx)); int type = _ARG(idx)->getType (); - vector * vres; + ::vector * vres; strlist * deps = _ARES(0)->getDataDependencies (); int didx = (deps ? deps->length () : 0) - idx; int dsize = SOLVEE(0)->getDependencySize (deps, idx); @@ -2077,7 +2077,7 @@ void evaluate::extract_vector (constant * args, int idx, int &skip, int &size, if (type == TAG_RANGE) { if (dsize > 1) { // dependent vectors: only ':' possible - vres = new vector (*(res->v)); + vres = new ::vector (*(res->v)); skip *= deps ? SOLVEE(0)->getDataSize (deps->get (didx - 1)) : 1; size *= deps ? SOLVEE(0)->getDataSize (deps->get (didx)) : 1; } @@ -2100,7 +2100,7 @@ void evaluate::extract_vector (constant * args, int idx, int &skip, int &size, } size = 0; for (n = 0; n < len; n++) if (r->inside (n)) size++; - vres = new vector (size); + vres = new ::vector (size); for (k = 0, n = 0; n < len; n++) { if (r->inside (n)) vres->set (res->v->get (n), k++); @@ -2109,7 +2109,7 @@ void evaluate::extract_vector (constant * args, int idx, int &skip, int &size, } // a subset else { - vres = new vector (dsize * size); + vres = new ::vector (dsize * size); int len = deps ? SOLVEE(0)->getDataSize (deps->get (didx)) : v->getSize (); if (i < 0 || i >= len) { char txt[256]; @@ -2134,7 +2134,7 @@ constant * evaluate::index_v_1 (constant * args) { _ARV0 (v); _DEFV (); int skip = 1, size = 1; - res->v = new vector (*v); + res->v = new ::vector (*v); extract_vector (args, 1, skip, size, res); return res; } @@ -2143,7 +2143,7 @@ constant * evaluate::index_v_2 (constant * args) { _ARV0 (v); _DEFV (); int skip = 1, size = 1; - res->v = new vector (*v); + res->v = new ::vector (*v); if (!EQUATION_HAS_DEPS (_ARES(0), 2)) { char txt[256]; sprintf (txt, "invalid number of vector indices (%d > %d)", 2, @@ -2203,16 +2203,16 @@ constant * evaluate::interpolate_v_v_d (constant * args) { if (v1->getSize () < 3) { THROW_MATH_EXCEPTION ("interpolate: number of datapoints must be greater " "than 2"); - res->v = new vector (); + res->v = new ::vector (); return res; } nr_double_t last = real (v2->get (v2->getSize () - 1)); nr_double_t first = real (v2->get (0)); constant * arg = new constant (TAG_VECTOR); - arg->v = new vector (::linspace (first, last, n)); + arg->v = new ::vector (::linspace (first, last, n)); arg->solvee = args->getResult(0)->solvee; arg->evaluate (); - vector * val = new vector (n); + ::vector * val = new ::vector (n); spline spl (SPLINE_BC_NATURAL); spl.vectors (*v1, *v2); spl.construct (); @@ -2233,7 +2233,7 @@ constant * evaluate:: QUCS_CONCAT2 (efunc,_v_v) (constant * args) { \ _ARV0 (v); \ _ARV1 (t); \ _DEFV (); \ - vector * val = new vector (QUCS_CONCAT2 (cfunc,_1d) (*v)); \ + ::vector * val = new ::vector (QUCS_CONCAT2 (cfunc,_1d) (*v)); \ int k = val->getSize (); \ *val = isign > 0 ? *val / k : *val * k; \ res->v = val; \ @@ -2245,7 +2245,7 @@ constant * evaluate:: QUCS_CONCAT2 (efunc,_v_v) (constant * args) { \ nr_double_t first = real (t->get (0)); \ nr_double_t delta = (last - first) / (n - 1); \ constant * arg = new constant (TAG_VECTOR); \ - arg->v = new vector (::linspace (0, 1.0 / delta, n)); \ + arg->v = new ::vector (::linspace (0, 1.0 / delta, n)); \ arg->solvee = args->getResult(0)->solvee; \ arg->evaluate (); \ node * gen = SOLVEE(0)->addGeneratedEquation (arg->v, dep); \ @@ -2259,7 +2259,7 @@ constant * evaluate:: QUCS_CONCAT2 (efunc,_v_v) (constant * args) { \ constant * evaluate:: QUCS_CONCAT2 (cfunc,_v) (constant * args) { \ _ARV0 (v); \ _DEFV (); \ - vector * val = new vector (QUCS_CONCAT2 (cfunc,_1d) (*v)); \ + ::vector * val = new ::vector (QUCS_CONCAT2 (cfunc,_1d) (*v)); \ res->v = val; \ res->dropdeps = 1; \ return res; \ @@ -2276,7 +2276,7 @@ FOURIER_HELPER_2 (idft); constant * evaluate::fftshift_v (constant * args) { _ARV0 (v); _DEFV (); - res->v = new vector (fftshift (*v)); + res->v = new ::vector (fftshift (*v)); return res; } @@ -2657,7 +2657,7 @@ constant * evaluate::mu1_m (constant * args) { constant * evaluate::mu1_mv (constant * args) { _ARMV0 (mv); _DEFV (); - vector k; + ::vector k; k = (1 - norm (mv->get (0, 0))) / (abs (mv->get (1, 1) - conj (mv->get (0, 0)) * det (*mv)) + abs (mv->get (0, 1) * mv->get (1, 0))); @@ -2677,7 +2677,7 @@ constant * evaluate::mu2_m (constant * args) { constant * evaluate::mu2_mv (constant * args) { _ARMV0 (mv); _DEFV (); - vector k; + ::vector k; k = (1 - norm (mv->get (1, 1))) / (abs (mv->get (0, 0) - conj (mv->get (1, 1)) * det (*mv)) + abs (mv->get (0, 1) * mv->get (1, 0))); @@ -2704,7 +2704,7 @@ constant * evaluate::linspace (constant * args) { _DEFV (); if (points < 2) { THROW_MATH_EXCEPTION ("linspace: number of points must be greater than 1"); - res->v = new vector (); + res->v = new ::vector (); return res; } _RETV (::linspace (start, stop, points)); @@ -2717,12 +2717,12 @@ constant * evaluate::logspace (constant * args) { _DEFV (); if (points < 2) { THROW_MATH_EXCEPTION ("logspace: number of points must be greater than 1"); - res->v = new vector (); + res->v = new ::vector (); return res; } if (start * stop <= 0) { THROW_MATH_EXCEPTION ("logspace: invalid start/stop values"); - res->v = new vector (points); + res->v = new ::vector (points); return res; } _RETV (::logspace (start, stop, points)); @@ -2734,11 +2734,11 @@ constant * evaluate::logspace (constant * args) { if (n < 2) { \ THROW_MATH_EXCEPTION ("Circle: number of points must be greater than 1"); \ _DEFV (); \ - res->v = new vector (); \ + res->v = new ::vector (); \ return res; \ } \ constant * arg = new constant (TAG_VECTOR); \ - arg->v = new vector (::linspace (0, 360, n)); \ + arg->v = new ::vector (::linspace (0, 360, n)); \ arg->solvee = args->getResult(0)->solvee; \ arg->evaluate (); \ delete args->get(argi); \ @@ -2748,24 +2748,24 @@ constant * evaluate::logspace (constant * args) { // Circle helper macro with no additional argument given. #define CIRCLE_HELPER_A() \ constant * arg = new constant (TAG_VECTOR); \ - arg->v = new vector (::linspace (0, 360, 64)); \ + arg->v = new ::vector (::linspace (0, 360, 64)); \ arg->solvee = args->getResult(0)->solvee; \ arg->evaluate (); \ args->append (arg); // ***************** s-parameter noise circles ***************** constant * evaluate::noise_circle_d_v (constant * args) { - vector * Sopt = V (_ARES(0)); - vector * Fmin = V (_ARES(1)); - vector * Rn = V (_ARES(2)); + ::vector * Sopt = V (_ARES(0)); + ::vector * Fmin = V (_ARES(1)); + ::vector * Rn = V (_ARES(2)); nr_double_t F = D (_ARES(3)); - vector * arc = V (_ARES(4)); + ::vector * arc = V (_ARES(4)); _DEFV (); - vector N = circuit::z0 / 4 / *Rn * (F - *Fmin) * norm (1 + *Sopt); - vector R = sqrt (N * N + N * (1 - norm (*Sopt))) / (1 + N); - vector C = *Sopt / (1 + N); - vector * circle = new vector (C.getSize () * arc->getSize ()); + ::vector N = circuit::z0 / 4 / *Rn * (F - *Fmin) * norm (1 + *Sopt); + ::vector R = sqrt (N * N + N * (1 - norm (*Sopt))) / (1 + N); + ::vector C = *Sopt / (1 + N); + ::vector * circle = new ::vector (C.getSize () * arc->getSize ()); int i, a, j; nr_complex_t v; for (i = 0, j = 0; i < C.getSize (); i++) { for (a = 0; a < arc->getSize (); a++, j++) { @@ -2791,16 +2791,16 @@ constant * evaluate::noise_circle_d (constant * args) { } constant * evaluate::noise_circle_v_v (constant * args) { - vector * Sopt = V (_ARES(0)); - vector * Fmin = V (_ARES(1)); - vector * Rn = V (_ARES(2)); - vector * F = V (_ARES(3)); - vector * arc = V (_ARES(4)); + ::vector * Sopt = V (_ARES(0)); + ::vector * Fmin = V (_ARES(1)); + ::vector * Rn = V (_ARES(2)); + ::vector * F = V (_ARES(3)); + :: vector * arc = V (_ARES(4)); _DEFV (); - vector * circle = - new vector (Sopt->getSize () * arc->getSize () * F->getSize ()); - int i, a, j, f; nr_complex_t v; vector N, R, C; + ::vector * circle = + new ::vector (Sopt->getSize () * arc->getSize () * F->getSize ()); + int i, a, j, f; nr_complex_t v; ::vector N, R, C; for (f = 0; f < F->getSize (); f++) { N = circuit::z0 / 4 / *Rn * (F->get (f) - *Fmin) * norm (1 + *Sopt); R = sqrt (N * N + N * (1 - norm (*Sopt))) / (1 + N); @@ -2839,10 +2839,10 @@ constant * evaluate::stab_circle_l_v (constant * args) { _ARMV0 (S); _ARV1 (arc); _DEFV (); - vector D = norm (S->get (1, 1)) - norm (det (*S)); - vector C = (conj (S->get (1, 1)) - S->get (0, 0) * conj (det (*S))) / D; - vector R = abs (S->get (0, 1)) * abs (S->get (1, 0)) / D; - vector * circle = new vector (S->getSize () * arc->getSize ()); + ::vector D = norm (S->get (1, 1)) - norm (det (*S)); + ::vector C = (conj (S->get (1, 1)) - S->get (0, 0) * conj (det (*S))) / D; + ::vector R = abs (S->get (0, 1)) * abs (S->get (1, 0)) / D; + ::vector * circle = new ::vector (S->getSize () * arc->getSize ()); int a, d, i; nr_complex_t v; for (i = 0, d = 0; i < S->getSize (); i++) { for (a = 0; a < arc->getSize (); a++, d++) { @@ -2870,10 +2870,10 @@ constant * evaluate::stab_circle_s_v (constant * args) { _ARMV0 (S); _ARV1 (arc); _DEFV (); - vector D = norm (S->get (0, 0)) - norm (det (*S)); - vector C = (conj (S->get (0, 0)) - S->get (1, 1) * conj (det (*S))) / D; - vector R = abs (S->get (0, 1)) * abs (S->get (1, 0)) / D; - vector * circle = new vector (S->getSize () * arc->getSize ()); + ::vector D = norm (S->get (0, 0)) - norm (det (*S)); + ::vector C = (conj (S->get (0, 0)) - S->get (1, 1) * conj (det (*S))) / D; + ::vector R = abs (S->get (0, 1)) * abs (S->get (1, 0)) / D; + ::vector * circle = new ::vector (S->getSize () * arc->getSize ()); int a, d, i; nr_complex_t v; for (i = 0, d = 0; i < S->getSize (); i++) { for (a = 0; a < arc->getSize (); a++, d++) { @@ -2903,7 +2903,7 @@ constant * evaluate::ga_circle_d_v (constant * args) { _ARD1 (G); _ARV2 (arc); _DEFV (); - vector g, D, c, s, k, C, R, d; + ::vector g, D, c, s, k, C, R, d; D = det (*S); c = S->get (0, 0) - conj (S->get (1, 1)) * D; k = rollet (*S); @@ -2913,7 +2913,7 @@ constant * evaluate::ga_circle_d_v (constant * args) { C = g * conj (c) / d; R = sqrt (1 - 2 * k * g * abs (s) + g * g * norm (s)) / abs (d); - vector * circle = new vector (S->getSize () * arc->getSize ()); + ::vector * circle = new ::vector (S->getSize () * arc->getSize ()); int i, a, j; nr_complex_t v; for (i = 0, j = 0; i < C.getSize (); i++) { for (a = 0; a < arc->getSize (); a++, j++) { @@ -2943,9 +2943,9 @@ constant * evaluate::ga_circle_v_v (constant * args) { _ARV1 (G); _ARV2 (arc); _DEFV (); - vector * circle = - new vector (S->getSize () * arc->getSize () * G->getSize ()); - int i, a, j, f; nr_complex_t v; vector g, D, c, s, k, R, C, d; + ::vector * circle = + new ::vector (S->getSize () * arc->getSize () * G->getSize ()); + int i, a, j, f; nr_complex_t v; ::vector g, D, c, s, k, R, C, d; D = det (*S); c = S->get (0, 0) - conj (S->get (1, 1)) * D; k = rollet (*S); @@ -2988,7 +2988,7 @@ constant * evaluate::gp_circle_d_v (constant * args) { _ARD1 (G); _ARV2 (arc); _DEFV (); - vector g, D, c, s, k, C, R, d; + ::vector g, D, c, s, k, C, R, d; D = det (*S); c = S->get (1, 1) - conj (S->get (0, 0)) * D; k = rollet (*S); @@ -2998,7 +2998,7 @@ constant * evaluate::gp_circle_d_v (constant * args) { C = g * conj (c) / d; R = sqrt (1 - 2 * k * g * abs (s) + g * g * norm (s)) / abs (d); - vector * circle = new vector (S->getSize () * arc->getSize ()); + ::vector * circle = new ::vector (S->getSize () * arc->getSize ()); int i, a, j; nr_complex_t v; for (i = 0, j = 0; i < C.getSize (); i++) { for (a = 0; a < arc->getSize (); a++, j++) { @@ -3028,9 +3028,9 @@ constant * evaluate::gp_circle_v_v (constant * args) { _ARV1 (G); _ARV2 (arc); _DEFV (); - vector * circle = - new vector (S->getSize () * arc->getSize () * G->getSize ()); - int i, a, j, f; nr_complex_t v; vector g, D, c, s, k, R, C, d; + ::vector * circle = + new ::vector (S->getSize () * arc->getSize () * G->getSize ()); + int i, a, j, f; nr_complex_t v; ::vector g, D, c, s, k, R, C, d; D = det (*S); c = S->get (1, 1) - conj (S->get (0, 0)) * D; k = rollet (*S); @@ -3105,7 +3105,7 @@ constant * evaluate::xvalue_d (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETC (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); int idx, i; nr_double_t t, diff = NR_MAX; for (idx = i = 0; i < v->getSize (); i++) { @@ -3127,7 +3127,7 @@ constant * evaluate::xvalue_c (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETC (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); int idx, i; nr_double_t t, diff = NR_MAX; for (idx = i = 0; i < v->getSize (); i++) { @@ -3150,7 +3150,7 @@ constant * evaluate::yvalue_d (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETC (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); int idx, i; nr_double_t t, diff = NR_MAX; for (idx = i = 0; i < indep->getSize (); i++) { @@ -3172,7 +3172,7 @@ constant * evaluate::yvalue_c (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETC (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); int idx, i; nr_double_t t, diff = NR_MAX; for (idx = i = 0; i < indep->getSize (); i++) { @@ -3195,7 +3195,7 @@ constant * evaluate::max_r (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETD (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); nr_complex_t c; nr_double_t d, M = -NR_MAX; for (int i = 0; i < indep->getSize (); i++) { @@ -3217,7 +3217,7 @@ constant * evaluate::min_r (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETD (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); nr_complex_t c; nr_double_t d, M = +NR_MAX; for (int i = 0; i < indep->getSize (); i++) { @@ -3239,7 +3239,7 @@ constant * evaluate::avg_r (constant * args) { THROW_MATH_EXCEPTION ("not an appropriate dependent data vector"); _RETC (0.0); } - vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); + ::vector * indep = SOLVEE(0)->getDataVector (deps->get (0)); nr_complex_t c = 0.0; int i, k; for (k = i = 0; i < indep->getSize (); i++) { @@ -3733,7 +3733,7 @@ constant * evaluate::vt_c (constant * args) { constant * evaluate::vt_v (constant * args) { _ARV0 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) v->add (v1->get (i) * kBoverQ); res->v = v; return res; @@ -3750,7 +3750,7 @@ constant * evaluate::kbd_d_d (constant * args) { THROW_MATH_EXCEPTION ("kbd: vector length must be greater than zero"); __RETV (); } - vector v (size); + ::vector v (size); for (i = 0; i < size / 2; i++) { sval += i0 (M_PI * alpha * sqrt (1.0 - sqr (4.0 * i / size - 1.0))); v (i) = sval; @@ -3861,24 +3861,24 @@ constant * evaluate::ifthenelse_v_v (constant * args) { _ARB0 (cond); int t1 = _ARG(1)->getType (); int t2 = _ARG(2)->getType (); - vector v1, v2; + ::vector v1, v2; switch (t1) { case TAG_DOUBLE: - v1 = vector (1); v1 (0) = D(_ARES(1)); break; + v1 = ::vector (1); v1 (0) = D(_ARES(1)); break; case TAG_COMPLEX: - v1 = vector (1); v1 (0) = *C(_ARES(1)); break; + v1 = ::vector (1); v1 (0) = *C(_ARES(1)); break; case TAG_BOOLEAN: - v1 = vector (1); v1 (0) = B(_ARES(1)) ? 1.0 : 0.0; break; + v1 = ::vector (1); v1 (0) = B(_ARES(1)) ? 1.0 : 0.0; break; case TAG_VECTOR: v1 = *V(_ARES(1)); break; } switch (t2) { case TAG_DOUBLE: - v2 = vector (1); v2 (0) = D(_ARES(2)); break; + v2 = ::vector (1); v2 (0) = D(_ARES(2)); break; case TAG_COMPLEX: - v2 = vector (1); v2 (0) = *C(_ARES(2)); break; + v2 = ::vector (1); v2 (0) = *C(_ARES(2)); break; case TAG_BOOLEAN: - v2 = vector (1); v2 (0) = B(_ARES(2)) ? 1.0 : 0.0; break; + v2 = ::vector (1); v2 (0) = B(_ARES(2)) ? 1.0 : 0.0; break; case TAG_VECTOR: v2 = *V(_ARES(2)); break; } @@ -3890,30 +3890,30 @@ constant * evaluate::ifthenelse_v_v_v (constant * args) { _ARV0 (cond); int t1 = _ARG(1)->getType (); int t2 = _ARG(2)->getType (); - vector v1, v2; + ::vector v1, v2; switch (t1) { case TAG_DOUBLE: - v1 = vector (1); v1 (0) = D(_ARES(1)); break; + v1 = ::vector (1); v1 (0) = D(_ARES(1)); break; case TAG_COMPLEX: - v1 = vector (1); v1 (0) = *C(_ARES(1)); break; + v1 = ::vector (1); v1 (0) = *C(_ARES(1)); break; case TAG_BOOLEAN: - v1 = vector (1); v1 (0) = B(_ARES(1)) ? 1.0 : 0.0; break; + v1 = ::vector (1); v1 (0) = B(_ARES(1)) ? 1.0 : 0.0; break; case TAG_VECTOR: v1 = *V(_ARES(1)); break; } switch (t2) { case TAG_DOUBLE: - v2 = vector (1); v2 (0) = D(_ARES(2)); break; + v2 = ::vector (1); v2 (0) = D(_ARES(2)); break; case TAG_COMPLEX: - v2 = vector (1); v2 (0) = *C(_ARES(2)); break; + v2 = ::vector (1); v2 (0) = *C(_ARES(2)); break; case TAG_BOOLEAN: - v2 = vector (1); v2 (0) = B(_ARES(2)) ? 1.0 : 0.0; break; + v2 = ::vector (1); v2 (0) = B(_ARES(2)) ? 1.0 : 0.0; break; case TAG_VECTOR: v2 = *V(_ARES(2)); break; } _DEFV (); int i, a, b; - vector * v = new vector (); + ::vector * v = new ::vector (); for (a = b = i = 0; i < cond->getSize (); i++) { v->add (cond->get (i) != 0.0 ? v1 (a) : v2 (b)); a++; @@ -3944,7 +3944,7 @@ constant * evaluate::less_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 < v1->get (i) ? 1.0 : 0.0); } @@ -3970,7 +3970,7 @@ constant * evaluate::less_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 < v1->get (i) ? 1.0 : 0.0); } @@ -3982,7 +3982,7 @@ constant * evaluate::less_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) < d1 ? 1.0 : 0.0); } @@ -3994,7 +3994,7 @@ constant * evaluate::less_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) < *c1 ? 1.0 : 0.0); } @@ -4006,7 +4006,7 @@ constant * evaluate::less_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) < v1->get (i) ? 1.0 : 0.0); } @@ -4033,7 +4033,7 @@ constant * evaluate::greater_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 > real (v1->get (i)) ? 1.0 : 0.0); } @@ -4059,7 +4059,7 @@ constant * evaluate::greater_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 > v1->get (i) ? 1.0 : 0.0); } @@ -4071,7 +4071,7 @@ constant * evaluate::greater_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) > d1 ? 1.0 : 0.0); } @@ -4083,7 +4083,7 @@ constant * evaluate::greater_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) > *c1 ? 1.0 : 0.0); } @@ -4095,7 +4095,7 @@ constant * evaluate::greater_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) > v1->get (i) ? 1.0 : 0.0); } @@ -4122,7 +4122,7 @@ constant * evaluate::lessorequal_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 <= real (v1->get (i)) ? 1.0 : 0.0); } @@ -4148,7 +4148,7 @@ constant * evaluate::lessorequal_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 <= v1->get (i) ? 1.0 : 0.0); } @@ -4160,7 +4160,7 @@ constant * evaluate::lessorequal_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) <= d1 ? 1.0 : 0.0); } @@ -4172,7 +4172,7 @@ constant * evaluate::lessorequal_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) <= *c1 ? 1.0 : 0.0); } @@ -4184,7 +4184,7 @@ constant * evaluate::lessorequal_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) <= v1->get (i) ? 1.0 : 0.0); } @@ -4211,7 +4211,7 @@ constant * evaluate::greaterorequal_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 >= real (v1->get (i)) ? 1.0 : 0.0); } @@ -4237,7 +4237,7 @@ constant * evaluate::greaterorequal_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 >= v1->get (i) ? 1.0 : 0.0); } @@ -4249,7 +4249,7 @@ constant * evaluate::greaterorequal_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) >= d1 ? 1.0 : 0.0); } @@ -4261,7 +4261,7 @@ constant * evaluate::greaterorequal_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) >= *c1 ? 1.0 : 0.0); } @@ -4273,7 +4273,7 @@ constant * evaluate::greaterorequal_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) >= v1->get (i) ? 1.0 : 0.0); } @@ -4300,7 +4300,7 @@ constant * evaluate::equal_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 == real (v1->get (i)) ? 1.0 : 0.0); } @@ -4326,7 +4326,7 @@ constant * evaluate::equal_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 == v1->get (i) ? 1.0 : 0.0); } @@ -4338,7 +4338,7 @@ constant * evaluate::equal_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) == d1 ? 1.0 : 0.0); } @@ -4350,7 +4350,7 @@ constant * evaluate::equal_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) == *c1 ? 1.0 : 0.0); } @@ -4362,7 +4362,7 @@ constant * evaluate::equal_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) == v1->get (i) ? 1.0 : 0.0); } @@ -4396,7 +4396,7 @@ constant * evaluate::notequal_d_v (constant * args) { _ARD0 (d0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (d0 != real (v1->get (i)) ? 1.0 : 0.0); } @@ -4422,7 +4422,7 @@ constant * evaluate::notequal_c_v (constant * args) { _ARC0 (c0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v1->getSize (); i++) { v->add (*c0 != v1->get (i) ? 1.0 : 0.0); } @@ -4434,7 +4434,7 @@ constant * evaluate::notequal_v_d (constant * args) { _ARV0 (v0); _ARD1 (d1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (real (v0->get (i)) != d1 ? 1.0 : 0.0); } @@ -4446,7 +4446,7 @@ constant * evaluate::notequal_v_c (constant * args) { _ARV0 (v0); _ARC1 (c1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) != *c1 ? 1.0 : 0.0); } @@ -4458,7 +4458,7 @@ constant * evaluate::notequal_v_v (constant * args) { _ARV0 (v0); _ARV1 (v1); _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (int i = 0; i < v0->getSize (); i++) { v->add (v0->get (i) != v1->get (i) ? 1.0 : 0.0); } @@ -4583,7 +4583,7 @@ constant * evaluate::bugon_v (constant * args) { // ******************* immediate vectors ******************* constant * evaluate::vector_x (constant * args) { _DEFV (); - vector * v = new vector (); + ::vector * v = new ::vector (); for (node * arg = args; arg != NULL; arg = arg->getNext ()) { constant * c = arg->getResult (); switch (arg->getType ()) { @@ -4607,8 +4607,8 @@ constant * evaluate::vector_x (constant * args) { constant * evaluate::matrix_x (constant * args) { _DEFM (); /* create temporary list of vectors */ - vector * va = NULL; - vector * v = new vector (); + ::vector * va = NULL; + ::vector * v = new ::vector (); va = v; for (node * arg = args; arg != NULL; arg = arg->getNext ()) { constant * c = arg->getResult (); @@ -4624,7 +4624,7 @@ constant * evaluate::matrix_x (constant * args) { case TAG_CHAR: if (c->chr == ';') { /* append new vector, i.e. a new matrix row */ - vector * vn = new vector (); + ::vector * vn = new ::vector (); v->setNext (vn); v = vn; } @@ -4636,17 +4636,17 @@ constant * evaluate::matrix_x (constant * args) { } /* determine matrix dimensions and create it */ int r, c; - for (r = 0, c = 0, v = va; v != NULL; v = (vector *) v->getNext (), r++) { + for (r = 0, c = 0, v = va; v != NULL; v = (::vector *) v->getNext (), r++) { if (c < v->getSize ()) c = v->getSize (); } matrix * m = new matrix (r, c); /* fill in matrix entries and delete temporary vector list */ - vector * vn = NULL; + ::vector * vn = NULL; for (r = 0, v = va; v != NULL; v = vn, r++) { for (c = 0; c < v->getSize (); c++) { m->set (r, c, v->get (c)); } - vn = (vector *) v->getNext (); + vn = (::vector *) v->getNext (); delete v; } /* return result matrix */ @@ -4661,7 +4661,7 @@ constant * evaluate::receiver_v_v (constant * args) { _DEFV (); // run receiver functionality - vector * ed; + ::vector * ed; if (_ARG(2)) { _ARI2 (len); ed = emi::receiver (da, dt, len); @@ -4672,8 +4672,8 @@ constant * evaluate::receiver_v_v (constant * args) { // create two vectors for spectrum and frequency int rlen = ed->getSize (); - vector * rvec = new vector (rlen); - vector * rfeq = new vector (rlen); + ::vector * rvec = new ::vector (rlen); + ::vector * rfeq = new ::vector (rlen); for (int i = 0; i < rlen; i++) { (*rvec)(i) = real (ed->get (i)); (*rfeq)(i) = imag (ed->get (i)); diff --git a/qucs-core/src/fourier.h b/qucs-core/src/fourier.h index ff3a083708..ad183eb789 100644 --- a/qucs-core/src/fourier.h +++ b/qucs-core/src/fourier.h @@ -30,13 +30,13 @@ class vector; namespace fourier { // public functions - vector fft_1d (vector, int isign = 1); - vector ifft_1d (vector); - vector dft_1d (vector, int isign = 1); - vector idft_1d (vector); + ::vector fft_1d (::vector, int isign = 1); + ::vector ifft_1d (::vector); + ::vector dft_1d (::vector, int isign = 1); + ::vector idft_1d (::vector); // additional public function - vector fftshift (vector); + ::vector fftshift (::vector); // internal functions void _fft_1d (nr_double_t *, int, int isign = 1); diff --git a/qucs-core/src/hash.cpp b/qucs-core/src/hash.cpp index 49db8660e0..3417e5a283 100644 --- a/qucs-core/src/hash.cpp +++ b/qucs-core/src/hash.cpp @@ -71,7 +71,7 @@ static unsigned hash_key_length (char * key) { // Constructor for the hash table. template -hash::hash (int size) { +qucs::hash::hash (int size) { // set initial hash table size to a binary value int n; for (n = size, buckets = 1; n != 1; n >>= 1) @@ -93,7 +93,7 @@ hash::hash (int size) { // Destructor for the hash table. template -hash::~hash () { +qucs::hash::~hash () { for (int n = 0; n < buckets; n++) { if (table[n]) delete table[n]; } @@ -103,7 +103,7 @@ hash::~hash () { /* Clears the hash table. Afterwards it does not contain any key. The hash table is also shrunken to a minimal size. */ template -void hash::clear (void) { +void qucs::hash::clear (void) { for (int n = 0; n < buckets; n++) { if (table[n]) delete table[n]; } @@ -119,7 +119,7 @@ void hash::clear (void) { // Returns number of items in the hash. template -int hash::count (void) { +int qucs::hash::count (void) { return keys; } @@ -127,7 +127,7 @@ int hash::count (void) { expand the hash codes or half (type is HASH_SHRINK) its size and shrink the hash codes if these would be placed somewhere else. */ template -void hash::rehash (int type) { +void qucs::hash::rehash (int type) { int n, e; hashbucket * bucket, * next; @@ -189,7 +189,7 @@ void hash::rehash (int type) { will be doubled). When the key already exists then the value just gets replaced dropping and returning the old value. */ template -type_t * hash::put (char * key, type_t * value) { +type_t * qucs::hash::put (char * key, type_t * value) { int code = this->code (key); hashbucket * bucket = table[HASH_LOCATION (code)]; @@ -234,7 +234,7 @@ type_t * hash::put (char * key, type_t * value) { hash table. Return NULL if the key has not been found within the hash, otherwise the previous value. */ template -type_t * hash::del (char * key) { +type_t * qucs::hash::del (char * key) { type_t * value; int code = this->code (key); hashbucket * bucket = table[HASH_LOCATION (code)]; @@ -262,7 +262,7 @@ type_t * hash::del (char * key) { /* Hash table lookup. Find a value for a given key in the hash table. Return NULL if the key has not been found within the hash table. */ template -type_t * hash::get (char * key) { +type_t * qucs::hash::get (char * key) { int code = this->code (key); hashbucket * bucket = table[HASH_LOCATION (code)]; if (bucket) { diff --git a/qucs-core/src/input.cpp b/qucs-core/src/input.cpp index 3cdaf9428d..135b70ccdc 100644 --- a/qucs-core/src/input.cpp +++ b/qucs-core/src/input.cpp @@ -109,8 +109,8 @@ int input::netlist (net * netlist) { /* The little helper function creates a vector given by the list of values. */ -vector * input::createVector (struct value_t * values) { - vector * v = new vector (); +::vector * input::createVector (struct value_t * values) { + ::vector * v = new ::vector (); for (; values != NULL; values = values->next) v->add (values->value); return v; } @@ -253,7 +253,7 @@ void input::factory (void) { // zero-length value lists variable * v = new variable (pairs->key); constant * c = new constant (TAG_VECTOR); - c->v = new vector (); + c->v = new ::vector (); v->setConstant (c); o->addProperty (pairs->key, v); } diff --git a/qucs-core/src/input.h b/qucs-core/src/input.h index 5a549bec9d..af56dcfea6 100644 --- a/qucs-core/src/input.h +++ b/qucs-core/src/input.h @@ -46,7 +46,7 @@ class input : public object environment * getEnv (void) { return env; } void setEnv (environment * e) { env = e; } static void assignDefaultProperties (object *, struct define_t *); - static vector * createVector (struct value_t *); + static ::vector * createVector (struct value_t *); private: FILE * fd; diff --git a/qucs-core/src/interface/e_trsolver.cpp b/qucs-core/src/interface/e_trsolver.cpp index 48ed29067b..e1bdbe4285 100644 --- a/qucs-core/src/interface/e_trsolver.cpp +++ b/qucs-core/src/interface/e_trsolver.cpp @@ -45,8 +45,8 @@ #include "transient.h" #include "exception.h" #include "exceptionstack.h" -#include "e_trsolver.h" #include "environment.h" +#include "e_trsolver.h" #define STEPDEBUG 0 // set to zero for release #define BREAKPOINTS 0 // exact breakpoint calculation diff --git a/qucs-core/src/interpolator.h b/qucs-core/src/interpolator.h index 67df8cafc9..0c88c13628 100644 --- a/qucs-core/src/interpolator.h +++ b/qucs-core/src/interpolator.h @@ -48,8 +48,8 @@ class interpolator void vectors (nr_double_t *, nr_double_t *, int); void vectors (nr_complex_t *, nr_double_t *, int); - void rvectors (vector *, vector *); - void cvectors (vector *, vector *); + void rvectors (::vector *, ::vector *); + void cvectors (::vector *, ::vector *); void prepare (int, int, int domain = DATA_RECTANGULAR); nr_double_t rinterpolate (nr_double_t); nr_complex_t cinterpolate (nr_double_t); diff --git a/qucs-core/src/math/complex.cpp b/qucs-core/src/math/complex.cpp index 11e0d6d487..f86cdda1f1 100644 --- a/qucs-core/src/math/complex.cpp +++ b/qucs-core/src/math/complex.cpp @@ -330,7 +330,7 @@ nr_complex_t atan (const nr_complex_t z) { \return arc tangent of z */ nr_complex_t atan2 (const nr_complex_t y, const nr_complex_t x) { - nr_complex_t a = std::tr1::atan (y / x); + nr_complex_t a = std::atan (y / x); return real (x) > 0.0 ? a : -a; } #endif diff --git a/qucs-core/src/math/complex.h b/qucs-core/src/math/complex.h index ab9f7f3696..3b0d4dbcbf 100644 --- a/qucs-core/src/math/complex.h +++ b/qucs-core/src/math/complex.h @@ -56,37 +56,37 @@ inline nr_complex_t rect (const nr_double_t x, const nr_double_t y = 0.0) { #ifndef HAVE_CXX_COMPLEX_ACOS nr_complex_t acos (const nr_complex_t); #else -using std::tr1::acos; +using std::acos; #endif #ifndef HAVE_CXX_COMPLEX_ACOSH nr_complex_t acosh (const nr_complex_t); #else -using std::tr1::acosh; +using std::acosh; #endif #ifndef HAVE_CXX_COMPLEX_ASIN nr_complex_t asin (const nr_complex_t); #else -using std::tr1::asin; +using std::asin; #endif #ifndef HAVE_CXX_COMPLEX_ASINH nr_complex_t asinh (const nr_complex_t); #else -using std::tr1::asinh; +using std::asinh; #endif #ifndef HAVE_CXX_COMPLEX_ATAN nr_complex_t atan (const nr_complex_t); #else -using std::tr1::atan; +using std::atan; #endif #ifndef HAVE_CXX_COMPLEX_ATANH nr_complex_t atanh (const nr_complex_t); #else -using std::tr1::atanh; +using std::atanh; #endif #ifndef HAVE_CXX_COMPLEX_ATAN2 diff --git a/qucs-core/src/math/matrix.cpp b/qucs-core/src/math/matrix.cpp index 536b35515e..b151c8031e 100644 --- a/qucs-core/src/math/matrix.cpp +++ b/qucs-core/src/math/matrix.cpp @@ -612,7 +612,7 @@ matrix eye (int s) { \param[in] diag vector to write on the diagonal \todo diag is const */ -matrix diagonal (vector diag) { +matrix diagonal (::vector diag) { int size = diag.getSize (); matrix res (size); for (int i = 0; i < size; i++) res (i, i) = diag (i); @@ -878,7 +878,7 @@ matrix inverse (matrix a) { \return Renormalized scattering matrix \todo s, zref and z0 const */ -matrix stos (matrix s, vector zref, vector z0) { +matrix stos (matrix s, ::vector zref, ::vector z0) { int d = s.getRows (); matrix e, r, a; @@ -900,7 +900,7 @@ matrix stos (matrix s, vector zref, vector z0) { */ matrix stos (matrix s, nr_complex_t zref, nr_complex_t z0) { int d = s.getRows (); - return stos (s, vector (d, zref), vector (d, z0)); + return stos (s, ::vector (d, zref), ::vector (d, z0)); } /*!\brief S renormalization with all part identic and real @@ -923,8 +923,8 @@ matrix stos (matrix s, nr_double_t zref, nr_double_t z0) { \return Renormalized scattering matrix \todo s, zref and z0 const */ -matrix stos (matrix s, vector zref, nr_complex_t z0) { - return stos (s, zref, vector (zref.getSize (), z0)); +matrix stos (matrix s, ::vector zref, nr_complex_t z0) { + return stos (s, zref, ::vector (zref.getSize (), z0)); } /*!\brief S renormalization (variation) @@ -935,8 +935,8 @@ matrix stos (matrix s, vector zref, nr_complex_t z0) { \todo s, zref and z0 const \return Renormalized scattering matrix */ -matrix stos (matrix s, nr_complex_t zref, vector z0) { - return stos (s, vector (z0.getSize (), zref), z0); +matrix stos (matrix s, nr_complex_t zref, ::vector z0) { + return stos (s, ::vector (z0.getSize (), zref), z0); } /*!\brief Scattering parameters to impedance matrix @@ -961,7 +961,7 @@ matrix stos (matrix s, nr_complex_t zref, vector z0) { \todo s, z0 const \return Impedance matrix */ -matrix stoz (matrix s, vector z0) { +matrix stoz (matrix s, ::vector z0) { int d = s.getRows (); matrix e, zref, gref; @@ -981,7 +981,7 @@ matrix stoz (matrix s, vector z0) { \todo s and z0 const? */ matrix stoz (matrix s, nr_complex_t z0) { - return stoz (s, vector (s.getRows (), z0)); + return stoz (s, ::vector (s.getRows (), z0)); } /*!\brief Convert impedance matrix scattering parameters. @@ -1006,7 +1006,7 @@ matrix stoz (matrix s, nr_complex_t z0) { \bug not correct if zref is complex \todo z and z0 const? */ -matrix ztos (matrix z, vector z0) { +matrix ztos (matrix z, ::vector z0) { int d = z.getRows (); matrix e, zref, gref; @@ -1026,7 +1026,7 @@ matrix ztos (matrix z, vector z0) { \todo z and z0 const */ matrix ztos (matrix z, nr_complex_t z0) { - return ztos (z, vector (z.getRows (), z0)); + return ztos (z, ::vector (z.getRows (), z0)); } /*!\brief impedance matrix to admittance matrix. @@ -1070,7 +1070,7 @@ matrix ztoy (matrix z) { \todo s and z0 const \return Admittance matrix */ -matrix stoy (matrix s, vector z0) { +matrix stoy (matrix s, ::vector z0) { int d = s.getRows (); matrix e, zref, gref; @@ -1090,7 +1090,7 @@ matrix stoy (matrix s, vector z0) { \todo s and z0 const */ matrix stoy (matrix s, nr_complex_t z0) { - return stoy (s, vector (s.getRows (), z0)); + return stoy (s, ::vector (s.getRows (), z0)); } /*!\brief Admittance matrix to scattering parameters @@ -1121,7 +1121,7 @@ matrix stoy (matrix s, nr_complex_t z0) { \todo why not y and z0 const \return Scattering matrix */ -matrix ytos (matrix y, vector z0) { +matrix ytos (matrix y, ::vector z0) { int d = y.getRows (); matrix e, zref, gref; @@ -1140,7 +1140,7 @@ matrix ytos (matrix y, vector z0) { \todo y and z0 const */ matrix ytos (matrix y, nr_complex_t z0) { - return ytos (y, vector (y.getRows (), z0)); + return ytos (y, ::vector (y.getRows (), z0)); } /*!\brief Converts chain matrix to scattering parameters. diff --git a/qucs-core/src/math/matrix.h b/qucs-core/src/math/matrix.h index 8a9ee4604b..1bf2561e24 100644 --- a/qucs-core/src/math/matrix.h +++ b/qucs-core/src/math/matrix.h @@ -83,7 +83,7 @@ class matrix friend matrix real (matrix); friend matrix imag (matrix); friend matrix eye (int, int); - friend matrix diagonal (vector); + friend matrix diagonal (::vector); friend matrix pow (matrix, int); friend nr_complex_t cofactor (matrix, int, int); friend nr_complex_t detLaplace (matrix); @@ -94,18 +94,18 @@ class matrix friend matrix inverse (matrix); friend matrix stos (matrix, nr_complex_t, nr_complex_t z0 = 50.0); friend matrix stos (matrix, nr_double_t, nr_double_t z0 = 50.0); - friend matrix stos (matrix, vector, nr_complex_t z0 = 50.0); - friend matrix stos (matrix, nr_complex_t, vector); - friend matrix stos (matrix, vector, vector); + friend matrix stos (matrix, ::vector, nr_complex_t z0 = 50.0); + friend matrix stos (matrix, nr_complex_t, ::vector); + friend matrix stos (matrix, ::vector, ::vector); friend matrix stoz (matrix, nr_complex_t z0 = 50.0); - friend matrix stoz (matrix, vector); + friend matrix stoz (matrix, ::vector); friend matrix ztos (matrix, nr_complex_t z0 = 50.0); - friend matrix ztos (matrix, vector); + friend matrix ztos (matrix, ::vector); friend matrix ztoy (matrix); friend matrix stoy (matrix, nr_complex_t z0 = 50.0); - friend matrix stoy (matrix, vector); + friend matrix stoy (matrix, ::vector); friend matrix ytos (matrix, nr_complex_t z0 = 50.0); - friend matrix ytos (matrix, vector); + friend matrix ytos (matrix, ::vector); friend matrix ytoz (matrix); friend matrix stoa (matrix, nr_complex_t z1 = 50.0, nr_complex_t z2 = 50.0); friend matrix atos (matrix, nr_complex_t z1 = 50.0, nr_complex_t z2 = 50.0); diff --git a/qucs-core/src/matvec.cpp b/qucs-core/src/matvec.cpp index 18edbc3c36..5f14bcece5 100644 --- a/qucs-core/src/matvec.cpp +++ b/qucs-core/src/matvec.cpp @@ -102,7 +102,7 @@ char * matvec::getName (void) { /* This function saves the given vector to the matvec object with the appropriate matrix indices. */ -void matvec::set (vector v, int r, int c) { +void matvec::set (::vector v, int r, int c) { assert (v.getSize () == size && r >= 0 && r < rows && c >= 0 && c < cols); for (int i = 0; i < size; i++) data[i].set (r, c, v.get (i)); @@ -111,9 +111,9 @@ void matvec::set (vector v, int r, int c) { /* The function returns the vector specified by the given matrix indices. If the matrix vector has a valid name 'A' the returned vector gets the name 'A[r,c]'. */ -vector matvec::get (int r, int c) { +::vector matvec::get (int r, int c) { assert (r >= 0 && r < rows && c >= 0 && c < cols); - vector res; + ::vector res; for (int i = 0; i < size; i++) res.add (data[i].get (r, c)); if (name != NULL) { res.setName (createMatrixString (name, r, c)); @@ -169,14 +169,14 @@ char * matvec::isMatrixVector (char * n, int& r, int& c) { /* This function looks through the vector list given in `data' to find matrix entries specified by `name' and returns the matrix vector dimensions. */ -void matvec::getMatrixVectorSize (vector * data, char * name, +void matvec::getMatrixVectorSize (::vector * data, char * name, int& rs, int& cs, int& ss) { - vector * v; + ::vector * v; char * vn, * n; int r, c, s; rs = cs = ss = -1; // go through vector list - for (v = data; v != NULL; v = (vector *) v->getNext ()) { + for (v = data; v != NULL; v = (::vector *) v->getNext ()) { vn = v->getName (); // requested matrix name found? if (strstr (vn, name) == vn) { @@ -195,13 +195,13 @@ void matvec::getMatrixVectorSize (vector * data, char * name, matrix entries specified by `name' and returns a matrix vector object. If there are no such matrices the function returns NULL. */ -matvec * matvec::getMatrixVector (vector * data, char * name) { +matvec * matvec::getMatrixVector (::vector * data, char * name) { // obtain matrix vector dimensions int rs, cs, ss; getMatrixVectorSize (data, name, rs, cs, ss); - vector * v; + ::vector * v; char * vn, * n; int r, c; // valid matrix entries found @@ -210,7 +210,7 @@ matvec * matvec::getMatrixVector (vector * data, char * name) { matvec * mv = new matvec (ss, rs + 1, cs + 1); mv->setName (name); // go through vector list again and fill in matrix vectors - for (v = data; v; v = (vector *) v->getNext ()) { + for (v = data; v; v = (::vector *) v->getNext ()) { vn = v->getName (); if (strstr (vn, name) == vn) { if ((n = matvec::isMatrixVector (vn, r, c)) != NULL) { @@ -258,7 +258,7 @@ matvec operator + (matvec a, matrix b) { } // Matrix vector addition with vector. -matvec operator + (matvec a, vector b) { +matvec operator + (matvec a, ::vector b) { assert (a.getSize () == b.getSize ()); matvec res (a.getSize (), a.getRows (), a.getCols ()); for (int i = 0; i < a.getSize (); i++) res.set (a.get (i) + b.get (i), i); @@ -266,7 +266,7 @@ matvec operator + (matvec a, vector b) { } // Matrix vector addition with vector in different order. -matvec operator + (vector b, matvec a) { +matvec operator + (::vector b, matvec a) { return a + b; } @@ -335,7 +335,7 @@ matvec operator - (nr_double_t d, matvec a) { matvec matvec::operator += (matvec a) { assert (a.getRows () == rows && a.getCols () == cols && a.getSize () == size); - for (int i = 0; i < size; i++) data[i] += a.get (i); + for (int i = 0; i < size; i++) data[i] = data[i] + a.get (i); return *this; } @@ -362,12 +362,12 @@ matvec operator - (matrix a, matvec b) { } // Matrix vector subtraction with vector. -matvec operator - (matvec a, vector b) { +matvec operator - (matvec a, ::vector b) { return -b + a; } // Matrix vector subtraction with vector in different order. -matvec operator - (vector b, matvec a) { +matvec operator - (::vector b, matvec a) { return -a + b; } @@ -382,7 +382,7 @@ matvec matvec::operator - () { matvec matvec::operator -= (matvec a) { assert (a.getRows () == rows && a.getCols () == cols && a.getSize () == size); - for (int i = 0; i < a.getSize (); i++) data[i] -= a.get (i); + for (int i = 0; i < a.getSize (); i++) data[i] = data[i] - a.get (i); return *this; } @@ -411,7 +411,7 @@ matvec operator * (nr_double_t d, matvec a) { } // Matrix vector scaling by a second vector. -matvec operator * (matvec a, vector b) { +matvec operator * (matvec a, ::vector b) { assert (a.getSize () == b.getSize ()); matvec res (a.getSize (), a.getRows (), a.getCols ()); for (int i = 0; i < a.getSize (); i++) res.set (a.get (i) * b.get (i), i); @@ -419,7 +419,7 @@ matvec operator * (matvec a, vector b) { } // Matrix vector scaling by a second vector in different order. -matvec operator * (vector a, matvec b) { +matvec operator * (::vector a, matvec b) { return b * a; } @@ -438,7 +438,7 @@ matvec operator / (matvec a, nr_double_t d) { } // Matrix vector scaling by a second vector. -matvec operator / (matvec a, vector b) { +matvec operator / (matvec a, ::vector b) { assert (a.getSize () == b.getSize ()); matvec res (a.getSize (), a.getRows (), a.getCols ()); for (int i = 0; i < a.getSize (); i++) res.set (a.get (i) / b.get (i), i); @@ -467,8 +467,8 @@ matvec operator * (matrix a, matvec b) { } // Compute determinants of the given matrix vector. -vector det (matvec a) { - vector res (a.getSize ()); +::vector det (matvec a) { + ::vector res (a.getSize ()); for (int i = 0; i < a.getSize (); i++) res.set (det (a.get (i)), i); return res; } @@ -488,7 +488,7 @@ matvec pow (matvec a, int n) { } // Compute n-th powers in the vector of the given matrix vector. -matvec pow (matvec a, vector v) { +matvec pow (matvec a, ::vector v) { assert (a.getSize () == v.getSize ()); matvec res (a.getSize (), a.getRows (), a.getCols ()); for (int i = 0; i < a.getSize (); i++) @@ -555,7 +555,7 @@ matvec transpose (matvec a) { /* Convert scattering parameters with the reference impedance 'zref' to scattering parameters with the reference impedance 'z0'. */ -matvec stos (matvec s, vector zref, vector z0) { +matvec stos (matvec s, ::vector zref, ::vector z0) { assert (s.getCols () == s.getRows () && s.getCols () == zref.getSize () && s.getCols () == z0.getSize ()); matvec res (s.getSize (), s.getCols (), s.getRows ()); @@ -566,23 +566,23 @@ matvec stos (matvec s, vector zref, vector z0) { matvec stos (matvec s, nr_complex_t zref, nr_complex_t z0) { int d = s.getRows (); - return stos (s, vector (d, zref), vector (d, z0)); + return stos (s, ::vector (d, zref), ::vector (d, z0)); } matvec stos (matvec s, nr_double_t zref, nr_double_t z0) { return stos (s, rect (zref, 0), rect (z0, 0)); } -matvec stos (matvec s, vector zref, nr_complex_t z0) { - return stos (s, zref, vector (zref.getSize (), z0)); +matvec stos (matvec s, ::vector zref, nr_complex_t z0) { + return stos (s, zref, ::vector (zref.getSize (), z0)); } -matvec stos (matvec s, nr_complex_t zref, vector z0) { - return stos (s, vector (z0.getSize (), zref), z0); +matvec stos (matvec s, nr_complex_t zref, ::vector z0) { + return stos (s, ::vector (z0.getSize (), zref), z0); } // Convert scattering parameters to admittance matrix vector. -matvec stoy (matvec s, vector z0) { +matvec stoy (matvec s, ::vector z0) { assert (s.getCols () == s.getRows () && s.getCols () == z0.getSize ()); matvec res (s.getSize (), s.getCols (), s.getRows ()); for (int i = 0; i < s.getSize (); i++) res.set (stoy (s.get (i), z0), i); @@ -590,11 +590,11 @@ matvec stoy (matvec s, vector z0) { } matvec stoy (matvec s, nr_complex_t z0) { - return stoy (s, vector (s.getCols (), z0)); + return stoy (s, ::vector (s.getCols (), z0)); } // Convert admittance matrix to scattering parameter matrix vector. -matvec ytos (matvec y, vector z0) { +matvec ytos (matvec y, ::vector z0) { assert (y.getCols () == y.getRows () && y.getCols () == z0.getSize ()); matvec res (y.getSize (), y.getCols (), y.getRows ()); for (int i = 0; i < y.getSize (); i++) res.set (ytos (y.get (i), z0), i); @@ -602,11 +602,11 @@ matvec ytos (matvec y, vector z0) { } matvec ytos (matvec y, nr_complex_t z0) { - return ytos (y, vector (y.getCols (), z0)); + return ytos (y, ::vector (y.getCols (), z0)); } // Convert scattering parameters to impedance matrix vector. -matvec stoz (matvec s, vector z0) { +matvec stoz (matvec s, ::vector z0) { assert (s.getCols () == s.getRows () && s.getCols () == z0.getSize ()); matvec res (s.getSize (), s.getCols (), s.getRows ()); for (int i = 0; i < s.getSize (); i++) res.set (stoz (s.get (i), z0), i); @@ -614,11 +614,11 @@ matvec stoz (matvec s, vector z0) { } matvec stoz (matvec s, nr_complex_t z0) { - return stoz (s, vector (s.getCols (), z0)); + return stoz (s, ::vector (s.getCols (), z0)); } // Convert impedance matrix vector scattering parameter matrix vector. -matvec ztos (matvec z, vector z0) { +matvec ztos (matvec z, ::vector z0) { assert (z.getCols () == z.getRows () && z.getCols () == z0.getSize ()); matvec res (z.getSize (), z.getCols (), z.getRows ()); for (int i = 0; i < z.getSize (); i++) res.set (ztos (z.get (i), z0), i); @@ -626,7 +626,7 @@ matvec ztos (matvec z, vector z0) { } matvec ztos (matvec z, nr_complex_t z0) { - return ztos (z, vector (z.getCols (), z0)); + return ztos (z, ::vector (z.getCols (), z0)); } // Convert impedance matrix vector to admittance matrix vector. @@ -658,18 +658,18 @@ matvec twoport (matvec m, char in, char out) { /* The function returns the Rollet stability factor vector of the given S-parameter matrix vector. */ -vector rollet (matvec m) { +::vector rollet (matvec m) { assert (m.getCols () >= 2 && m.getRows () >= 2); - vector res (m.getSize ()); + ::vector res (m.getSize ()); for (int i = 0; i < m.getSize (); i++) res.set (rollet (m.get (i)), i); return res; } /* The function returns the stability measure B1 vector of the given S-parameter matrix vector. */ -vector b1 (matvec m) { +::vector b1 (matvec m) { assert (m.getCols () >= 2 && m.getRows () >= 2); - vector res (m.getSize ()); + ::vector res (m.getSize ()); for (int i = 0; i < m.getSize (); i++) res.set (b1 (m.get (i)), i); return res; } diff --git a/qucs-core/src/matvec.h b/qucs-core/src/matvec.h index a8ef8641f5..fa8b35ec9c 100644 --- a/qucs-core/src/matvec.h +++ b/qucs-core/src/matvec.h @@ -39,15 +39,15 @@ class matvec int getRows (void) { return rows; } void setName (const char *); char * getName (void); - void set (vector, int, int); + void set (::vector, int, int); void set (matrix, int); - vector get (int, int); + ::vector get (int, int); matrix get (int); static char * createMatrixString (const char *, int, int); static char * createMatrixString (char, int, int); static char * isMatrixVector (char *, int&, int&); - static matvec * getMatrixVector (vector *, char *); - static void getMatrixVectorSize (vector *, char *, int&, int&, int&); + static matvec * getMatrixVector (::vector *, char *); + static void getMatrixVectorSize (::vector *, char *, int&, int&, int&); // operator functions friend matvec operator + (matvec, matvec); @@ -57,8 +57,8 @@ class matvec friend matvec operator + (nr_complex_t, matvec); friend matvec operator + (matvec, nr_double_t); friend matvec operator + (nr_double_t, matvec); - friend matvec operator + (matvec, vector); - friend matvec operator + (vector, matvec); + friend matvec operator + (matvec, ::vector); + friend matvec operator + (::vector, matvec); friend matvec operator - (matvec, matvec); friend matvec operator - (matvec, matrix); friend matvec operator - (matrix, matvec); @@ -66,13 +66,13 @@ class matvec friend matvec operator - (nr_complex_t, matvec); friend matvec operator - (matvec, nr_double_t); friend matvec operator - (nr_double_t, matvec); - friend matvec operator - (matvec, vector); - friend matvec operator - (vector, matvec); + friend matvec operator - (matvec, ::vector); + friend matvec operator - (::vector, matvec); friend matvec operator / (matvec, nr_complex_t); friend matvec operator / (matvec, nr_double_t); - friend matvec operator / (matvec, vector); - friend matvec operator * (matvec, vector); - friend matvec operator * (vector, matvec); + friend matvec operator / (matvec, ::vector); + friend matvec operator * (matvec, ::vector); + friend matvec operator * (::vector, matvec); friend matvec operator * (matvec, nr_complex_t); friend matvec operator * (nr_complex_t, matvec); friend matvec operator * (matvec, nr_double_t); @@ -89,10 +89,10 @@ class matvec // other operations friend matvec transpose (matvec); friend matvec conj (matvec); - friend vector det (matvec); + friend ::vector det (matvec); friend matvec inverse (matvec); friend matvec pow (matvec, int); - friend matvec pow (matvec, vector); + friend matvec pow (matvec, ::vector); friend matvec twoport (matvec, char, char); friend matvec real (matvec); friend matvec imag (matvec); @@ -100,23 +100,23 @@ class matvec friend matvec dB (matvec); friend matvec arg (matvec); friend matvec adjoint (matvec); - friend vector rollet (matvec); - friend vector b1 (matvec); + friend ::vector rollet (matvec); + friend ::vector b1 (matvec); friend matvec stos (matvec, nr_complex_t, nr_complex_t z0 = 50.0); friend matvec stos (matvec, nr_double_t, nr_double_t z0 = 50.0); - friend matvec stos (matvec, vector, nr_complex_t z0 = 50.0); - friend matvec stos (matvec, nr_complex_t, vector); - friend matvec stos (matvec, vector, vector); + friend matvec stos (matvec, ::vector, nr_complex_t z0 = 50.0); + friend matvec stos (matvec, nr_complex_t, ::vector); + friend matvec stos (matvec, ::vector, ::vector); friend matvec stoz (matvec, nr_complex_t z0 = 50.0); - friend matvec stoz (matvec, vector); + friend matvec stoz (matvec, ::vector); friend matvec ztos (matvec, nr_complex_t z0 = 50.0); - friend matvec ztos (matvec, vector); + friend matvec ztos (matvec, ::vector); friend matvec ztoy (matvec); friend matvec stoy (matvec, nr_complex_t z0 = 50.0); - friend matvec stoy (matvec, vector); + friend matvec stoy (matvec, ::vector); friend matvec ytos (matvec, nr_complex_t z0 = 50.0); - friend matvec ytos (matvec, vector); + friend matvec ytos (matvec, ::vector); friend matvec ytoz (matvec); private: diff --git a/qucs-core/src/nasolver.cpp b/qucs-core/src/nasolver.cpp index f7d5ac03db..d0c79b4cc9 100644 --- a/qucs-core/src/nasolver.cpp +++ b/qucs-core/src/nasolver.cpp @@ -48,13 +48,15 @@ #include "tvector.h" #include "tmatrix.h" #include "eqnsys.h" -#include "constants.h" #include "precision.h" #include "operatingpoint.h" #include "exception.h" #include "exceptionstack.h" #include "nasolver.h" +// T0 is a shit load after all +#include "constants.h" + using namespace qucs; // Constructor creates an unnamed instance of the nasolver class. @@ -1305,7 +1307,7 @@ void nasolver::recallSolution (void) into the output dataset. */ template void nasolver::saveResults (const char * volts, const char * amps, - int saveOPs, vector * f) + int saveOPs, ::vector * f) { int N = countNodes (); int M = countVoltageSources (); diff --git a/qucs-core/src/nasolver.h b/qucs-core/src/nasolver.h index 1b93e67863..dbbf322c2c 100644 --- a/qucs-core/src/nasolver.h +++ b/qucs-core/src/nasolver.h @@ -61,7 +61,7 @@ class nasolver : public analysis void solve_post (void); void setDescription (const char * n) { desc = n; } const char * getDescription (void) { return desc; } - void saveResults (const char *, const char *, int, vector * f = NULL); + void saveResults (const char *, const char *, int, ::vector * f = NULL); typedef void (* calculate_func_t) (nasolver *); void setCalculation (calculate_func_t f) { calculate_func = f; } void calculate (void) diff --git a/qucs-core/src/object.cpp b/qucs-core/src/object.cpp index 0c01035371..098fdf3fe0 100644 --- a/qucs-core/src/object.cpp +++ b/qucs-core/src/object.cpp @@ -146,7 +146,7 @@ property * object::addProperty (const char * n, variable * val) { /* Returns the requested property value which has been previously added as its vector representation. If there is no such property the function returns NULL. */ -vector * object::getPropertyVector (const char * n) { +::vector * object::getPropertyVector (const char * n) { property * p = prop->findProperty (n); if (p != NULL) return p->getVector (); return NULL; diff --git a/qucs-core/src/parasweep.cpp b/qucs-core/src/parasweep.cpp index f6c043efba..12041b0e27 100644 --- a/qucs-core/src/parasweep.cpp +++ b/qucs-core/src/parasweep.cpp @@ -181,11 +181,11 @@ int parasweep::solve (void) { /* This function saves the results of a single solve() functionality into the output dataset. */ void parasweep::saveResults (void) { - vector * v; + ::vector * v; // add current frequency to the dependencies of the output dataset if ((v = data->findDependency (var->getName ())) == NULL) { - v = new vector (var->getName ()); + v = new ::vector (var->getName ()); v->setOrigin (getName ()); data->addDependency (v); } diff --git a/qucs-core/src/property.cpp b/qucs-core/src/property.cpp index 5ad01157e7..89e04ac63e 100644 --- a/qucs-core/src/property.cpp +++ b/qucs-core/src/property.cpp @@ -155,7 +155,7 @@ property * property::findProperty (const char * n) { #define V(con) ((constant *) (con))->v // Returns the property's value as vector. -vector * property::getVector (void) { +::vector * property::getVector (void) { if (var != NULL) { if (var->getType () == VAR_CONSTANT) return V (var->getConstant ()); diff --git a/qucs-core/src/property.h b/qucs-core/src/property.h index 2acbd07a8c..5b138159d4 100644 --- a/qucs-core/src/property.h +++ b/qucs-core/src/property.h @@ -50,7 +50,7 @@ class property void setNext (property * p) { next = p; } void setName (char *); char * getName (void); - vector * getVector (void); + ::vector * getVector (void); nr_double_t getDouble (void); int getInteger (void); char * getString (void); diff --git a/qucs-core/src/receiver.h b/qucs-core/src/receiver.h index cbe6b2a1d0..e31407a3a6 100644 --- a/qucs-core/src/receiver.h +++ b/qucs-core/src/receiver.h @@ -41,10 +41,10 @@ namespace emi { nr_double_t f_2ndorder (nr_double_t, nr_double_t, nr_double_t); nr_double_t f_gauss (nr_double_t, nr_double_t, nr_double_t); nr_double_t f_ideal (nr_double_t, nr_double_t, nr_double_t); - vector * receiver (nr_double_t *, nr_double_t, int); + ::vector * receiver (nr_double_t *, nr_double_t, int); // external functionality - vector * receiver (vector *, vector *, int len = -1); + ::vector * receiver (::vector *, ::vector *, int len = -1); } // namespace diff --git a/qucs-core/src/spline.h b/qucs-core/src/spline.h index c62ee3c9e5..0cb3a854df 100644 --- a/qucs-core/src/spline.h +++ b/qucs-core/src/spline.h @@ -43,11 +43,11 @@ class spline public: spline (); spline (int); - spline (vector, vector); + spline (::vector, ::vector); spline (tvector, tvector); ~spline (); - void vectors (vector, vector); + void vectors (::vector, ::vector); void vectors (tvector, tvector); void vectors (nr_double_t *, nr_double_t *, int); void construct (void); diff --git a/qucs-core/src/trsolver.cpp b/qucs-core/src/trsolver.cpp index f92a3a3fc3..c5c6426fb8 100644 --- a/qucs-core/src/trsolver.cpp +++ b/qucs-core/src/trsolver.cpp @@ -856,11 +856,11 @@ void trsolver::initCircuitTR (circuit * c) (for the given timestamp) into the output dataset. */ void trsolver::saveAllResults (nr_double_t time) { - vector * t; + ::vector * t; // add current frequency to the dependency of the output dataset if ((t = data->findDependency ("time")) == NULL) { - t = new vector ("time"); + t = new ::vector ("time"); data->addDependency (t); } if (runs == 1) t->add (time); diff --git a/qucs-core/src/vector.cpp b/qucs-core/src/vector.cpp index 63d8053ec2..902b6b054f 100644 --- a/qucs-core/src/vector.cpp +++ b/qucs-core/src/vector.cpp @@ -186,7 +186,7 @@ void vector::set (const nr_complex_t z, int i) { } // The function returns the current size of the vector. -int vector::getSize (void) { +int vector::getSize (void) const { return size; } diff --git a/qucs-core/src/vector.h b/qucs-core/src/vector.h index 2864595a39..f04a87cd4e 100644 --- a/qucs-core/src/vector.h +++ b/qucs-core/src/vector.h @@ -36,10 +36,10 @@ class strlist; class vector; -vector linspace (nr_double_t, nr_double_t, int); -vector logspace (nr_double_t, nr_double_t, int); -vector runavg (vector, const int); -vector runavg (const nr_complex_t, const int); +::vector linspace (nr_double_t, nr_double_t, int); +::vector logspace (nr_double_t, nr_double_t, int); +::vector runavg (::vector, const int); +::vector runavg (const nr_complex_t, const int); class vector : public object { @@ -57,7 +57,7 @@ class vector : public object nr_complex_t get (int); void set (nr_double_t, int); void set (const nr_complex_t, int); - int getSize (void); + int getSize (void) const; int checkSizes (vector, vector); int getRequested (void) { return requested; } void setRequested (int n) { requested = n; }