Microwave filters GUI 2.0.3

- Main Page
- Related Pages
- Packages
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
libcommonfunc.MatrixQ Class Reference

Class that contains a coupling matrix, its name, the number of non-resonant nodes, the Q of resonators and some operations. More...

## Public Member Functions
def | __init__
| Initialize MatrixQ class.
def | copy
| Function to copy instances of the MatrixQ class (copies the self instance).
def | setName
| Function to set name field of the instance of the MatrixQ class.
def | setFileExt
| Function to set file extension field of the instance of the MatrixQ class.
def | Qresonators
| Compute the quality factors of each resonant node of coupling matrix self.M.
def | lp2bp2cbw
| Compute bandpass and coupling bandwidth versions of the matrix.
def | rotateMatrix
| Rotate the coupling matrix self.M.
def | inflateMatrix
| Add external non-resonant nodes to the coupling matrix self.M at the source or load sides, or both.
def | scaleNode
| Scale a node of the coupling matrix self.M, by multiplying row [i] and column [i] by a factor.
def | rotAngleEliminate
| Compute the rotation angle such that, after applying a rotation of type rotationType, the element of the matrix self.M is equal to zero.
def | addLossesQeff
| Add losses to resonators by substracting a factor 1/(Qeff*FBW) to the diagonal of the coupling matrix.
def | setupOptimTopology
| Prepare optimization parameters depending on matrix topology and forced signs.
def | newMatQFromNonZero
| Return a new MatrixQ object that is a copy of self, except for the M matrix which is created from the NonZeroValues, NonZeroReal, NonZeroImag and Q parameters.
def | uniformQ
| Optimize the coupling matrix to achieve a prescribed uniform Q and [S] parameters as close as possible to those computed from the characteristic polynomials.
def | uniformQOptimize
| Optimization objective function for uniformQ function.
def | uniformQMask
| Optimize the coupling matrix to achieve a prescribed uniform Q and [S] parameters that comply with a specification mask.
def | uniformQOptimizeMask
| Optimization objective function for uniformQMask function.
def | saveMat
| Save this MatrixQ instance to an ascii file, including energy and power.
def | __str__
| Convert numpy matrix to string representation.

## Detailed Description

Class that contains a coupling matrix, its name, the number of non-resonant nodes, the Q of resonators and some operations.

Definition at line 1566 of file libcommonfunc.py.

## Constructor & Destructor Documentation

def libcommonfunc.MatrixQ.__init__ | ( |  | self,
|  |  | parent,
|  |  | M,
|  |  | name,
|  |  | extraNodesS,
|  |  | extraNodesL,
|  |  | FT,
|  |  | fileExt = `None`,
|  |  | nodeScalingFactor = `None`,
|  |  | flagRotateAllowed = `True`
| ) |  |

Initialize MatrixQ class.

Computes Q of resonators and stores the vector of Q values in self.Q .

Parameters

  parent | = CouplingMatrices class instance to which this coupling matrix belongs.
  M | = Coupling matrix.
  name | = Matrix name.
  extraNodesS | = Number of extra rows and columns in current matrix M at the source side (non-resonant nodes).
  extraNodesL | = Number of extra rows and columns in current matrix M at the load side (non-resonant nodes).
  FT | = Frequency transformation class instance.
  fileExt | = Extension of file name, if this matrix is to be automatically saved in a file (with the output file name in the parameters class). If equal to None, this matrix is not automatically saved. Anyway the matrix can be manually saved. Default None.
  nodeScalingFactor | = Vector containing in each node position the factor of the node scaling applied to that node. Default None.
  flagRotateAllowed | = Flag that indicates if it is allowed to do a matrix rotation (Impossible after a resonant node scaling). Default True. Coupling matrix Matrix order Number of extra rows and columns in current matrix M at the source side (non-resonant nodes). Number of extra rows and columns in current matrix M at the load side (non-resonant nodes). Matrix name. It is converted to unicode to allow safe comparison with matrix names entered by the user in Matrix Edit Gui. Frequency transform to use when computing Q of resonators. Extension of file name, if this matrix is to be saved in a file. Otherwise None. CouplingMatrices class instance to which this coupling matrix belongs. Band pass version of the matrix Coupling bandwidth version of the matrix Coupling bandwidth with transmission lines version of the matrix Labels for rows and columns. Will be used for saving energy and power. Characteristic impedance of resonators Characteristic impedance of source Characteristic impedance of load

