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

# sc\_MCSearch(3)

This performs line searches with cubic steps.

## NAME

sc::MCSearch - This performs line searches with cubic steps.

## SYNOPSIS

`#include <mcsearch.h>`

Inherits **sc::LineOpt**.

### Public Member Functions

**MCSearch** (const **Ref**\< **KeyVal** \> &)\
 The **MCSearch** **KeyVal** CTOR does not read any input.  int **update** ()\
 Take a step.  void **init** (**RefSCVector** &direction)\
 Initializes the line search object.  void **init** (**RefSCVector** &direction, **Ref**\< **Function** \> **function**)\
 Initializes the line search object.

### Protected Member Functions

void **mcstep** (double \*stx, double \*fx, double \*dx, double \*sty, double \*fy, double \*dy, double \*stp, double \*fp, double \*dp, bool \*brackt, double \*stpmin, double \*stpmax, int \*info)\
 void **mcsrch** (int \*n, double \*x, double \*f, double \*g, double \*s, double \*stp, double \*ftol, double \*xtol, int \*maxfev, int \*info, int \*nfev, double \*wa)\
 void **mcinit** ()\

### Protected Attributes

double **gtol\_**\
 double **stpmin\_**\
 double **stpmax\_**\
 double **dg**\
 double **fm**\
 double **fx**\
 double **fy**\
 double **dgm**\
 double **dgx**\
 double **dgy**\
 double **fxm**\
 double **fym**\
 double **stx**\
 double **sty**\
 double **dgxm**\
 double **dgym**\
 int **infoc**\
 double **finit**\
 double **width**\
 double **stmin**\
 double **stmax**\
 bool **stage1**\
 double **width1**\
 double **ftest1**\
 bool **brackt**\
 double **dginit**\
 double **dgtest**\
 double **p**\
 double **q**\
 double **r\_\_**\
 double **s**\
 double **sgnd**\
 double **stpc**\
 double **stpf**\
 double **stpq**\
 double **gamma**\
 double **theta**\
 bool **bound**\
 int **info\_**\
 **auto\_vec**\< double \> **wa\_**\

### Additional Inherited Members

## Detailed Description

This performs line searches with cubic steps.

It is based on the Fortran MCSRCH and MCSTEP routines produced by: Argonne National Laboratory. MINPACK Project. June 1983 Jorge J. More', David J. Thuente.

## Constructor & Destructor Documentation

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

The **MCSearch** **KeyVal** CTOR does not read any input. See the **LineOpt** **KeyVal** CTOR for parameters that it takes.

## Member Function Documentation

### void sc::MCSearch::init (RefSCVector & direction)` [virtual]`

Initializes the line search object. Argument is a search direction. Use of this method assumes the **Optimize** base class already has a function object (got it from a keyval or elsewhere).

Reimplemented from **sc::LineOpt**.

### void sc::MCSearch::init (RefSCVector & direction, Ref\< Function \> function)` [virtual]`

Initializes the line search object. First argument is a search direction, second argument is a function object to optimize. Use this method when a function must be passed to the **Optimize** base class.

Reimplemented from **sc::LineOpt**.

### int sc::MCSearch::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.
