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', ' ')的函数 ...
随机推荐
- 解决-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
1.添加M2_HOME的环境变量 2.Preference->Java->Installed JREs->Edit 选择一个jdk, 添加 -Dmaven.multiModuleP ...
- [CareerCup] 6.1 Find Heavy Bottle 寻找重瓶子
6.1 You have 20 bottles of pills. 19 bottles have 1.0 gram pills, but one has pills of weight 1.1 gr ...
- 创建Maven工程
一.Maven工程创建 File->New->Other,进入: 点击Next,进入: 勾选上Create a simple project(不使用骨架) 点击Next,进入: 输入项目名 ...
- python实现简易数据库之二——单表查询和top N实现
上一篇中,介绍了我们的存储和索引建立过程,这篇将介绍SQL查询.单表查询和TOPN实现. 一.SQL解析 正规的sql解析是用语法分析器,但是我找了好久,只知道可以用YACC.BISON等,sqlit ...
- [BZOJ2879][Noi2012]美食节(最小费用最大流动态加边)
题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=2879 分析: 和bzoj1070一样,但这题的数据范围大了很多,如果直接建图就会TLE ...
- 5、面向对象以及winform的简单运用(方法重载、隐藏、重写与虚方法)
方法的重载: 规定一个方法可以具有不同的实现,但方法的名称是相同的.如: //同样是Man这个方法 public int Man(int age,int name) { …… } //重载 publi ...
- C# JArray与JObject 的使用 json [{}]
C# JArray与JObject 的使用 STEP1.using Newtonsoft.Json.Linq; STEP2 如何获取json里的某个属性(节点)值,对其删改,新增 //2.1 数组用J ...
- 今天学习到的关于mysql数据库的linux命令
1. 登录mysql数据库: mysql -uroot -p 2.安装会提示的mysql的数据库软件:mycli sudo apt-get install mycli 3.安装依赖包: sudo ap ...
- 第十四章:Annotation(注释)
一:注解 1.当成是一种修饰符吧,修饰类及类的所有成员. 代码里的特殊标记,这些标记可以在编译.类加载.运行时被读取. 2.@Override:强制子类覆盖(重写)父类的方法. @Deprecated ...
- 用CSS做长度超过长度显示‘...’,当鼠标放上时显示全部内容
<!DOCTYPE html> <html> <head> <meta name="author" content="Yeeku ...