Definition at line 1582 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.fileExt, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.Sparameters.FT, libcommonfunc.MatrixQ.FT, libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.Mbp, libcommonfunc.MatrixQ.Mcbw, libcommonfunc.MatrixQ.McbwTL, libcommonfunc.MatrixQ.name, dbplot.CurveFamily.name, libcommonfunc.MatrixQ.nodeScalingFactor, libcommonfunc.MatrixQ.order, libcommonfunc.MatrixQ.parent, libcommonfunc.MatrixQ.Qresonators(), libcommonfunc.MatrixQ.rowIndices, libcommonfunc.MatrixQ.Zo, libcommonfunc.MatrixQ.ZoL, and libcommonfunc.MatrixQ.ZoS.

Here is the call graph for this function:

## Member Function Documentation

def libcommonfunc.MatrixQ.__str__ | ( |  | self,
|  |  | prec = `5`
| ) |  |

Convert numpy matrix to string representation.

Rounds coupling matrix elements to given precision using complexStr() function.

Parameters

  prec | = Number of significant digits (int). Default 5.

Returns
  st = String representation of the numpy matrix self.M.

Definition at line 2791 of file libcommonfunc.py.

References libcommonfunc.complexStr(), libcommonfunc.MatrixQ.lp2bp2cbw(), libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.Mcbw, libcommonfunc.MatrixQ.McbwTL, libcommonfunc.MatrixQ.name, and dbplot.CurveFamily.name.

Referenced by libcommonfunc.MatrixQ.saveMat().

Here is the call graph for this function:

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.addLossesQeff | ( |  | self,
|  |  | Qeff
| ) |  |

Add losses to resonators by substracting a factor 1/(Qeff*FBW) to the diagonal of the coupling matrix.

The typical application is to set a prescribed flatness in the ideal response of a lossy filter synthesis by emulating the non-flat response of a lossy filter of quality factor equal to Qeff. Qeff = Quality factor of the resonators to emulate.

Definition at line 2216 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, and libcommonfunc.MatrixQ.M.

def libcommonfunc.MatrixQ.copy | ( |  | self | ) |

Function to copy instances of the MatrixQ class (copies the self instance).

Returns
  New instance of MatrixQ class copied from the self instance.

Definition at line 1662 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.fileExt, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.Sparameters.FT, libcommonfunc.MatrixQ.FT, libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.name, dbplot.CurveFamily.name, libcommonfunc.MatrixQ.nodeScalingFactor, and libcommonfunc.MatrixQ.parent.

def libcommonfunc.MatrixQ.inflateMatrix | ( |  | self,
|  |  | position
| ) |  |

Add external non-resonant nodes to the coupling matrix self.M at the source or load sides, or both.

        The resulting self.M matrix will have one or two columns and rows more than the input one.
        @param position = Position where we want to inflate the matrix (string). It can be 'source', 'load' or 'both'.

        If position == 'source'

        If position == 'load'

        If position == 'both'

        where \form#117 and \form#118 are usually equal to 1 unless the first or last nodes of the matrix have been previously scaled by respective values \form#117 and \form#118 with node-scaling operations.
        If this is the case, the value of \form#117 and \form#118 for that nodes are retrieved from the self.nodeScalingFactor attribute.

Definition at line 2058 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.M, and libcommonfunc.MatrixQ.nodeScalingFactor.

def libcommonfunc.MatrixQ.lp2bp2cbw | ( |  | self | ) |

Compute bandpass and coupling bandwidth versions of the matrix.

        <b>Coupling bandwidth matrix</b>

        The diagonal elements of the coupling bandwidth matrix \form#84 is obtained as:

where the unnormalised resonant frequencies (Hz) of the resonators are:

