Question:

Given the code :

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

The output :

B =

     1     4     9
9 4 1

But if I do this : B = A^2

The output is :

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

What does the operator . do exactly ?

Answer:

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

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

.^ Array power. A.^B is the matrix with elements
A(i,j) to the B(i,j) power. A and B must have the same size, unless one of them is a scalar.

C.f.

¹) Hence the dot.

What does operator “dot” (.) mean?的更多相关文章

  1. 特殊的ASCII码对应的字符

    Special Characters " " " quotation mark u+0022 ISOnum p:before { content:"\0022& ...

  2. 【HTML】字符(Glyphs)收集

    Special Characters " " " quotation mark u+0022 ISOnum p:before { content:"\0022& ...

  3. hdu 4773 Problem of Apollonius

    莫名其妙就AC了-- 圆的反演-- 神马是反演? 快去恶补奥数-- #include<iostream> #include<map> #include<string> ...

  4. 图论(KM算法,脑洞题):HNOI 2014 画框(frame)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABPoAAANFCAIAAABtIwXVAAAgAElEQVR4nOydeVxTV/r/n9ertaJEC4

  5. WAJUEJI which home strong!

    算法:搜索+优先队列 描述 在一个山沟里,姐弟俩同时考上了大学.但由于家里拮据,所以这并不是什么好消息.父亲对孩子说:我就是砸锅卖铁也要把你们姐俩供出来. 当时的姐姐已经决定放弃上学的机会. 没想到第 ...

  6. Ignatius and the Princess I

    算法:搜索+优先队列+(递归输出结果) The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has ...

  7. c++ 17介绍

    作者:hearts zh链接:https://www.zhihu.com/question/32222337/answer/55238928来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商 ...

  8. csu 1503: 点弧之间的距离-湖南省第十届大学生计算机程序设计大赛

    这是--比量p并用交点连接中心不上弧.在于:它至p距离.是不是p与端点之间的最短距离 #include<iostream> #include<map> #include< ...

  9. 看到了必须要Mark啊,最全的编程中英文词汇对照汇总(里面有好几个版本的,每个版本从a到d的顺序排列)

    java:  第一章: JDK(Java Development Kit) java开发工具包 JVM(Java Virtual Machine) java虚拟机 Javac  编译命令 java   ...

随机推荐

  1. Bitmap too larget to be uploaded into a texture的解决方法

    Bitmap too larget to be uploaded into a texture的解决方法 问题描述 使用canvas.drawBitmap()系列方法时,抛出错误Bitmap too ...

  2. Tomcat 的 ManagerApp 简单使用

    当启动Tomcat的时候,直接访问http://localhost:8080会直接进入下面页面,原因是Tomcat的默认项目是部署在webapps目录下的ROOT目录下的,这个manager项目就在R ...

  3. Mybatis优缺点

    优点:SQL写在XML中,便于统一管理和优化 提供映射标签,支持对象和数据库的orm字段关系映射 可以对SQL进行优化      缺点: SQL工作量大 mybagtis移植姓不好 不支持级联

  4. 使用opencv库编译代码并运行

    安装Opencv之后,首先要写一份代码测试一下是否ok. 本文代码图像边沿检测的: #include <opencv2/highgui/highgui.hpp> #include < ...

  5. Source Qualifter组件中sqlquery过长导致截取

    问题:Source Qualifter组件中sqlquery过长导致截取原因:Source Qualifter组件中sqlquery可以接受的最长字符数是32767个字符,超过这个数字会导致截取解决方 ...

  6. (转)[Python 网络编程] makefile (三)

    socket.makefile(mode ='r',buffering = None,*,encoding = None,errors = None,newline = None )返回一个与套接字相 ...

  7. springBoot(4)---热部署,配置文件使用

    热部署,配置文件使用 一.热加载 spring为开发者提供了一个名为spring-boot-devtools的模块来使Spring Boot应用支持热部署,提高开发者的开发效率,无需手动重启Sprin ...

  8. Azure认知服务之Face API上手体验

    Azure认知服务:Face API Face API是Azure认知服务之一,Face API有两个主要功能: 人脸检测 Face API可在图像中以高精度人脸位置检测多达64个人脸.图像可以通过文 ...

  9. Android--多线程之Looper

    前言 上一篇博客讲解了Handler实现线程间通信,这篇博客讲解一下Handler运行的原理,其中涉及到MessageQueue.Looper.简要来讲,Handler会把一个线程消息发送给当前线程的 ...

  10. 剑指offer例题分享--7

    前言:继续前面的分享... 面试题31: 代码如下: #include<iostream> #include<limits.h> using namespace std; bo ...