C++_Eigen函数库用法笔记——Block Operations
- Using block operations
- rvalue, i.e. it was only read from
- lvalues, i.e. you can assign to a block
- Columns and rows
- Corner-related operations
- Block operations for vectors
- Using block operations
Block operation | Version constructing a dynamic-size block expression |
Version constructing a fixed-size block expression |
---|---|---|
Block of size (p,q) , starting at (i,j) |
matrix.block(i,j,p,q);
|
matrix.block<p,q>(i,j);
|
- rvalue, i.e. it was only read from
6 7
10 11
Block of size 1x1
1
Block of size 2x2
1 2
5 6
Block of size 3x3
1 2 3
5 6 7
9 10 11
- lvalues, i.e. you can assign to a block
0.6 0.6 0.6 0.6
0.6 0.6 0.6 0.6
0.6 0.6 0.6 0.6
0.6 0.6 0.6 0.6
Here is now a with m copied into its central 2x2 block:
0.6 0.6 0.6 0.6
0.6 1 2 0.6
0.6 3 4 0.6
0.6 0.6 0.6 0.6
Here is now a with bottom-right 2x3 block copied into top-left 2x2 block:
3 4 0.6 0.6
0.6 0.6 0.6 0.6
0.6 3 4 0.6
0.6 0.6 0.6 0.6
4 5 6
7 8 9
2nd Row: 4 5 6
After adding 3 times the first column into the third column, the matrix m is:
1 2 6
4 5 18
7 8 30
- Corner-related operations
Block operation | Version constructing a dynamic-size block expression |
Version constructing a fixed-size block expression |
---|---|---|
Top-left p by q block * |
matrix.topLeftCorner(p,q);
|
matrix.topLeftCorner<p,q>();
|
Bottom-left p by q block * |
matrix.bottomLeftCorner(p,q);
|
matrix.bottomLeftCorner<p,q>();
|
Top-right p by q block * |
matrix.topRightCorner(p,q);
|
matrix.topRightCorner<p,q>();
|
Bottom-right p by q block * |
matrix.bottomRightCorner(p,q);
|
matrix.bottomRightCorner<p,q>();
|
Block containing the first q rows * |
matrix.topRows(q);
|
matrix.topRows<q>();
|
Block containing the last q rows * |
matrix.bottomRows(q);
|
matrix.bottomRows<q>();
|
Block containing the first p columns * |
matrix.leftCols(p);
|
matrix.leftCols<p>();
|
Block containing the last q columns * |
matrix.rightCols(q);
|
matrix.rightCols<q>();
|
1 2
5 6
9 10
13 14
m.bottomRows<2>() =
9 10 11 12
13 14 15 16
After assignment, m =
8 12 16 4
5 6 7 820:37:13
9 10 11 12
13 14 15 16
- Block operations for vectors
Block operation | Version constructing a dynamic-size block expression |
Version constructing a fixed-size block expression |
---|---|---|
Block containing the first n elements * |
vector.head(n);
|
vector.head<n>();
|
Block containing the last n elements * |
vector.tail(n);
|
vector.tail<n>();
|
Block containing n elements, starting at position i * |
vector.segment(i,n);
|
vector.segment<n>(i);
|
1
2
3
v.tail<3>() =
4
5
6
after 'v.segment(1,4) *= 2', v =
1
4
6
8
10
6
C++_Eigen函数库用法笔记——Block Operations的更多相关文章
- C++_Eigen函数库用法笔记——The Array class and Coefficient-wise operations
The advantages of Array Addition and subtraction Array multiplication abs() & sqrt() Converting ...
- C++_Eigen函数库用法笔记——Advanced Initialization
The comma initializer a simple example join and block initialize join two row vectors together ini ...
- C++_Eigen函数库用法笔记——Matrix and Vector Arithmetic
Addition and subtraction Scalar multiplication and division Transposition Matrix-matrix and matrix-v ...
- PHP中正则替换函数preg_replace用法笔记
今天应老板的需求,需要将不是我们的页面修改一个链接,用js+iframe应该也能实现,但是我想尝试一下php实现方法. 首先你得先把别人的页面download到你的php中,实现方法可以用curl, ...
- 菜鸟Python学习笔记第一天:关于一些函数库的使用
2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...
- 转: ES6异步编程: co函数库的含义与用法
转: ES6异步编程: co函数库的含义与用法 co 函数库是著名程序员 TJ Holowaychuk 于2013年6月发布的一个小工具,用于 Generator 函数的自动执行. 比如,有一个 Ge ...
- makefile笔记10 - makefile 函数库文件
函数库文件也就是对 Object 文件(程序编译的中间文件)的打包文件.在 Unix 下,一般是由命令"ar"来完成打包工作. 一.函数库文件的成员 一个函数库文件由多个文件组成. ...
- OpenCV 学习笔记03 boundingRect、minAreaRect、minEnclosingCircle、boxPoints、int0、circle、rectangle函数的用法
函数中的代码是部分代码,详细代码在最后 1 cv2.boundingRect 作用:矩形边框(boundingRect),用于计算图像一系列点的外部矩形边界. cv2.boundingRect(arr ...
- python3.4学习笔记(二十) python strip()函数 去空格\n\r\t函数的用法
python3.4学习笔记(二十) python strip()函数 去空格\n\r\t函数的用法 在Python中字符串处理函数里有三个去空格(包括'\n', '\r', '\t', ' ')的函数 ...
随机推荐
- sqlalchemy 的 raw sql 方式使用示例
#获取数据库 from sqlalchemy import create_engine db = create_engine("sqlite:///:memory:", echo= ...
- Xilinx命名规则
xilinx公司的FPGA种类繁多,知道了命名规则,看起来应该会舒服很多. 1.xilinx的FPGA命名规则 Xilinx的ug112第一章中介绍了Xilinx公司的FPGA命名规则.一般而言,大的 ...
- EF实体框架之CodeFirst四
在EF实体框架之CodeFirst二中也提到数据库里面一般包括表.列.约束.主外键.级联操作.实体关系(E-R图).存储过程.视图.锁.事务.数据库结构更新等.前面几篇博客把表.存储过程.视图这些算是 ...
- 小白学习mysql之存储过程的优劣分析以及接入控制
存储过程的优劣 存储过程是一组实现特定功能的SQL语句集合,存储过程一经编译便存储在了服务器上,可以通过调用存储过程的名字以及传入相应的参数来使用存储过程.要高层次的掌握存储过程,不能觉得依葫芦画瓢, ...
- Java学习笔记(十五)——javadoc学习笔记和可能的注意细节
[前面的话] 这次开发项目使用jenkins做持续集成,PMD检查代码,Junit做单元测试,还会自动发邮件通知编译情况,会将javadoc生成的文档自动发到一个专门的服务器上面,每个人都可以看,所以 ...
- Linq之Linq to XML
目录 写在前面 系列文章 linq to xml 总结 写在前面 在很多情况下,都可以见到使用xml的影子.例如,在 Web 上,在配置文件.Microsoft Office Word 文件(将wor ...
- msf命令全集
一.msfconsole ? 帮助菜单 back 从当前环境返回 banner 显示一个MSF banner cd 切换目录 color 颜色转换 connect 连接一个主机 e ...
- “耐撕”团队第一次讨论——“抢答器”需求分析
团队名称:"耐撕" 团队成员:齐嘉亮.刘伟硕.濮成林.郑蕊 项目名称:"抢答器"(有待改善) 第一次讨论 时间:20160316 地点:软件所 人员:全体 内容 ...
- 转:Oracle中merge into的使用
最近项目上使用Oracle的Merge,所以找来一下资料学习了解. 该命令使用一条语句从一个或者多个数据源中完成对表的更新和插入数据. ORACLE 9i 中,使用此命令必须同时指定UPDATE 和I ...
- html之给文本框设置宽度和高度/input的无边框效果
<input name="" type="text" style="width:200px; height:20px;" /> ...