news 2026/6/9 21:17:56

Hadamard product (阿达玛乘积)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Hadamard product (阿达玛乘积)

Hadamard product {阿达玛乘积}

  • 1. Definition
  • 2. Properties
  • 3. In programming languages
  • References

In mathematics, theHadamard product(also known as theelement-wise product,entrywise productorSchur product) is a binary operation that takes in two matrices of the same dimensions and returns a matrix of the multiplied corresponding elements.
在数学中,阿达玛乘积 (Hadamard product,又译哈达玛乘积),又名舒尔乘积 (Schur product) 或逐项乘积 (entrywise product),是一个二元运算,其输入为两个相同形状的矩阵,输出是具有同样形状的、各个位置的元素等于两个输入矩阵相同位置元素的乘积的矩阵。

entry ['entri] n. 记录;词条;登录;录入

The Hadamard product operates on identically shaped matrices and produces a third matrix of the same dimensions.

1. Definition

For two matricesA \mathbf {A}AandB \mathbf {B}Bof the same dimensionm × n m \times nm×n, the Hadamard productA ⊙ B \mathbf {A} \odot \mathbf {B}AB(sometimesA ∘ B \mathbf {A} \circ \mathbf {B}AB) is a matrix of the same dimension as the operands, with elements given by

( A ⊙ B ) i j = ( A ) i j ( B ) i j . (\mathbf {A} \odot \mathbf {B})_{ij} = (\mathbf {A})_{ij} (\mathbf {B})_{ij}.(AB)ij=(A)ij(B)ij.

For matrices of different dimensions (m × n m \times nm×nandp × q p \times qp×q, wherem ≠ p m \neq pm=porn ≠ q n \neq qn=q), the Hadamard product is undefined.

3 × 3 3\times 33×3矩阵A \mathbf {A}A3 × 3 3\times 33×3矩阵B \mathbf {B}B的阿达玛乘积为:

[ a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33 ] ∘ [ b 11 b 12 b 13 b 21 b 22 b 23 b 31 b 32 b 33 ] = [ a 11 b 11 a 12 b 12 a 13 b 13 a 21 b 21 a 22 b 22 a 23 b 23 a 31 b 31 a 32 b 32 a 33 b 33 ] . \begin{bmatrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{bmatrix} \circ \begin{bmatrix} b_{11} & b_{12} & b_{13}\\ b_{21} & b_{22} & b_{23}\\ b_{31} & b_{32} & b_{33} \end{bmatrix} = \begin{bmatrix} a_{11}\, b_{11} & a_{12}\, b_{12} & a_{13}\, b_{13}\\ a_{21}\, b_{21} & a_{22}\, b_{22} & a_{23}\, b_{23}\\ a_{31}\, b_{31} & a_{32}\, b_{32} & a_{33}\, b_{33} \end{bmatrix}.a11a21a31a12a22a32a13a23a33b11b21b31b12b22b32b13b23b33=a11b11a21b21a31b31a12b12a22b22a32b32a13b13a23b23a33b33.

2. Properties

  • The Hadamard product is commutative (when working with a commutative ring), associative, and distributive over addition.
    阿达玛乘积满足交换律 (当使用交换环时), 结合律和对加法的分配律

That is, ifA \mathbf {A}A,B \mathbf {B}B, andC \mathbf {C}Care matrices of the same size, andk kkis a scalar:

A ⊙ B = B ⊙ A A ⊙ ( B ⊙ C ) = ( A ⊙ B ) ⊙ C A ⊙ ( B + C ) = A ⊙ B + A ⊙ C ( k A ) ⊙ B = A ⊙ ( k B ) = k ( A ⊙ B ) A ⊙ 0 = 0 ⊙ A = 0 \begin{align} A \odot B &= B \odot A \\ A \odot (B \odot C) &= (A \odot B) \odot C \\ A \odot (B + C) &= A \odot B + A \odot C \\ (kA) \odot B &= A \odot (kB) = k(A \odot B) \\ A \odot 0 &= 0 \odot A = 0 \end{align}ABA(BC)A(B+C)(kA)BA0=BA=(AB)C=AB+AC=A(kB)=k(AB)=0A=0

3. In programming languages

The NumPy numerical library interpretsa*bora.multiply(b)as the Hadamard product, and usesa@bora.matmul(b)for the matrix product.

References

[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/
[2] 动手学深度学习, https://zh.d2l.ai/index.html
[3] Deep Learning Tutorials, https://neuralthreads.medium.com/i-was-not-satisfied-by-any-deep-learning-tutorials-online-37c5e9f4bea1
[4] Gradient boosting performs gradient descent, https://explained.ai/gradient-boosting/descent.html
[5] Matrix calculus, https://en.wikipedia.org/wiki/Matrix_calculus
[6] Artificial Inteligence, https://leonardoaraujosantos.gitbook.io/artificial-inteligence
[7] Hadamard product, https://en.wikipedia.org/wiki/Hadamard_product_(matrices)

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/30 9:01:49

零基础学习HTML颜色代码:从<PURPLE>开始

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 设计一个交互式学习工具&#xff0c;帮助新手理解和使用HTML颜色代码&#xff08;如<FONT COLOR PURPLE>&#xff09;。工具应包含示例代码、实时编辑器和学习测验&#xff…

作者头像 李华
网站建设 2026/6/5 15:41:28

告别手动维护:requirements.txt自动化管理全攻略

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 构建一个VS Code插件&#xff0c;实时监控Python项目的依赖变化&#xff0c;自动更新requirements.txt。功能包括&#xff1a;1) 文件保存时自动扫描 2) 新旧版本差异对比 3) 一键…

作者头像 李华
网站建设 2026/6/9 21:25:37

MobaXterm高效技巧:比传统终端快3倍的操作方法

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 开发一个MobaXterm效率增强包&#xff0c;包含&#xff1a;1. 一键式常用命令集合&#xff1b;2. 智能会话管理器&#xff1b;3. 自动化任务编排工具&#xff1b;4. 自定义快捷键配…

作者头像 李华
网站建设 2026/6/10 2:23:02

新手必看:消息推送配置失败VERIFY TOKEN FAIL详解

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 创建一个新手友好的教学项目&#xff0c;逐步展示消息推送配置的正确方法。包含图文教程、常见错误示例&#xff08;特别是VERIFY TOKEN FAIL&#xff09;和互动式修复练习。要求界…

作者头像 李华
网站建设 2026/5/30 11:17:15

零基础入门:如何使用AI工具一键清理BAT代码

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 开发一个简单易用的BAT脚本清理工具&#xff0c;适合新手用户。工具应提供逐步引导功能&#xff0c;用户只需上传BAT文件&#xff0c;工具自动完成清理并给出简单易懂的优化说明。…

作者头像 李华
网站建设 2026/5/29 23:56:17

传统VS AI:JSON对比开发效率提升300%的秘密

快速体验 打开 InsCode(快马)平台 https://www.inscode.net输入框内输入如下内容&#xff1a; 开发一个高效的JSON差异分析工具&#xff0c;要求&#xff1a;1. 使用优化的差异算法确保大文件处理性能&#xff1b;2. 实现增量对比功能&#xff0c;只重新计算变更部分&#xf…

作者头像 李华