with and . The factor is the fractional bandwidth.

For non-resonant nodes .

The couplings with source and load are:

where are the normalised low-pass coupling matrix elements and is the bandwidth (MHz).

The couplings between inner nodes (resonators or non-resonant nodes) are:

        <b>Coupling bandwidth matrix with transmission lines </b>

        For each matrix element \form#96, the scaling factor for the pass-band coupling matrix is

where is the low-pass normalised matrix and is the pass-band coupling matrix.

          The diagonal elements of the coupling bandwidth matrix \form#84 is obtained as:

where the unnormalised resonant frequencies (Hz) of the resonators are:

with and . The factor is the fractional bandwidth.

For non-resonant nodes .

The couplings with source and load are:

          The couplings between inner nodes (resonators or non-resonant nodes) are:

with

          For syncronous nodes, \form#90 and therefore

Definition at line 1851 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.Mbp, libcommonfunc.MatrixQ.Mcbw, libcommonfunc.MatrixQ.McbwTL, libcommonfunc.MatrixQ.Zo, libcommonfunc.MatrixQ.ZoL, and libcommonfunc.MatrixQ.ZoS.

Referenced by libcommonfunc.MatrixQ.__str__().

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.newMatQFromNonZero | ( |  | self,
|  |  | NonZeroValues,
|  |  | NonZeroReal,
|  |  | NonZeroImag,
|  |  | numReal,
|  |  | Q
| ) |  |

Return a new MatrixQ object that is a copy of self, except for the M matrix which is created from the NonZeroValues, NonZeroReal, NonZeroImag and Q parameters.

Parameters

  NonZeroValues | = Double numpy vector with the values of the matrix entries which are different from zero. It is a concatenation of the non-zero real elements and the non-zero imaginary elements.
  NonZeroReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part in the upper-triangular part, including the diagonal, of the matrix.
  NonZeroImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part in the upper-triangular part, including the diagonal, of the matrix. The entries corresponding to resonators are False, since the imaginary part will be obtained from the prescribed Q.
  numReal | = Number of entries in the upper triangular part of the matrix, including the diagonal, with non-zero real part.
  Q | = Prescribed uniform Q for the resonators.

Returns
  newMatQ = New MatrixQ object

Definition at line 2314 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.fileExt, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.Sparameters.FT, libcommonfunc.MatrixQ.FT, libcommonfunc.MatrixQ.name, dbplot.CurveFamily.name, libcommonfunc.MatrixQ.nodeScalingFactor, libcommonfunc.MatrixQ.order, and libcommonfunc.MatrixQ.parent.

Referenced by libcommonfunc.MatrixQ.uniformQ(), libcommonfunc.MatrixQ.uniformQMask(), libcommonfunc.MatrixQ.uniformQOptimize(), and libcommonfunc.MatrixQ.uniformQOptimizeMask().

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.Qresonators | ( |  | self | ) |

Compute the quality factors of each resonant node of coupling matrix self.M.

        Frequency transform is self.FT and output Q is stored in self.Q.

        For each node \form#62, the quality factor is

where the loss conductance of the unloaded resonator is:

        <b> Proof: </b>

        In the parallel N+2 normalized lowpass prototype equivalent circuit, at each node we have current excitation \form#65 equal to
        the current that flows away from the node through the circuit elements and couplings:

where are the real couplings, is the unloaded resonator conductance (losses), is the conductance of resistive couplings between resonators and, obviously, the excitation is for . For we have (source) .

If we define the mutual admittances between nodes as:

we have

and

In matrix form, with :

where the elements of the coupling matrix are:

and

Therefore:

and we can compute the resonator unloaded conductance as:

Q of resonators

Definition at line 1741 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.M, and libcommonfunc.MatrixQ.Q.

Referenced by libcommonfunc.MatrixQ.__init__(), libcommonfunc.MatrixQ.rotateMatrix(), libcommonfunc.MatrixQ.scaleNode(), libcommonfunc.MatrixQ.uniformQ(), and libcommonfunc.MatrixQ.uniformQMask().

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.rotAngleEliminate | ( |  | self,
|  |  | rotationType,
|  |  | i,
|  |  | j,
|  |  | m,
|  |  | n
| ) |  |

