/// <amd-module name="@tensorflow/tfjs-core/dist/ops/linalg/qr" />
|
import { Tensor } from '../../tensor';
|
/**
|
* Compute QR decomposition of m-by-n matrix using Householder transformation.
|
*
|
* Implementation based on
|
* [http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf]
|
* (http://www.cs.cornell.edu/~bindel/class/cs6210-f09/lec18.pdf)
|
*
|
* ```js
|
* const a = tf.tensor2d([[1, 2], [3, 4]]);
|
* let [q, r] = tf.linalg.qr(a);
|
* console.log('Q');
|
* q.print();
|
* console.log('R');
|
* r.print();
|
* console.log('Orthogonalized');
|
* q.dot(q.transpose()).print() // should be nearly the identity matrix.
|
* console.log('Reconstructed');
|
* q.dot(r).print(); // should be nearly [[1, 2], [3, 4]];
|
* ```
|
*
|
* @param x The `tf.Tensor` to be QR-decomposed. Must have rank >= 2. Suppose
|
* it has the shape `[..., M, N]`.
|
* @param fullMatrices An optional boolean parameter. Defaults to `false`.
|
* If `true`, compute full-sized `Q`. If `false` (the default),
|
* compute only the leading N columns of `Q` and `R`.
|
* @returns An `Array` of two `tf.Tensor`s: `[Q, R]`. `Q` is a unitary matrix,
|
* i.e., its columns all have unit norm and are mutually orthogonal.
|
* If `M >= N`,
|
* If `fullMatrices` is `false` (default),
|
* - `Q` has a shape of `[..., M, N]`,
|
* - `R` has a shape of `[..., N, N]`.
|
* If `fullMatrices` is `true` (default),
|
* - `Q` has a shape of `[..., M, M]`,
|
* - `R` has a shape of `[..., M, N]`.
|
* If `M < N`,
|
* - `Q` has a shape of `[..., M, M]`,
|
* - `R` has a shape of `[..., M, N]`.
|
* @throws If the rank of `x` is less than 2.
|
*
|
* @doc {heading:'Operations',
|
* subheading:'Linear Algebra',
|
* namespace:'linalg'}
|
*/
|
declare function qr_(x: Tensor, fullMatrices?: boolean): [Tensor, Tensor];
|
export declare const qr: typeof qr_;
|
export {};
|