Skip to main content
Ctrl+K
NIFTy  documentation - Home NIFTy  documentation - Home
  • User Guide
  • API reference
Ctrl+K
  • PyPI
  • GitLab
Ctrl+K
  • User Guide
  • API reference
  • PyPI
  • GitLab

Section Navigation

  • nifty.cl package
    • nifty.cl.domains package
      • nifty.cl.domains.dof_space module
      • nifty.cl.domains.domain module
      • nifty.cl.domains.gl_space module
      • nifty.cl.domains.hp_space module
      • nifty.cl.domains.lm_space module
      • nifty.cl.domains.power_space module
      • nifty.cl.domains.rg_space module
      • nifty.cl.domains.structured_domain module
      • nifty.cl.domains.unstructured_domain module
    • nifty.cl.library package
      • nifty.cl.library.adjust_variances module
      • nifty.cl.library.correlated_fields module
      • nifty.cl.library.correlated_fields_simple module
      • nifty.cl.library.dynamic_operator module
      • nifty.cl.library.light_cone_operator module
      • nifty.cl.library.los_response module
      • nifty.cl.library.nft module
      • nifty.cl.library.special_distributions module
      • nifty.cl.library.variational_models module
      • nifty.cl.library.wiener_filter_curvature module
    • nifty.cl.minimization package
      • nifty.cl.minimization.config package
        • nifty.cl.minimization.config.optimize_kl_config module
      • nifty.cl.minimization.conjugate_gradient module
      • nifty.cl.minimization.descent_minimizers module
      • nifty.cl.minimization.energy module
      • nifty.cl.minimization.energy_adapter module
      • nifty.cl.minimization.iteration_controllers module
      • nifty.cl.minimization.kl_energies module
      • nifty.cl.minimization.line_search module
      • nifty.cl.minimization.minimizer module
      • nifty.cl.minimization.nonlinear_cg module
      • nifty.cl.minimization.optimize_kl module
      • nifty.cl.minimization.quadratic_energy module
      • nifty.cl.minimization.sample_list module
      • nifty.cl.minimization.scipy_minimizer module
      • nifty.cl.minimization.stochastic_minimizer module
    • nifty.cl.operators package
      • nifty.cl.operators.adder module
      • nifty.cl.operators.block_diagonal_operator module
      • nifty.cl.operators.chain_operator module
      • nifty.cl.operators.contraction_operator module
      • nifty.cl.operators.convolution_operators module
      • nifty.cl.operators.counting_operator module
      • nifty.cl.operators.diagonal_operator module
      • nifty.cl.operators.distributors module
      • nifty.cl.operators.domain_tuple_field_inserter module
      • nifty.cl.operators.einsum module
      • nifty.cl.operators.endomorphic_operator module
      • nifty.cl.operators.energy_operators module
      • nifty.cl.operators.field_zero_padder module
      • nifty.cl.operators.harmonic_operators module
      • nifty.cl.operators.inversion_enabler module
      • nifty.cl.operators.jax_operator module
      • nifty.cl.operators.linear_interpolation module
      • nifty.cl.operators.linear_operator module
      • nifty.cl.operators.mask_operator module
      • nifty.cl.operators.matrix_product_operator module
      • nifty.cl.operators.multifield2vector module
      • nifty.cl.operators.normal_operators module
      • nifty.cl.operators.operator module
      • nifty.cl.operators.operator_adapter module
      • nifty.cl.operators.outer_product_operator module
      • nifty.cl.operators.partial_conjugate module
      • nifty.cl.operators.regridding_operator module
      • nifty.cl.operators.sampling_enabler module
      • nifty.cl.operators.sandwich_operator module
      • nifty.cl.operators.scaling_operator module
      • nifty.cl.operators.selection_operators module
      • nifty.cl.operators.simple_linear_operators module
      • nifty.cl.operators.simplify_for_const module
      • nifty.cl.operators.sum_operator module
      • nifty.cl.operators.transpose_operator module
      • nifty.cl.operators.value_inserter module
    • nifty.cl.any_array module
    • nifty.cl.domain_tuple module
    • nifty.cl.ducc_dispatch module
    • nifty.cl.evidence_lower_bound module
    • nifty.cl.extra module
    • nifty.cl.field module
    • nifty.cl.linearization module
    • nifty.cl.logger module
    • nifty.cl.multi_domain module
    • nifty.cl.multi_field module
    • nifty.cl.operator_spectrum module
    • nifty.cl.operator_tree_optimiser module
    • nifty.cl.plot module
    • nifty.cl.pointwise module
    • nifty.cl.probing module
    • nifty.cl.random module
    • nifty.cl.spectrum_to_rgb module
    • nifty.cl.sugar module
    • nifty.cl.utilities module
  • nifty.re package
    • nifty.re.extra package
      • nifty.re.extra.sampling_los module
    • nifty.re.multi_grid package
      • nifty.re.multi_grid.correlated_field module
      • nifty.re.multi_grid.grid module
      • nifty.re.multi_grid.grid_impl module
      • nifty.re.multi_grid.jhealpix module
      • nifty.re.multi_grid.kernel module
      • nifty.re.multi_grid.matern module
    • nifty.re.num package
      • nifty.re.num.lanczos module
      • nifty.re.num.stats_distributions module
      • nifty.re.num.unique module
    • nifty.re.tree_math package
      • nifty.re.tree_math.forest_math module
      • nifty.re.tree_math.pytree_string module
      • nifty.re.tree_math.util module
      • nifty.re.tree_math.vector module
      • nifty.re.tree_math.vector_math module
    • nifty.re.blackjax module
    • nifty.re.check_model module
    • nifty.re.conjugate_gradient module
    • nifty.re.correlated_field module
    • nifty.re.custom_map module
    • nifty.re.empirical_power_spectrum module
    • nifty.re.evi module
    • nifty.re.evidence_lower_bound module
    • nifty.re.gauss_markov module
    • nifty.re.hmc module
    • nifty.re.hmc_oo module
    • nifty.re.lax module
    • nifty.re.likelihood module
    • nifty.re.likelihood_impl module
    • nifty.re.logger module
    • nifty.re.minisanity module
    • nifty.re.misc module
    • nifty.re.model module
    • nifty.re.optimize module
    • nifty.re.optimize_kl module
    • nifty.re.prior module
    • nifty.re.structured_kernel_interpolation module
  • nifty package
  • nifty.cl package
  • nifty.cl.minimization package
  • nifty.cl.minimization.line_search module