Compute the rotation angle such that, after applying a rotation of type rotationType, the element of the matrix self.M is equal to zero.

        The element to set to zero [m,n] must be in the row or column of the rotation pivot [i,j] or its transpose [j,i].
        @param rotationType = Type of rotation to perform. The possible values are: {'trigonometric', 'hyperbolic'}.
        @param i = Row index of the pivot that will be used in the rotation.
        @param j = Column index of the pivot that will be used in the rotation.
        @param m = Row index of the element that will become zero after rotation.
        @param n = Column index of the element that will become zero after rotation.
        @return rotAng = Rotation angle to remove the element \form#119.

        First of all, and following the rules in the next table [TN 102.2 tab. A.1], we need to compute a value \form#120 which depends on the position \form#121 of the element to eliminate and
        on the pivot \form#122:

We define for the cases {1,2,3,4,5,6} and for cases {7,8}. Then, the rotation angle which sets the element to zero after applying the rotation is:

Definition at line 2156 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.M.

def libcommonfunc.MatrixQ.rotateMatrix | ( |  | self,
|  |  | rotationType,
|  |  | i,
|  |  | j,
|  |  | rotAng,
|  |  | flagQ = `True`
| ) |  |

Rotate the coupling matrix self.M.

The resulting self.M matrix maintains the eigenvalues of the original matrix and his reflection and transmission properties.

Parameters

  rotationType | = Type of rotation to perform. The possible values are: {'trigonometric', 'hyperbolic'}.
  i | = Row index of the pivot that will be used in the rotation.
  j | = Column index of the pivot that will be used in the rotation.
  rotAng | = Rotation angle (rad).
  flagQ | = Flag that determines if the quality factor attribute self.Q is updated or not (True / False).

[TN 102.2 sec. 9.1] By definition, a rotation matrix is a matrix where every value in the diagonal is 1 except the two values and the rest of the values of the matrix are zero except the two values , where [TN 102.2 eq.(A.2) and (A.3)]:

        To apply the rotation we just need to do the product [TN 102.2 eq.(A.1)]:

where is the rotation matrix described above.

Definition at line 1930 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.MatrixQ.M, and libcommonfunc.MatrixQ.Qresonators().

Here is the call graph for this function:

def libcommonfunc.MatrixQ.saveMat | ( |  | self,
|  |  | fileName,
|  |  | P,
|  |  | SP,
|  |  | precCM,
|  |  | precEP
| ) |  |

Save this MatrixQ instance to an ascii file, including energy and power.

Uses self.__str__() to generate the ascii representation of the numpy matrix self.M.

Parameters

  fileName | = Name of file, including extension (string).
  P | = Parameter class instance.
  SP | = SParameters class instance.
  precCM | = Number of significant digits to save in coupling matrix and Q (int).
  precEP | = Number of significant digits to save in energy and power (int).

Definition at line 2675 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.__str__(), libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.MatrixQ.name, dbplot.CurveFamily.name, libcommonfunc.MatrixQ.nodeScalingFactor, libcommonfunc.pkgNameVersion(), and libcommonfunc.MatrixQ.Q.

Here is the call graph for this function:

def libcommonfunc.MatrixQ.scaleNode | ( |  | self,
|  |  | i,
|  |  | b,
|  |  | flagQ = `True`
| ) |  |

Scale a node of the coupling matrix self.M, by multiplying row [i] and column [i] by a factor.

Matrix rotations are not allowed after node scaling of a resonant node.

Parameters

  i | = Index of row and column which we want to scale.
  b | = Factor to use to scale the ith row and column.
  flagQ | = Flag that determines if the quality factor attribute self.Q is updated or not (True / False).

Definition at line 2100 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, libcommonfunc.MatrixQ.flagRotateAllowed, libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.nodeScalingFactor, and libcommonfunc.MatrixQ.Qresonators().

Here is the call graph for this function:

