vectorization - How are the matrix values calculated in Octave when we divide a scalar with a vector?
问题描述
I am starting to use Octave and I am trying to understand how is the underlying calculation done for dividing a Scalar by vector ?
I am able to understand how ./ is operating to give us the results - dividing 1 by every element of the matrix column. However, I am not able to get my head around how we get the values in the second case ? 1 / (1 + a)
Example :
g = 1 ./ (1 + a)
g =
0.50000
0.25000
0.20000
>> g = 1 / (1 + a)
g =
0.044444 0.088889 0.111111
解决方案
当您将 1 除以向量时,它会得到一个向量,当在左侧乘以第一个向量时,该向量会产生 1。从这个意义上说,它是向量的一种“逆”,尽管它只是单向逆。在您的示例中:
>> (1/(1+a))*(1+a)
ans = 1
>> (1+a)*(1/(1+a))
ans =
0.088889 0.177778 0.222222
0.177778 0.355556 0.444444
0.222222 0.444444 0.555556
可以说1/(1+a)
是 的左逆1+a
。这也可以解释为什么向量的维度会被转置。另一种说法:给定一个向量v
,是向量方程1/v
的解 ( ) 。w
w*v=1
推荐阅读
- python - 如何访问列表中对象的特定属性,以及基于这些属性操作列表?
- sql - 灵活的运行窗口来计算时间范围内的条目
- d3.js - 使用交叉过滤器减少数据点的数量
- javascript - 在 ASP.NET 中使用 JavaScript 防止退格键转到上一页
- powershell - “New-Object WindowsPrincipal([WindowsIdentity]::GetCurrent())”和“[WindowsPrincipal] [WindowsIdentity]::GetCurrent()”之间的区别
- javascript - 等待承诺解决后再继续
- python-3.x - 如何修复这个 python 代码错误,我正在使用 jupyter notebook
- ruby - 是否有日志可以查看来自 bundler 的 git 命令?
- c# - C# | jstedfast/MimeKit | 带有 DKIM 设置的 Office 365 连接器
- arrays - 连接数组中的字符串