nifty.cl.minimization.line_search module#

class LineEnergy(line_position, energy, line_direction, offset=0.0)[source]#

Bases: object

Evaluates an underlying Energy along a certain line direction.

Given an Energy class and a line direction, its position is parametrized by a scalar step size along the descent direction relative to a zero point.

Parameters:
  • line_position (float) – Defines the full spatial position of this energy via self.energy.position = zero_point + line_position*line_direction

  • energy (Energy) – The Energy object which will be evaluated along the given direction.

  • line_direction (nifty.cl.field.Field) – Direction used for line evaluation. Does not have to be normalized.

  • offset (float optional) – Indirectly defines the zero point of the line via the equation energy.position = zero_point + offset*line_direction (default : 0.).

Notes

The LineEnergy is used in minimization schemes in order perform line searches. It describes an underlying Energy which is restricted along one direction, only requiring the step size parameter to determine a new position.

__init__(line_position, energy, line_direction, offset=0.0)[source]#
at(line_position)[source]#

Returns LineEnergy at new position, memorizing the zero point.

Parameters:

line_position (float) – Parameter for the new position on the line direction.

Return type:

LineEnergy object at new position with same zero point as self.

property directional_derivative#

The directional derivative at the given position.

Type:

float

property energy#

The underlying Energy object

Type:

Energy

property value#

The value of the energy functional at given position.

Type:

float

class LineSearch(preferred_initial_step_size=None, c1=0.0001, c2=0.9, max_step_size=1e+30, max_iterations=100, max_zoom_iterations=100)[source]#

Bases: object

Class for finding a step size that satisfies the strong Wolfe conditions.

Algorithm contains two stages. It begins with a trial step length and keeps increasing it until it finds an acceptable step length or an interval. If it does not satisfy the Wolfe conditions, it performs the Zoom algorithm (second stage). By interpolating it decreases the size of the interval until an acceptable step length is found.

Parameters:
  • preferred_initial_step_size (float, optional) – Newton-based methods should intialize this to 1.

  • c1 (float) – Parameter for Armijo condition rule. Default: 1e-4.

  • c2 (float) – Parameter for curvature condition rule. Default: 0.9.

  • max_step_size (float) – Maximum step allowed in to be made in the descent direction. Default: 1e30.

  • max_iterations (int, optional) – Maximum number of iterations performed by the line search algorithm. Default: 100.

  • max_zoom_iterations (int, optional) – Maximum number of iterations performed by the zoom algorithm. Default: 100.

__init__(preferred_initial_step_size=None, c1=0.0001, c2=0.9, max_step_size=1e+30, max_iterations=100, max_zoom_iterations=100)[source]#
perform_line_search(energy, pk, f_k_minus_1=None)[source]#

Performs the first stage of the algorithm.

It starts with a trial step size and it keeps increasing it until it satisfies the strong Wolf conditions. It also performs the descent and returns the optimal step length and the new energy.

Parameters:
  • energy (Energy) – Energy object from which we will calculate the energy and the gradient at a specific point.

  • pk (nifty.cl.field.Field) – Vector pointing into the search direction.

  • f_k_minus_1 (float, optional) – Value of the fuction (which is being minimized) at the k-1 iteration of the line search procedure. Default: None.

Returns:

  • Energy – The new Energy object on the new position.

  • bool – whether the line search was considered successful or not

previous

nifty.cl.minimization.kl_energies module

next

nifty.cl.minimization.minimizer module

On this page
  • LineEnergy
    • LineEnergy.__init__()
    • LineEnergy.at()
    • LineEnergy.directional_derivative
    • LineEnergy.energy
    • LineEnergy.value
  • LineSearch
    • LineSearch.__init__()
    • LineSearch.perform_line_search()
Show Source

© Copyright 2013-2022, Max-Planck-Society.

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.17.1.