UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

189 lines (188 loc) 7.85 kB
import { Tensors3 } from './tensors3'; /** * An array of eigen-decomposition of tensors for 3D image processing. * Each tensor is a symmetric positive semi-definite 3x3 matrix. * <pre> * | a11 a12 a13 | * A = | a12 a22 a23 | * | a13 a23 a33 | * </pre> * Such tensors can be used to parametrize anisotropic image processing. * <p> * The eigen-decomposition of the matrix A is * <pre> * A = au * u * u' + av * v * v' + aw * w * w' * = (au - av) * u * u' + (aw - av) * w * w' + av * I * </pre> * where, u, v, and w are orthogonal unit eigenvectors of A. (The notation * u' denotes the transpose of u.) The outer products of eigenvectors are * scaled by the non-negative eigenvalues au, av and aw. The second * equation exploits the identity u * u' + v * v' + w * w' = I, and makes * apparent the redundancy of the vector v. * <p> * Only the 1st and 2nd components of the eigenvectors u and w are stored. * Except for a sign, the 3rd components may be computed from the 1st and * 2nd. Because the tensors are independent of the choice of the sign, the * eigenvectors u and w are stored with an implied non-negative 3rd * component. * <p> * Storage may be further reduced by compression, whereby eigenvalues and * eigenvectors are quantized. */ export declare class EigenTensors3 implements Tensors3 { private static readonly AS_SET; private static readonly AS_GET; private _uss; private readonly _n1; private readonly _n2; private readonly _n3; private _as; private _au; private _aw; private _u1; private _u2; private _w1; private _w2; private static c3; /** * Constructs tensors for specified array dimensions. * <p> * All eigenvalues and eigenvectors u and w are not set and are initially * zero. * @param n1 number of tensors in 1st dimension. * @param n2 number of tensors in 2nd dimension. * @param n3 number of tensors in 3rd dimension. */ constructor(n1: number, n2: number, n3: number); /** * Gets tensor elements for specified indices. * <p> * Note: If passing in an array, its values are edited in-place and * nothing is returned. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param a the array { a11, a12, a13, a22, a23, a33 } of tensor elements. * @returns the array { a11, a12, a13, a22, a23, a33 } of tensor elements. */ getTensor(i1: number, i2: number, i3: number, a?: number[]): void | number[]; /** * Sets the eigenvalues for the tensor with specified indices. * @param i1 index for the 1st dimension. * @param i2 index for the 2nd dimension. * @param i3 index for the 3rd dimension. * @param au eigenvalue au. * @param av eigenvalue av. * @param aw eigenvalue aw. */ setEigenvalues(i1: number, i2: number, i3: number, au: number, av: number, aw: number): void; /** * Gets eigenvalues for the tensor with specified indices. * <p> * Note: If passing in an array, its values are edited in-place and * nothing is returned. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param a the array { au, av, aw } of eigenvalues. * @returns the array { au, av, aw } of eigenvalues. */ getEigenvalues(i1: number, i2: number, i3: number, a?: number[]): void | number[]; /** * Gets eigenvalues for all tensors. * @param au array of eigenvalues au. * @param av array of eigenvalues av. * @param aw array of eigenvalues aw. */ getAllEigenvalues(au: number[][][], av: number[][][], aw: number[][][]): void; /** * Sets the eigenvector u for the tensor with specified indices. * <p> * The specified vector is assumed to have length one. If the 3rd * component is negative, this method stores the negative of the * specified vector, so that the 3rd component is positive. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param u1 1st component of u. * @param u2 2nd component of u. * @param u3 3rd component of u. */ setEigenvectorU(i1: number, i2: number, i3: number, u1: number, u2: number, u3: number): void; /** * Gets the eigenvector u for the tensor with specified indices. * <p> * Note: If passing in an array, its values are edited in-place and * nothing is returned. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param u array { u1, u2, u3 } of eigenvector components. */ getEigenvectorU(i1: number, i2: number, i3: number, u?: number[]): void | number[]; /** * Sets the eigenvector w for the tensor with specified indices. * <p> * The specified vector is assumed to have length one. If the 3rd * component is negative, this method stores the negative of the * specified vector, so that the 3rd component is positive. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param w1 1st component of w. * @param w2 2nd component of w. * @param w3 3rd component of w. */ setEigenvectorW(i1: number, i2: number, i3: number, w1: number, w2: number, w3: number): void; /** * Gets the eigenvector w for the tensor with specified indices. * <p> * Note: If passing in an array, its values are edited in-place and * nothing is returned. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param w array { w1, w2, w3 } of eigenvector components. */ getEigenvectorW(i1: number, i2: number, i3: number, w?: number[]): void | number[]; /** * Gets the eigenvector v for the tensor with specified indices. * <p> * Note: If passing in an array, its values are edited in-place and * nothing is returned. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param v array { v1, v2, v3 } of eigenvector components. */ getEigenvectorV(i1: number, i2: number, i3: number, v?: number[]): void | number[]; /** * Sets tensor elements for specified indices. * <p> * This method first computes an eigen-decomposition of the specified * tensor, and then stores the computed eigenvectors and eigenvalues. * The eigenvalues are ordered such that au &gt;= av &gt;= aw &gt;= 0. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @param i3 index for 3rd dimension. * @param a array { a11, a12, a13, a22, a23, a33 } of tensor elements. */ setTensor(i1: number, i2: number, i3: number, a: number): any; /** * Sets tensor elements for specified indices. * <p> * This method first computes an eigen-decomposition of the specified * tensor, and then stores the computed eigenvectors and eigenvalues. * The eigenvalues are ordered such that au &gt;= av &gt;= aw &gt;= 0. * @param i1 index for the 1st dimension. * @param i2 index for the 2nd dimension. * @param i3 index for the 3rd dimension. * @param a11 tensor element a11. * @param a12 tensor element a12. * @param a13 tensor element a13. * @param a22 tensor element a22. * @param a23 tensor element a23. * @param a33 tensor element a33. */ setTensor(i1: number, i2: number, i3: number, a11: number, a12: number, a13: number, a22: number, a23: number, a33: number): any; }