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', ' ')的函数 ...
随机推荐
- 20145215实验三 敏捷开发与XP实践
20145215实验三 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 实验步骤 (一)敏捷开发与XP 软件工程是把系统的.有序的.可量化的方法应用到软件的开发.运营和维护上的过程.软 ...
- 优化Webstorm
Webstorm这个编辑器还是很强大的,而且版本更新得快,支持最新的typescript,就是性能越来越低. 本文总结了一些优化Webstorm的有效方法,希望对大家有所帮助! 测试环境 Mac OS ...
- Redis入门学习(一)——安装配置
最近马上要找实习了,听学长说他们公司里用了redis来解决缓存问题,在大三结束前来学习一下. 问:Redis是什么? 答:(官方)REmote DIctionary Server(Redis)是一个K ...
- 简述WebService的使用(一)
环境: vs版本:vs2013 windows版本:win7 IIS版本:IIS7.0 (如果觉得对您有用,请点击右下角[推荐]一下,让更多人看到,谢谢) 配置环境: 主要针对于IIS ·首先,有很多 ...
- #Linux学习笔记# Linux文件的属性以及权限说明
1. Linux文件的属性 关于Linux文件的属性的说明和设置请参考鸟哥Linux私房菜:Linux 的文件权限与目录配置 2. 目录和文件的权限意义 在Linux系统中,每个文件都有三种身份的权限 ...
- 关于hangfire的使用
hangfire 是一个分布式后台执行服务.用它可以代替ThreadPool.QueunItemWork等原生方法.当然4.5后的 task也是相当好用且功能强大.不过如果想分布式处理并且可监控的话, ...
- [wikioi 1418]铃仙•优昙华院稻叶(东方幻想乡系列模拟赛)(树上递推)
题目:http://www.wikioi.com/problem/1418/ 分析: 一看就肯定是树上的递推 设f[i][j][k]表示第i秒在k点(从j点走过来的)的概率 则f[i][j][k]=f ...
- EntityFramework_MVC4中EF5 新手入门教程之一 ---1.创建实体框架数据模型
Contoso University Web 应用程序 你会在这些教程中构建的应用程序是一个简单的大学网站. 用户可以查看和更新学生. 课程和教师信息.这里有几个屏幕,您将创建. 这个网站的用户界面 ...
- 第四十三课:jQuery插件化
我们先来看一个最简单的例子: (function($){ $.fn.extend({ //把此插件添加到jQuery的原型上 pluginName:function(){ //插件的名字 ...
- 每天一个linux命令(29):date命令
在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常会用到时间的运算,熟练运用date命令来表示自己想要表示的时间,肯定可以给自己的工作带来诸多方便. 1.命令格式: date [参数 ...