STIR  6.2.0
Functions
demo5_line_search.cxx File Reference

A class to compute a line search evaluation in the direction of the gradient of a given image and objective function. All parameters can be parsed from a parameter file. See demo5_line_search.par. More...

Functions

std::vector< double > compute_linear_alphas (const float alpha_min, const float alpha_max, const float num_evaluations)
 
std::vector< double > compute_exponential_alphas (const float alpha_min, const float alpha_max, const float num_evaluations)
 
void save_doubles_vector_to_file (std::string filename, std::vector< double > vector)
 
int main (int argc, char **argv)
 

Detailed Description

A class to compute a line search evaluation in the direction of the gradient of a given image and objective function. All parameters can be parsed from a parameter file. See demo5_line_search.par.

Give an image and objective function configuration, this script will perform a line search ```suggestion from a minimum to a maximum step size (alpha). Options are included to perform this line search linearly or using exponential step sizes. Additionally, a lower positivity bound is applied to all computed images.

The results are saved to files: alphas.dat contains the step size values investigated, and Phis.dat contains the objective function evaluations. Furthermore, the image corresponding to the maximum objective function and the gradient used in the line search are saved to file.

Note that the same functionality could be provided without deriving a new class from stir::ParsingObject. One could have a stir::KeyParser object in main() and fill it in directly.

See README.txt in the directory where this file is located.

Author
Robert Twyman

Function Documentation

◆ compute_linear_alphas()

std::vector<double> compute_linear_alphas ( const float  alpha_min,
const float  alpha_max,
const float  num_evaluations 
)

This function computes a vector (of length num_evaluations) of linear values from alpha_min to alpha_max

Explicitly add alpha = 0.0 and/or alpha_min

create a vector from (alpha_min + d_alpha) to alpha_max

◆ compute_exponential_alphas()

std::vector<double> compute_exponential_alphas ( const float  alpha_min,
const float  alpha_max,
const float  num_evaluations 
)

This function computes a vector (of length num_evaluations) of exponential values from 10^alpha_min to 10^alpha_max

Explicitly add alpha = 0.0 and/or alpha_min

create a vector from (alpha_min + d_alpha) to alpha_max

◆ save_doubles_vector_to_file()

void save_doubles_vector_to_file ( std::string  filename,
std::vector< double >  vector 
)

This function is used to save the line search results (alpha and Phi values) to separate files.