---
name: "sc_QNewtonOpt"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_QNewtonOpt"
---

# sc\_QNewtonOpt(3)

The QNewtonOpt implements a quasi-Newton optimization scheme.

## NAME

sc::QNewtonOpt - The **QNewtonOpt** implements a quasi-Newton optimization scheme.

## SYNOPSIS

`#include <qnewton.h>`

Inherits **sc::Optimize**.

### Public Member Functions

**QNewtonOpt** (const **Ref**\< **KeyVal** \> &)\
 The **KeyVal** constructor.  **QNewtonOpt** (**StateIn** &)\
 void **save\_data\_state** (**StateOut** &)\
 Save the base classes (with save\_data\_state) and the members in the same order that the **StateIn** CTOR initializes them.  void **apply\_transform** (const **Ref**\< **NonlinearTransform** \> &)\
 void **init** ()\
 Initialize the optimizer.  int **update** ()\
 Take a step.

### Protected Attributes

double **maxabs\_gradient**\
 double **accuracy\_**\
 **RefSymmSCMatrix** **ihessian\_**\
 **Ref**\< **HessianUpdate** \> **update\_**\
 **Ref**\< **LineOpt** \> **lineopt\_**\
 int **take\_newton\_step\_**\
 int **print\_hessian\_**\
 int **print\_x\_**\
 int **print\_gradient\_**\
 int **linear\_**\
 int **restrict\_**\
 int **dynamic\_grad\_acc\_**\
 int **force\_search\_**\
 int **restart\_**\

### Additional Inherited Members

## Detailed Description

The **QNewtonOpt** implements a quasi-Newton optimization scheme.

## Constructor & Destructor Documentation

### sc::QNewtonOpt::QNewtonOpt (const Ref\< KeyVal \> &)

The **KeyVal** constructor. The **KeyVal** constructor reads the following keywords:

- `update`

  This gives a **HessianUpdate** object. The default is to not update the hessian.

- `hessian`

  By default, the guess hessian is obtained from the **Function** object. This keyword specifies an lower triangle array (the second index must be less than or equal to than the first) that replaces the guess hessian. If some of the elements are not given, elements from the guess hessian will be used.

- `lineopt`

  This gives a **LineOpt** object for doing line optimizations in the Newton direction. The default is to skip the line optimizations.

- `accuracy`

  The accuracy with which the first gradient will be computed. If this is too large, it may be necessary to evaluate the first gradient point twice. If it is too small, it may take longer to evaluate the first point. The default is 0.0001.

- `print_x`

  If true, print the coordinates each iteration. The default is false.

- `print_gradient`

  If true, print the gradient each iteration. The default is false.

- `print_hessian`

  If true, print the approximate hessian each iteration. The default is false.

- `restrict`

  Use step size restriction when not using a line search. The default is true.

## Member Function Documentation

### void sc::QNewtonOpt::apply\_transform (const Ref\< NonlinearTransform \> &)` [virtual]`

Reimplemented from **sc::Optimize**.

### void sc::QNewtonOpt::init ()` [virtual]`

Initialize the optimizer.

Reimplemented from **sc::Optimize**.

### void sc::QNewtonOpt::save\_data\_state (StateOut &)` [virtual]`

Save the base classes (with save\_data\_state) and the members in the same order that the **StateIn** CTOR initializes them. This must be implemented by the derived class if the class has data.

Reimplemented from **sc::Optimize**.

### int sc::QNewtonOpt::update ()` [virtual]`

Take a step. Returns 1 if the optimization has converged, otherwise 0.

Implements **sc::Optimize**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
