What does operator “dot” (.) mean?
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.^Bis the matrix with elements
A(i,j)to theB(i,j)power.AandBmust have the same size, unless one of them is a scalar.
C.f.
- "Matrix and array arithmetic": http://www.mathworks.de/help/techdoc/ref/arithmeticoperators.html
- "Pointwise": http://en.wikipedia.org/wiki/Pointwise
- "Element-Wise Operations": http://www.glue.umd.edu/afs/glue.umd.edu/system/info/olh/Numerical/Matlab_Matrix_Manipulation_Software/Matrix_Vector_Operations/elementwise
¹) Hence the dot.
What does operator “dot” (.) mean?的更多相关文章
- 特殊的ASCII码对应的字符
Special Characters " " " quotation mark u+0022 ISOnum p:before { content:"\0022& ...
- 【HTML】字符(Glyphs)收集
Special Characters " " " quotation mark u+0022 ISOnum p:before { content:"\0022& ...
- hdu 4773 Problem of Apollonius
莫名其妙就AC了-- 圆的反演-- 神马是反演? 快去恶补奥数-- #include<iostream> #include<map> #include<string> ...
- 图论(KM算法,脑洞题):HNOI 2014 画框(frame)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABPoAAANFCAIAAABtIwXVAAAgAElEQVR4nOydeVxTV/r/n9ertaJEC4
- WAJUEJI which home strong!
算法:搜索+优先队列 描述 在一个山沟里,姐弟俩同时考上了大学.但由于家里拮据,所以这并不是什么好消息.父亲对孩子说:我就是砸锅卖铁也要把你们姐俩供出来. 当时的姐姐已经决定放弃上学的机会. 没想到第 ...
- Ignatius and the Princess I
算法:搜索+优先队列+(递归输出结果) The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has ...
- c++ 17介绍
作者:hearts zh链接:https://www.zhihu.com/question/32222337/answer/55238928来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商 ...
- csu 1503: 点弧之间的距离-湖南省第十届大学生计算机程序设计大赛
这是--比量p并用交点连接中心不上弧.在于:它至p距离.是不是p与端点之间的最短距离 #include<iostream> #include<map> #include< ...
- 看到了必须要Mark啊,最全的编程中英文词汇对照汇总(里面有好几个版本的,每个版本从a到d的顺序排列)
java: 第一章: JDK(Java Development Kit) java开发工具包 JVM(Java Virtual Machine) java虚拟机 Javac 编译命令 java ...
随机推荐
- .Net程序员 初学Ubuntu ,配置Nignix
1.安装VM虚拟机 2.升级VI编辑器 3.安装Nginx 4.测试localhost 5.编辑配置文件 仅仅用了记录一个过程,不会太详细 1.安装虚拟机,网上一大片,不是特别难 2.为什么要升级VI ...
- 【Vue】谈Vue的依赖追踪系统 ——搞懂methods watch和compute的区别和联系
从作用机制和性质上看待methods,watch和computed的关系 图片标题[原创]:<他三个是啥子关系呢?> 首先要说,methods,watch和computed都是以函数为基础 ...
- 大叔学ML第五:逻辑回归
目录 基本形式 代价函数 用梯度下降法求\(\vec\theta\) 扩展 基本形式 逻辑回归是最常用的分类模型,在线性回归基础之上扩展而来,是一种广义线性回归.下面举例说明什么是逻辑回归:假设我们有 ...
- redis主从架构,分片集群详解
写在前面:这篇笔记有点长,如果你认真看完,收获会不少,如果你只是忘记了相关命令,请翻到末尾. redis的简单介绍: 一个提供多种数据类类型储存,整个系统都在内存中运行的, 定期通过异步的方式把数据刷 ...
- Android JNI 学习(六):Object Operations Api
一.AllocObject jobjectAllocObject(JNIEnv *env, jclass clazz); 分配新 Java 对象而不调用该对象的任何构造函数.返回该对象的引用. cla ...
- 吴恩达机器学习笔记47-K均值算法的优化目标、随机初始化与聚类数量的选择(Optimization Objective & Random Initialization & Choosing the Number of Clusters of K-Means Algorithm)
一.K均值算法的优化目标 K-均值最小化问题,是要最小化所有的数据点与其所关联的聚类中心点之间的距离之和,因此 K-均值的代价函数(又称畸变函数 Distortion function)为: 其中
- Linux的 Shell 理解和使用
Shell为命令解释器,把用户命令解释为内核可识别的机器语言,然后翻译命令结果给用户,其也是一个强大的编程语言,是解释执行的脚本语言,无编译,与python机制基本相同. Shell内部可以直接调用L ...
- python不同开根号速度对比
import time import math import numpy as np def timeit1(): s = time.time() for i in range(750000): z= ...
- npm无响应处理办法
方法一:使用cnpm 1. 安装 `npm install cnpm -g` 2.设置使用淘宝镜像源 `npm install cnpm -g --registry=https://registry. ...
- ajax实现文档导出及下载
做导出一直遇到个问题就是不能用ajax实现一步导出文档,即导出加下载.今天突然想到可以分开来做就上网搜了下,发现一篇比较不错的文章(http://www.cnblogs.com/zj0208/p/59 ...