Householder transform of a vector

float16_t riscv_householder_f16(const float16_t *pSrc, const float16_t threshold, uint32_t blockSize, float16_t *pOut)
float32_t riscv_householder_f32(const float32_t *pSrc, const float32_t threshold, uint32_t blockSize, float32_t *pOut)
float64_t riscv_householder_f64(const float64_t *pSrc, const float64_t threshold, uint32_t blockSize, float64_t *pOut)
group MatrixHouseholder

Computes the Householder transform of a vector x.

The Householder transform of x is a vector v with

\[ v_0 = 1 \]

and a scalar \(\beta\) such that:

\[ P = I - \beta v v^T \]

is an orthogonal matrix and

\[ P x = ||x||_2 e_1 \]

So P is an hyperplane reflection such that the image of x is proportional to \(e_1\).

\(e_1\) is the vector of coordinates:

\[\begin{split} \begin{pmatrix} 1 \\ 0 \\ \vdots \\ \end{pmatrix} \end{split}\]

If x is already proportional to \(e_1\) then the matrix P should be the identity.

Thus, \(\beta\) should be 0 and in this case the vector v can also be null.

But how do we detect that x is already proportional to \(e_1\).

If x

\[\begin{split} x = \begin{pmatrix} x_0 \\ xr \\ \end{pmatrix} \end{split}\]

where \(xr\) is a vector.

The algorithm is computing the norm squared of this vector:

\[ ||xr||^2 \]

and this value is compared to a threshold. If the value is smaller than the threshold, the algorithm is returning 0 for \(\beta\) and the householder vector.

This threshold is an argument of the function.

Default values are provided in the header dsp/matrix_functions.h like for instance DEFAULT_HOUSEHOLDER_THRESHOLD_F32

Functions

float16_t riscv_householder_f16(const float16_t *pSrc, const float16_t threshold, uint32_t blockSize, float16_t *pOut)

Householder transform of a half floating point vector.

Parameters
  • pSrc[in] points to the input vector.

  • threshold[in] norm2 threshold.

  • blockSize[in] dimension of the vector space.

  • pOut[out] points to the output vector.

Returns

beta return the scaling factor beta

float32_t riscv_householder_f32(const float32_t *pSrc, const float32_t threshold, uint32_t blockSize, float32_t *pOut)

Householder transform of a floating point vector.

Parameters
  • pSrc[in] points to the input vector.

  • threshold[in] norm2 threshold.

  • blockSize[in] dimension of the vector space.

  • pOut[out] points to the output vector.

Returns

beta return the scaling factor beta

float64_t riscv_householder_f64(const float64_t *pSrc, const float64_t threshold, uint32_t blockSize, float64_t *pOut)

Householder transform of a double floating point vector.

Parameters
  • pSrc[in] points to the input vector.

  • threshold[in] norm2 threshold.

  • blockSize[in] dimension of the vector space.

  • pOut[out] points to the output vector.

Returns

beta return the scaling factor beta