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', ' ')的函数 ...
随机推荐
- 为什么我的SQL server 在附加数据库后,数据库总是变成了只读?
我从同学那拷贝来一个数据库,在他那都可以用,可是当我附加到自己SQL Server上时,数据库显示为只读,我查看过数据库源文件所在的文件夹都正常!请高手指教!谢谢 ================== ...
- jquery-lazyload延迟加载图片 及 加载顺序 bug 修复
jquery-lazyload延迟加载图片 代码修改片段 function update() { var counter = 0; /**fix by weiyj start***/ elemen ...
- Android 长按Listview显示CheckBox,实现批量删除。
ListView实现的列表,如果是可编辑,可删除的,一般都要提供批量删除功能,否则的话,一项一项的删除体验很不好,也给用户带来了很大的麻烦. 实现效果图 具体实现代码 select.xml 主布局文件 ...
- Win7上防火墙开放FTP服务以及ping解决方案(zz)
1.windows 防火墙开放ftp服务 The following 4 steps will allow both non-secure and SSL FTP traffic through fi ...
- 信息安全系统设计基础exp_5
北京电子科技学院(BESTI) 实 验 报 告 课程:信息安全系统设计基础 班级:1353 姓名:郑伟.吴子怡 学号:20135322.20135313 指导教师: 娄嘉鹏 实验 ...
- 学习笔记——Ant
首先找个视频,你不可否认视频的确是入门最快的学习方式.入门学习视频(共两集)点我去观看 然后找一本入门级的资料看 ANT基础使用手册.pdf 现在你可以看看其他人写的脚本.估计简单的都能看懂. 然后找 ...
- 两个简单的Loading
置顶文章:<纯CSS打造银色MacBook Air(完整版)> 上一篇:<JavaScript并非"按值传递"> 作者主页:myvin 博主QQ:85139 ...
- Cordova4.0 系列 -- 常用命令(2)
一. 创建一个cordova工程 create <directory> [<id> [<name>]] 二. 列出该工程支持哪些平台 platform [ls | ...
- Android--多选自动搜索提示
一. 效果图 常见效果,在搜素提示选中之后可以继续搜索添加,选中的词条用特殊字符分开 二. 布局代码 <MultiAutoCompleteTextView android:id="@+ ...
- c# JD快速搜索工具,2015分析JD搜索报文,模拟请求搜索数据,快速定位宝贝排行位置。
分析JD搜索报文 搜索关键字 女装 第二页,分2次加载. rt=1&stop=1&click=&psort=&page=3http://search.jd.com/Se ...