def libcommonfunc.MatrixQ.setFileExt | ( |  | self,
|  |  | fileExt
| ) |  |

Function to set file extension field of the instance of the MatrixQ class.

Parameters

  fileExt | = Extension of file name, if this matrix is to be saved in a file. Otherwise None.

Definition at line 1680 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.fileExt.

def libcommonfunc.MatrixQ.setName | ( |  | self,
|  |  | name
| ) |  |

Function to set name field of the instance of the MatrixQ class.

Parameters

  name | = Matrix name.

Definition at line 1671 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.name, and dbplot.CurveFamily.name.

def libcommonfunc.MatrixQ.setupOptimTopology | ( |  | self,
|  |  | topologyReal,
|  |  | topologyImag,
|  |  | topologySignReal,
|  |  | topologySignImag
| ) |  |

Prepare optimization parameters depending on matrix topology and forced signs.

Parameters

  topologyReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part.
  topologyImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part.
  topologySignReal | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any real part, respectively.
  topologySignImag | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any imaginary part, respectively.

Returns
  x0 = Initial guess. Double numpy vector with the values of the matrix entries which are different from zero. It is a concatenation of the non-zero real elements and the non-zero imaginary elements.
  NonZeroReal = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part in the upper-triangular part, including the diagonal, of the matrix.
  NonZeroImag = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part in the upper-triangular part, including the diagonal, of the matrix. The entries corresponding to resonators are False
  numReal = Number of entries in the upper triangular part of the matrix, including the diagonal, with non-zero real part.
  bounds = List of tuples (Min,Max) with bounds for all variables to optimize. The maximum abs of any matrix element is set to 4 times the largest coupling, with a minimum of 2. This bound also affects the real part of diagonal elements (normalized resonant frequencies).

Definition at line 2245 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.extraNodesL, libcommonfunc.MatrixQ.extraNodesS, and libcommonfunc.MatrixQ.M.

Referenced by libcommonfunc.MatrixQ.uniformQ(), and libcommonfunc.MatrixQ.uniformQMask().

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.uniformQ | ( |  | self,
|  |  | P,
|  |  | CP,
|  |  | weights,
|  |  | Q,
|  |  | algor,
|  |  | maxIter,
|  |  | Nsamples,
|  |  | S11DR,
|  |  | S21DR,
|  |  | topologyReal,
|  |  | topologyImag,
|  |  | topologySignReal,
|  |  | topologySignImag
| ) |  |

Optimize the coupling matrix to achieve a prescribed uniform Q and [S] parameters as close as possible to those computed from the characteristic polynomials.

The non-zero coupling matrix entries to optimize are specified by topologyReal and topologyImag parameters, which are set by the matrix topology widget in the GUI.

Parameters

  P | = Parameters class instance, containing filter, synthesis and sweep parameters.
  CP | = CharPolys class instance, containing Characteristic Polynomials Es, Ps, Fs and constants eps, epsR.
  weights | = Optimization weights for the difference in S11 and S21 between the computation from the coupling matrix and from polynomials: List [ weightS11, weightS22, weightS21, weightGD ]
  Q | = Prescribed uniform Q for the resonators.
  algor | = Constrained optimization algorithm. String equal to 'L-BFG-S', 'TNC' or 'SLSQP'. See below.
  maxIter | = Maximum number of iterations, or function evaluations, depending on algorithm.
  Nsamples | = Number of samples to test. Half of them go to the pass band and the other half to the rejection band, between P.minFreq and P.maxFreq.
  S11DR | = Dynamic range of S11 and S22 to test.
  S21DR | = Dynamic range of S21 to test.
  topologyReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part.
  topologyImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part.
  topologySignReal | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any real part, respectively.
  topologySignImag | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any imaginary part, respectively.

# Constrained optimization algorithms:

- http://en.wikipedia.org/wiki/Optimization

- ttp://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html

