docstr: Perform one line search step.
  
  Parameters
  ----------
  iteration : int
      The current iteration number.
  tensor_slices : ndarray or list of ndarrays
      The data itself. Either a third order tensor or a list of second order tensors that
      may have different number of rows.
  factors_last : list of ndarrays
      The CP factors from the previous iteration.
  weights : ndarrays
      The normalization weights for the current factors.
  factors : list of ndarrays
      The CP factors from the current iteration.
  projections : list of ndarrays
      The projection matrices from the current iteration.
  rec_error : float
      The reconstruction error from the current iteration.
  
  Returns
  -------
  factors : list
      List of factors for the accepted step.
  projections : list
      List of projection matrices from the accepted step.
  rec_error : float
      Reconstruction error of the accepted step.
docstr_tok: ["Perform","one","line","search","step",".","Parameters","--","--","--","--","--","iteration",":","int","The","current","iteration","number",".","tensor_slices",":","ndarray","or","list","of","ndarrays","The","data","itself",".","Either","a","third","order","tensor","or","a","list","of","second","order","tensors","that","may","have","different","number","of","rows",".","factors_last",":","list","of","ndarrays","The","CP","factors","from","the","previous","iteration",".","weights",":","ndarrays","The","normalization","weights","for","the","current","factors",".","factors",":","list","of","ndarrays","The","CP","factors","from","the","current","iteration",".","projections",":","list","of","ndarrays","The","projection","matrices","from","the","current","iteration",".","rec_error",":","float","The","reconstruction","error","from","the","current","iteration",".","Returns","--","--","--","-","factors",":","list","List","of","factors","for","the","accepted","step",".","projections",":","list","List","of","projection","matrices","from","the","accepted","step",".","rec_error",":","float","Reconstruction","error","of","the","accepted","step","."]
code: def line_step(
      self,
      iteration: int,
      tensor_slices: Iterable,
      factors_last: list,
      weights,
      factors: list,
      projections: list,
      rec_error,
  ):
      r"""Perform one line search step.
  
      Parameters
      ----------
      iteration : int
          The current iteration number.
      tensor_slices : ndarray or list of ndarrays
          The data itself. Either a third order tensor or a list of second order tensors that
          may have different number of rows.
      factors_last : list of ndarrays
          The CP factors from the previous iteration.
      weights : ndarrays
          The normalization weights for the current factors.
      factors : list of ndarrays
          The CP factors from the current iteration.
      projections : list of ndarrays
          The projection matrices from the current iteration.
      rec_error : float
          The reconstruction error from the current iteration.
  
      Returns
      -------
      factors : list
          List of factors for the accepted step.
      projections : list
          List of projection matrices from the accepted step.
      rec_error : float
          Reconstruction error of the accepted step.
      """
      jump = iteration ** (1.0 / self.acc_pow)
  
      factors_ls = [
          factors_last[ii] + (factors[ii] - factors_last[ii]) * jump
          for ii, _ in enumerate(factors)
      ]
  
      # Clip if the mode should be non-negative
      if self.nn_modes:
          if 0 in self.nn_modes:
              factors_ls[0] = tl.clip(factors_ls[0], 0)
          if 2 in self.nn_modes:
              factors_ls[2] = tl.clip(factors_ls[2], 0)
  
      projections_ls = _compute_projections(
          tensor_slices, factors_ls, self.svd
      )
  
      ls_rec_error = _parafac2_reconstruction_error(
          tensor_slices,
          (weights, factors_ls, projections_ls),
          self.norm_tensor,
      )
      ls_rec_error /= self.norm_tensor
  
      if ls_rec_error < rec_error:
          self.acc_fail = 0
  
          if self.verbose:
              print(f"Accepted line search jump of {jump}.")
  
          return factors_ls, projections_ls, ls_rec_error
      else:
          self.acc_fail += 1
  
          if self.verbose:
              print(f"Line search failed for jump of {jump}.")
  
          if self.acc_fail == self.max_fail:
              self.acc_pow += 1.0
              self.acc_fail = 0
  
              if self.verbose:
                  print("Reducing acceleration.")
  
          return factors, projections, rec_error
  
imports: from warnings import warn
  from typing import Iterable
  import tensorly
  from ._base_decomposition import DecompositionMixin
  from tensorly.random import random_parafac2
  from tensorly import backend
  from .None import parafac, non_negative_parafac_hals
  from ..parafac2_tensor import Parafac2Tensor, _validate_parafac2_tensor
  from ..cp_tensor import CPTensor, cp_normalize
  from ..tenalg.svd import svd_interface
label_desc: Use image node_id 2 for calling the _BroThesisLineSearch obj's underlying member method code with example usage: obj.line_step(iteration, tensor_slices, factors_last, weights, factors, projections, rec_error) and returns: factors_ls,  projections_ls,  ls_rec_error, factors,  projections,  rec_error