Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 5th No.37】为 Paddle 新增 householder_product API #6334

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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