In optimization, quasi-Newton methods (also known as variable metric methods) are algorithms for finding local maxima and minima of functions. Quasi-Newton methods are based on Newton's method to find the stationary point of a function, where the gradient is 0. Newton's method assumes that the function can be locally approximated as a quadratic in the region around the optimum, and use the first and second derivatives (gradient and Hessian) to find the stationary point. In Quasi-Newton methods the Hessian matrix of second derivatives of the function to be minimized does not need to be computed. The Hessian is updated by analyzing successive gradient vectors instead (or approximate gradient evaluations computed using finite differences). Quasi-Newton methods are a generalization of the secant method to find the root of the first derivative for multidimensional problems. In multi-dimensions the secant equation is under-determined (has not a unique solution), and quasi-Newton methods differ in how they constrain the solution, typically by adding a simple low-rank update to the current estimate of the Hessian.

A necessary condition for optimality is that the gradient be zero. Quasi-Newton's method need not converge unless the function has a quadratic Taylor expansion near an optimum.

- http://en.wikipedia.org/wiki/Quasi-Newton_methods

- http://en.wikipedia.org/wiki/Newton%27s_method_in_optimization

## Limited memory variation Broyden–Fletcher–Goldfarb–Shanno algorithm (L-BFGS-B)

Limited memory variation of the Broyden–Fletcher–Goldfarb–Shanno (BFGS) update to approximate the inverse Hessian matrix.

The BFGS method is one of the most popular quasi-Newton optimization methods. L-BFGS is a limited-memory version of BFGS that is particularly suited to problems with very large numbers of variables.

References:

- http://en.wikipedia.org/wiki/L-BFGS

- http://en.wikipedia.org/wiki/BFGS_method

- Wright, and Nocedal ‘Numerical Optimization’, 1999, pg. 198.

- R. H. Byrd, P. Lu and J. Nocedal. A Limited Memory Algorithm for Bound Constrained Optimization, (1995), SIAM Journal on Scientific and Statistical Computing , 16, 5, pp. 1190-1208.

- C. Zhu, R. H. Byrd and J. Nocedal. L-BFGS-B: Algorithm 778: L-BFGS-B, FORTRAN routines for large scale bound constrained optimization (1997), ACM Transactions on Mathematical Software, Vol 23, Num. 4, pp. 550 - 560.

## Sequential Least SQuares Programming (SLSQP)

SLSQP optimizer is a sequential least squares programming algorithm which uses the Han–Powell quasi–Newton method with a BFGS update of the B–matrix and an L1–test function in the step–length algorithm. The optimizer uses a slightly modified version of Lawson and Hanson’s NNLS nonlinear least-squares solver.

Sequential quadratic programming (SQP) is one of the most popular and robust algorithms for nonlinear continuous optimization. The method is based on solving a series of subproblems designed to minimize a quadratic model of the objective subject to a linearization of the constraints. If the problem is unconstrained, then the method reduces to Newton's method for finding a point where the gradient of the objective vanishes. If the problem has only equality constraints, then the method is equivalent to applying Newton's method to the first-order optimality conditions, or Karush–Kuhn–Tucker conditions, of the problem. A number of packages (including NPSOL, NLPQL, OPSYC, OPTIMA, MATLAB, and SQP) are founded on this approach.

References:

- http://en.wikipedia.org/wiki/Sequential_quadratic_programming

- Kraft D (1988) A software package for sequential quadratic programming. Tech. Rep. DFVLR-FB 88-28, DLR German Aerospace Center — Institute for Flight Mechanics, Koln, Germany.

## Bound-constrained truncated newton algorithm (TNC)

Bound-constrained truncated newton algorithm using gradient information.

Truncated-Newton methods are a family of methods suitable for solving large nonlinear optimization problems. At each iteration, the current estimate of the solution is updated (i.e., a step is computed) by approximately solving the Newton equations using an iterative algorithm. This results in a doubly iterative method: an outer iteration for the nonlinear optimization problem, and an inner iteration for the Newton equations. The inner iteration is typically stopped or truncated before the solution to the Newton equations is obtained. Over the past two decades, a solid convergence theory has been derived for the methods. In addition, many algorithmic enhancements have been developed and studied, resulting in a number of publicly-available software packages. The result has been a collection of powerful, flexible, and adaptable tools for large-scale nonlinear optimization.

