MatrixSolveLs

public final class MatrixSolveLs

Solves one or more linear least-squares problems.

`matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions form real or complex matrices of size `[M, N]`. `Rhs` is a tensor of the same type as `matrix` and shape `[..., M, K]`. The output is a tensor shape `[..., N, K]` where each output matrix solves each of the equations `matrix[..., :, :]` * `output[..., :, :]` = `rhs[..., :, :]` in the least squares sense.

We use the following notation for (complex) matrix and right-hand sides in the batch:

`matrix`=\\(A \in \mathbb{C}^{m \times n}\\), `rhs`=\\(B \in \mathbb{C}^{m \times k}\\), `output`=\\(X \in \mathbb{C}^{n \times k}\\), `l2_regularizer`=\\(\lambda \in \mathbb{R}\\).

If `fast` is `True`, then the solution is computed by solving the normal equations using Cholesky decomposition. Specifically, if \\(m \ge n\\) then \\(X = (A^H A + \lambda I)^{-1} A^H B\\), which solves the least-squares problem \\(X = \mathrm{argmin}_{Z \in \Re^{n \times k} } ||A Z - B||_F^2 + \lambda ||Z||_F^2\\). If \\(m \lt n\\) then `output` is computed as \\(X = A^H (A A^H + \lambda I)^{-1} B\\), which (for \\(\lambda = 0\\)) is the minimum-norm solution to the under-determined linear system, i.e. \\(X = \mathrm{argmin}_{Z \in \mathbb{C}^{n \times k} } ||Z||_F^2 \\), subject to \\(A Z = B\\). Notice that the fast path is only numerically stable when \\(A\\) is numerically full rank and has a condition number \\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon_{mach} } }\\) or \\(\lambda\\) is sufficiently large.

If `fast` is `False` an algorithm based on the numerically robust complete orthogonal decomposition is used. This computes the minimum-norm least-squares solution, even when \\(A\\) is rank deficient. This path is typically 6-7 times slower than the fast path. If `fast` is `False` then `l2_regularizer` is ignored.

Nested Classes

class MatrixSolveLs.Options Optional attributes for MatrixSolveLs  

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output<T>
asOutput()
Returns the symbolic handle of the tensor.
static <T extends TType> MatrixSolveLs<T>
create(Scope scope, Operand<T> matrix, Operand<T> rhs, Operand<TFloat64> l2Regularizer, Options... options)
Factory method to create a class wrapping a new MatrixSolveLs operation.
static MatrixSolveLs.Options
fast(Boolean fast)
Output<T>
output()
Shape is `[..., N, K]`.

Inherited Methods

org.tensorflow.op.RawOp
final boolean
equals(Object obj)
final int
Operation
op()
Return this unit of computation as a single Operation.
final String
boolean
equals(Object arg0)
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
org.tensorflow.op.Op
abstract ExecutionEnvironment
env()
Return the execution environment this op was created in.
abstract Operation
op()
Return this unit of computation as a single Operation.
org.tensorflow.Operand
abstract Output<T>
asOutput()
Returns the symbolic handle of the tensor.
abstract T
asTensor()
Returns the tensor at this operand.
abstract Shape
shape()
Returns the (possibly partially known) shape of the tensor referred to by the Output of this operand.
abstract Class<T>
type()
Returns the tensor type of this operand
org.tensorflow.ndarray.Shaped
abstract int
rank()
abstract Shape
shape()
abstract long
size()
Computes and returns the total size of this container, in number of values.

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "MatrixSolveLs"

Public Methods

public Output<T> asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static MatrixSolveLs<T> create (Scope scope, Operand<T> matrix, Operand<T> rhs, Operand<TFloat64> l2Regularizer, Options... options)

Factory method to create a class wrapping a new MatrixSolveLs operation.

Parameters
scope current scope
matrix Shape is `[..., M, N]`.
rhs Shape is `[..., M, K]`.
l2Regularizer Scalar tensor.

options carries optional attributes values
Returns
  • a new instance of MatrixSolveLs

public static MatrixSolveLs.Options fast (Boolean fast)

public Output<T> output ()

Shape is `[..., N, K]`.