Skip to content

Commit

Permalink
【Hackathon 5th No.37】为 Paddle 新增 householder_product API (#6334)
Browse files Browse the repository at this point in the history
* add householder_product_cn doc

* doc style
  • Loading branch information
cocoshe authored Dec 1, 2023
1 parent db911ab commit e672d09
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/api/paddle/linalg/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ paddle.linalg 目录下包含飞桨框架支持的线性代数相关 API。具
" :ref:`paddle.linalg.qr <cn_api_paddle_linalg_qr>` ", "计算矩阵的正交三角分解(也称 QR 分解)"
" :ref:`paddle.linalg.lu <cn_api_paddle_linalg_lu>` ", "计算矩阵的 LU 分解"
" :ref:`paddle.linalg.lu_unpack <cn_api_paddle_linalg_lu_unpack>` ", "对矩阵的 LU 分解结果进行展开得到各单独矩阵"

" :ref:`paddle.linalg.householder_product <cn_api_paddle_linalg_householder_product>` ", "计算 Householder 矩阵乘积的前 n 列(输入矩阵为 `[*,m,n]` )"

.. _about_solvers:

Expand Down
35 changes: 35 additions & 0 deletions docs/api/paddle/linalg/householder_product_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. _cn_api_paddle_linalg_householder_product:

householder_product
-------------------------------

.. py:function:: paddle.linalg.householder_product(x, tau, name=None)
计算 Householder 矩阵乘积的前 n 列(输入矩阵为 `[*,m,n]` )。


该函数可以从矩阵 `x` (m x n) 得到向量 :math:`\omega_{i}`,其中前 `i-1` 个元素为零,第 i 个元素为 `1`,其余元素元素来自 `x` 的第 i 列。
并且使用向量 `tau` 可以计算 Householder 矩阵乘积的前 n 列。

.. math::
H_i = I_m - \tau_i \omega_i \omega_i^H
参数
::::::::::::

- **x** (Tensor): 形状为 `(*, m, n)` 的张量,其中 * 是零个或多个批量维度。
- **tau** (Tensor): 形状为 `(*, k)` 的张量,其中 * 是零个或多个批量维度。
- **name** (str, 可选): 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。


返回
::::::::::::

- Tensor, dtype 与输入张量相同, QR 分解中的 Q, :MATH:`out = q = H_1H_2H_3 ... H_K`

代码示例
::::::::::

COPY-FROM: paddle.linalg.householder_product

0 comments on commit e672d09

Please sign in to comment.