tf.linalg.experimental.conjugate_gradient
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
Conjugate gradient solver.
tf.linalg.experimental.conjugate_gradient(
    operator,
    rhs,
    preconditioner=None,
    x=None,
    tol=1e-05,
    max_iter=20,
    name='conjugate_gradient'
)
Solves a linear system of equations A*x = rhs for self-adjoint, positive
definite matrix A and right-hand side vector rhs, using an iterative,
matrix-free algorithm where the action of the matrix A is represented by
operator. The iteration terminates when either the number of iterations
exceeds max_iter or when the residual norm has been reduced to tol
times its initial value, i.e. \(||rhs - A x_k|| <= tol ||rhs||\).
| Args | 
|---|
| operator | A LinearOperatorthat is self-adjoint and positive definite. | 
| rhs | A possibly batched vector of shape [..., N]containing the right-hand
size vector. | 
| preconditioner | A LinearOperatorthat approximates the inverse ofA.
An efficient preconditioner could dramatically improve the rate of
convergence. Ifpreconditionerrepresents matrixM(MapproximatesA^{-1}), the algorithm usespreconditioner.apply(x)to estimateA^{-1}x. For this to be useful, the cost of applyingMshould be
much lower than computingA^{-1}directly. | 
| x | A possibly batched vector of shape [..., N]containing the initial
guess for the solution. | 
| tol | A float scalar convergence tolerance. | 
| max_iter | An integer giving the maximum number of iterations. | 
| name | A name scope for the operation. | 
| Returns | 
|---|
| output | A namedtuple representing the final state with fields: 
i: A scalar int32Tensor. Number of iterations executed.x: A rank-1 Tensorof shape[..., N]containing the computed
solution.r: A rank-1 Tensorof shape[.., M]containing the residual vector.p: A rank-1 Tensorof shape[..., N].A-conjugate basis vector.gamma: \(r \dot M \dot r\), equivalent to  \(||r||_2^2\) when
preconditioner=None. | 
  
  
 
  
    
    
      
       
    
    
  
  
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
  Last updated 2023-10-06 UTC.
  
  
  
    
      [null,null,["Last updated 2023-10-06 UTC."],[],[]]