References:

- http://js2007.free.fr/code/index.html#TNC

- http://iris.gmu.edu/~snash/nash/assets/TN_Survey/tn_survey.html

- Stephen G. Nash, “A Survey of Truncated-Newton Methods”, Journal of Computational and Applied Mathematics, 124 (2000), pp. 45-59. http://iris.gmu.edu/~snash/papers/nash_3_99.ps

      Return a SParameters class instance with sampling frequencies to optimize.
      S11, S22, S21 and groupDelay attributes are initialized with those computed from the polynomials.

      @param P  = Parameters class instance, containing filter, synthesis and sweep parameters.
      @param CP = CharPolys class instance, containing Characteristic Polynomials Es, Ps, Fs and constants eps, epsR.
      @param FT = FrequencyTransform class instance, containing f0 and BW parameters.
      @param minFreq = Minimum frequency to optimize.
      @param maxFreq = Maximum frequency to optimize.
      @param Nsamples = Number of samples to test. Half of them go to the pass band and the other half to the rejection band, between minFreq and maxFreq.

      @return SPref = SParameters class instance with sampling frequencies to optimize and [S] parameters computed from CP.

Definition at line 2432 of file libcommonfunc.py.

References libcommonfunc.Sparameters.FT, libcommonfunc.MatrixQ.FT, libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.newMatQFromNonZero(), libcommonfunc.MatrixQ.Qresonators(), libcommonfunc.MatrixQ.setupOptimTopology(), and libcommonfunc.MatrixQ.uniformQOptimize().

Here is the call graph for this function:

def libcommonfunc.MatrixQ.uniformQMask | ( |  | self,
|  |  | P,
|  |  | CP,
|  |  | weights,
|  |  | Q,
|  |  | algor,
|  |  | maxIter,
|  |  | Nsamples,
|  |  | SM,
|  |  | topologyReal,
|  |  | topologyImag,
|  |  | topologySignReal,
|  |  | topologySignImag
| ) |  |

Optimize the coupling matrix to achieve a prescribed uniform Q and [S] parameters that comply with a specification mask.

The non-zero coupling matrix entries to optimize are specified by topologyReal and topologyImag parameters, which are set by the matrix topology widget in the GUI. Only the magnitude of [S] is optimized to comply with the S11 and S21 masks. Group delay in the mask file, if any, is not used in optimization,

Parameters

  P | = Parameters class instance, containing filter, synthesis and sweep parameters.
  CP | = CharPolys class instance, containing Characteristic Polynomials Es, Ps, Fs and constants eps, epsR.
  weights | = Optimization weights for the difference in S11 and S21 between the computation from the coupling matrix and from polynomials: List [ weightS11, weightS22, weightS21, weightGD ]. The last element, weightGD, is not used.
  Q | = Prescribed uniform Q for the resonators.
  algor | = Constrained optimization algorithm. String equal to 'L-BFG-S', 'TNC' or 'SLSQP'. See algorithms description MatrixQ.uniformQ method documentation.
  maxIter | = Maximum number of iterations, or function evaluations, depending on algorithm.
  Nsamples | = Number of samples to test. Half of them go to the pass band and the other half to the rejection band, between P.minFreq and P.maxFreq.
  SM | = SpecMask class instance, with the mask to compare with.
  topologyReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part.
  topologyImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part.
  topologySignReal | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any real part, respectively.
  topologySignImag | = Int numpy array having -1,1 or 0 values at the position of coupling matrix entries with negative, positive or any imaginary part, respectively.

Definition at line 2577 of file libcommonfunc.py.

References libcommonfunc.Sparameters.FT, libcommonfunc.MatrixQ.FT, libcommonfunc.MatrixQ.M, libcommonfunc.MatrixQ.newMatQFromNonZero(), libcommonfunc.MatrixQ.Qresonators(), libcommonfunc.MatrixQ.setupOptimTopology(), and libcommonfunc.MatrixQ.uniformQOptimizeMask().

