Ejemplo n.º 1
0
def self_adjoint_eigvals(matrix, name=None):
  """Computes the eigenvalues a self-adjoint  matrix.

  Args:
    matrix: `Tensor` of shape `[N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues of `matrix`. Shape is `[N]`.
  """
  e, _ = gen_linalg_ops.self_adjoint_eig_v2(matrix, compute_v=False, name=name)
  return e
Ejemplo n.º 2
0
def self_adjoint_eigvals(matrix, name=None):
  """Computes the eigenvalues a self-adjoint  matrix.

  Args:
    matrix: `Tensor` of shape `[N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues of `matrix`. Shape is `[N]`.
  """
  e, _ = gen_linalg_ops.self_adjoint_eig_v2(matrix, compute_v=False, name=name)
  return e
Ejemplo n.º 3
0
def self_adjoint_eig(matrix, name=None):
  """Computes the eigen decomposition of a self-adjoint matrix.

  Computes the eigenvalues and eigenvectors of an N-by-N matrix `matrix` such
  that `matrix * v[:,i] = e(i) * v[:,i]`, for i=0...N-1.

  Args:
    matrix: `Tensor` of shape `[N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[N]`.
    v: Eigenvectors. Shape is `[N, N]`. The columns contain the eigenvectors of
      `matrix`.
  """
  e, v = gen_linalg_ops.self_adjoint_eig_v2(matrix, compute_v=True, name=name)
  return e, v
Ejemplo n.º 4
0
def self_adjoint_eig(matrix, name=None):
  """Computes the eigen decomposition of a self-adjoint matrix.

  Computes the eigenvalues and eigenvectors of an N-by-N matrix `matrix` such
  that `matrix * v[:,i] = e(i) * v[:,i]`, for i=0...N-1.

  Args:
    matrix: `Tensor` of shape `[N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[N]`.
    v: Eigenvectors. Shape is `[N, N]`. The columns contain the eigenvectors of
      `matrix`.
  """
  e, v = gen_linalg_ops.self_adjoint_eig_v2(matrix, compute_v=True, name=name)
  return e, v
Ejemplo n.º 5
0
def self_adjoint_eigvals(tensor, name=None):
  """Computes the eigenvalues of one or more self-adjoint matrices.

  Note: If your program backpropagates through this function, you should replace
  it with a call to tf.linalg.eigvalsh (possibly ignoring the second output) to
  avoid computing the eigen decomposition twice. This is because the
  eigenvectors are used to compute the gradient w.r.t. the eigenvalues. See
  _SelfAdjointEigV2Grad in linalg_grad.py.

  Args:
    tensor: `Tensor` of shape `[..., N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[..., N]`. The vector `e[..., :]` contains the `N`
      eigenvalues of `tensor[..., :, :]`.
  """
  e, _ = gen_linalg_ops.self_adjoint_eig_v2(tensor, compute_v=False, name=name)
  return e
Ejemplo n.º 6
0
def self_adjoint_eig(tensor, name=None):
  """Computes the eigen decomposition of a batch of self-adjoint matrices.

  Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices
  in `tensor` such that
  `tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i]`, for i=0...N-1.

  Args:
    tensor: `Tensor` of shape `[..., N, N]`. Only the lower triangular part of
      each inner inner matrix is referenced.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[..., N]`. Sorted in non-decreasing order.
    v: Eigenvectors. Shape is `[..., N, N]`. The columns of the inner most
      matrices contain eigenvectors of the corresponding matrices in `tensor`
  """
  e, v = gen_linalg_ops.self_adjoint_eig_v2(tensor, compute_v=True, name=name)
  return e, v
Ejemplo n.º 7
0
def self_adjoint_eigvals(tensor, name=None):
  """Computes the eigenvalues of one or more self-adjoint matrices.

  Note: If your program backpropagates through this function, you should replace
  it with a call to tf.self_adjoint_eig (possibly ignoring the second output) to
  avoid computing the eigen decomposition twice. This is because the
  eigenvectors are used to compute the gradient w.r.t. the eigenvalues. See
  _SelfAdjointEigV2Grad in linalg_grad.py.

  Args:
    tensor: `Tensor` of shape `[..., N, N]`.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[..., N]`. The vector `e[..., :]` contains the `N`
      eigenvalues of `tensor[..., :, :]`.
  """
  e, _ = gen_linalg_ops.self_adjoint_eig_v2(tensor, compute_v=False, name=name)
  return e
Ejemplo n.º 8
0
def self_adjoint_eig(tensor, name=None):
  """Computes the eigen decomposition of a batch of self-adjoint matrices.

  Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices
  in `tensor` such that
  `tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i]`, for i=0...N-1.

  Args:
    tensor: `Tensor` of shape `[..., N, N]`. Only the lower triangular part of
      each inner inner matrix is referenced.
    name: string, optional name of the operation.

  Returns:
    e: Eigenvalues. Shape is `[..., N]`. Sorted in non-decreasing order.
    v: Eigenvectors. Shape is `[..., N, N]`. The columns of the inner most
      matrices contain eigenvectors of the corresponding matrices in `tensor`
  """
  e, v = gen_linalg_ops.self_adjoint_eig_v2(tensor, compute_v=True, name=name)
  return e, v