运算符“dot"是什么意思(.) 意思? [英] What does operator "dot" (.) mean?

查看:102
本文介绍了运算符“dot"是什么意思(.) 意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定代码:

 A = [1 2 3; 3 2 1]
 B = A.^2

输出:

B =

     1     4     9
     9     4     1

但是如果我这样做:B = A^2

输出是:

Error using  ^ 
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.

运算符 . 究竟做了什么?

What does the operator . do exactly ?

推荐答案

点本身不是运算符,.^ 是.

The dot itself is not an operator, .^ is.

.^ 是 pointwise¹(即元素方面)幂,因为 .*逐点产品.

The .^ is a pointwise¹ (i.e. element-wise) power, as .* is the pointwise product.

.^阵列功率.A.^B 是元素 A(i,j)B(i,j) 次幂的矩阵.AB 的大小必须相同或兼容.

.^ Array power. A.^B is the matrix with elements A(i,j) to the B(i,j) power. The sizes of A and B must be the same or be compatible.

C.f.

¹) 因此点.

这篇关于运算符“dot"是什么意思(.) 意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