Here is the call graph for this function:

def libcommonfunc.MatrixQ.uniformQOptimize | ( |  | self,
|  |  | NonZeroValues,
|  |  | SPref,
|  |  | S11min,
|  |  | S21min,
|  |  | NonZeroReal,
|  |  | NonZeroImag,
|  |  | numReal,
|  |  | weights,
|  |  | Q
| ) |  |

Optimization objective function for uniformQ function.

The output matrix is forced symmetric, with positive imaginary part out of the diagonal and with uniform Q in all the resonators. The imaginary part of the diagonal elements is determined so that the Q is constant,so it is not a variable to optimize.

Parameters

  NonZeroValues | = Double numpy vector with the values of the matrix entries which are different from zero. It is a concatenation of the non-zero real elements and the non-zero imaginary elements.
  SPref | = SParameters class instance containing [S] computed from the characteristic polynomials. It is used as the reference to compare.
  S11min | = Minimum value of S11 and S22 to test.
  S21min | = Minimum value of S21 outside to test.
  NonZeroReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part in the upper-triangular part, including the diagonal, of the matrix.
  NonZeroImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part in the upper-triangular part, including the diagonal, of the matrix. The entries corresponding to resonators are False, since the imaginary part will be obtained from the prescribed Q.
  numReal | = Number of entries in the upper triangular part of the matrix, including the diagonal, with non-zero real part.
  weights | = Optimization weights for the difference in S11(dB), S21(dB) and GD(inband) between the computation from the coupling matrix and from polynomials: List [ weightS11, weightS22, weightS21, weightGD ]
  Q | = Prescribed uniform Q for the resonators.

Returns
  goal = Objective function value to minimize.

Definition at line 2513 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.newMatQFromNonZero().

Referenced by libcommonfunc.MatrixQ.uniformQ().

Here is the call graph for this function:

Here is the caller graph for this function:

def libcommonfunc.MatrixQ.uniformQOptimizeMask | ( |  | self,
|  |  | NonZeroValues,
|  |  | SPref,
|  |  | SM,
|  |  | NonZeroReal,
|  |  | NonZeroImag,
|  |  | numReal,
|  |  | weights,
|  |  | Q
| ) |  |

Optimization objective function for uniformQMask function.

The output matrix is forced symmetric, with positive imaginary part out of the diagonal and with uniform Q in all the resonators. The imaginary part of the diagonal elements is determined so that the Q is constant,so it is not a variable to optimize. Only the magnitude of [S] is optimized to comply with the S11 and S21 masks. Group delay in the mask file, if any, is not used in optimization,

Parameters

  NonZeroValues | = Double numpy vector with the values of the matrix entries which are different from zero. It is a concatenation of the non-zero real elements and the non-zero imaginary elements.
  SPref | = SParameters class instance containing method and storage to compute [S] from CM.
  SM | = SpecMask class instance, with the mask to compare with.
  NonZeroReal | = Bool numpy array having True values at the position of coupling matrix entries with non-zero real part in the upper-triangular part, including the diagonal, of the matrix.
  NonZeroImag | = Bool numpy array having True values at the position of coupling matrix entries with non-zero imaginary part in the upper-triangular part, including the diagonal, of the matrix. The entries corresponding to resonators are False, since the imaginary part will be obtained from the prescribed Q.
  numReal | = Number of entries in the upper triangular part of the matrix, including the diagonal, with non-zero real part.
  weights | = Optimization weights for the difference in S11(dB), S21(dB) and GD(inband) between the computation from the coupling matrix and from polynomials: List [ weightS11, weightS22, weightS21, weightGD ]. The last element, weightGD, is not used.
  Q | = Prescribed uniform Q for the resonators.

Returns
  goal = Objective function value to minimize.

Definition at line 2624 of file libcommonfunc.py.

References libcommonfunc.MatrixQ.newMatQFromNonZero().

Referenced by libcommonfunc.MatrixQ.uniformQMask().

Here is the call graph for this function:

Here is the caller graph for this function:

The documentation for this class was generated from the following file:

- libcommonfunc.py