SLAM十四讲第二次作业-深蓝学院

SLAM十四讲第二次作业-深蓝学院_第1张图片

  1. r(A)=n:矩阵A的秩等于未知数的个数。
  2. ⾼斯消元法:通过用初等行变换将增广矩阵化为行阶梯阵,然后通过回代求解线性方程组的解。原理是将方程组中每个方程含有的未知数的个数降到最低,并且最下面的方程含有的未知数的个数最少。
  3. QR分解:把矩阵分解成一个列向量正交矩阵与一个上三角矩阵的积。原理是将矩阵每个列作为一个基本单元,将其化为正交的基向量与在这个基向量上的投影长度的积。
  4. Cholesky 分解:将一个对称正定矩阵分解成一个下三角矩阵与其共轭转置之乘积。
  5. 代码见:eigenMatrix.cpp与CMakeLists.txt
    eigenMatrix.cpp文件
/*求解 A * x = B 这个方程*/

#include 
#include 
#include 
#include 

using namespace std;
using namespace Eigen;

#define MATRIX_SIZE 100

int main( int argc,char** argv )
{
    MatrixXd A_pre = MatrixXd::Random( MATRIX_SIZE, MATRIX_SIZE );
    MatrixXd A = A_pre.transpose()*A_pre ;                  //使得A为正定对称矩阵,才能使得cholesky分解成功
    VectorXd B = VectorXd::Random( MATRIX_SIZE );
    VectorXd x = A.colPivHouseholderQr().solve(B);          //调用QR分解求解
    VectorXd y = A.llt().solve(B);                          //调用cholesky分解求解

    cout <<"A*x=B方程的解为\n"<< x << endl;
    cout <<"A*y=B方程的解为\n"<< y << endl;
}

CMaleLists.txt文件

cmake_minimum_required( VERSION 2.8 )
project( useEigen )

set( CMAKE_BUILD_TYPE "Release" )
set( CMAKE_CXX_FLAGS "-O3" )

# 添加Eigen头文件
include_directories( "/usr/include/eigen3" )

add_executable( eigen eigenMatrix.cpp )

SLAM十四讲第二次作业-深蓝学院_第2张图片
代码见:useGeometry.cpp与CMakeLists.txt

useGeometry.cpp文件

#include 
#include 
#include 
#include 

using namespace std;
using namespace Eigen;

int main(int arcg,char** argv)
{
    Quaterniond q1 = Quaterniond(0.55,0.3,0.2,0.2).normalized();   //定义并归一化四元数
    Quaterniond q2 = Quaterniond(-0.1,0.3,-0.7,0.2).normalized();
    Vector3d t1 ,t2,p1,p,p2;
    t1 << 0.7,1.1,0.2;
    t2 << -0.1,0.4,0.8;
    p1 << 0.5,-0.1,0.2;
  

    Isometry3d T_cw1 = Isometry3d::Identity();
    T_cw1.rotate ( q1 );
    T_cw1.pretranslate ( t1 );

    Isometry3d T_cw2 = Isometry3d::Identity();
    T_cw2.rotate ( q2 );
    T_cw2.pretranslate ( t2 );



    p = T_cw1.inverse() *p1;   //不能用转置,因为这里不是纯旋转,见书42页
    p2 = T_cw2 *p ;

    cout<<"p2 = "<<p2.transpose()<<endl;
}

CMakeLists.txt文件

cmake_minimum_required( VERSION 2.8 )
project( geometry )

# 添加Eigen头文件
include_directories( "/usr/include/eigen3" )

add_executable( eigenGeometry eigenGeometry.cpp )

SLAM十四讲第二次作业-深蓝学院_第3张图片

  1. 证明
    设某个单位正交基 ( e 1 , e 2 , e 3 ) (e_1,e_2,e_3) (e1,e2,e3)经过一次旋转变成了 ( f 1 , f 2 , f 3 ) (f_1,f_2,f_3) (f1,f2,f3),那么旋转矩阵
    R = [ e 1 T e 2 T e 3 T ] ⋅ [ f 1 f 2 f 3 ] ∵ [ e 1 T e 2 T e 3 T ] ⋅ [ e 1 e 2 e 3 ] = I ∴ R T ⋅ R = [ f 1 T f 2 T f 3 T ] ⋅ [ e 1 e 2 e 3 ] ⋅ [ e 1 T e 2 T e 3 T ] ⋅ [ f 1 f 2 f 3 ] = [ f 1 T f 2 T f 3 T ] ⋅ I ⋅ [ f 1 f 2 f 3 ] = I ∴ R T ⋅ R = I R = \begin{bmatrix} e_1^T \\ e_2^T \\ e_3^T \end{bmatrix} \cdot \begin{bmatrix} f_1 & f_2 &f_3 \end{bmatrix} \\ \because \begin{bmatrix} e_1^T \\ e_2^T \\ e_3^T \end{bmatrix} \cdot \begin{bmatrix} e_1& e_2 &e_3 \end{bmatrix} = I \\ \begin{aligned}\therefore R^T \cdot R &= \begin{bmatrix} f_1^T \\ f_2^T \\ f_3^T \end{bmatrix} \cdot \begin{bmatrix} e_1 & e_2 & e_3 \end{bmatrix} \cdot \begin{bmatrix} e_1^T \\ e_2^T \\ e_3^T \end{bmatrix} \cdot \begin{bmatrix} f_1 & f_2 &f_3 \end{bmatrix} \\ &= \begin{bmatrix} f_1^T \\ f_2^T \\ f_3^T \end{bmatrix} \cdot I \cdot \begin{bmatrix} f_1 & f_2 &f_3 \end{bmatrix} \\ &= I \end{aligned} \\ \therefore R^T \cdot R=I R=e1Te2Te3T[f1f2f3]e1Te2Te3T[e1e2e3]=IRTR=f1Tf2Tf3T[e1e2e3]e1Te2Te3T[f1f2f3]=f1Tf2Tf3TI[f1f2f3]=IRTR=I
    ∣ R ∣ = ∣ e 1 T e 2 T e 3 T ∣ ⋅ ∣ f 1 f 2 f 3 ∣ = 1 ∴ d e t R = ± 1 \begin{aligned} |R| &= \begin{vmatrix} e_1^T \\ e_2^T \\ e_3^T \end{vmatrix} \cdot \begin{vmatrix} f_1 & f_2 &f_3 \end{vmatrix} \\ &=1 \\ \therefore detR = \pm 1 \end{aligned} RdetR=±1=e1Te2Te3Tf1f2f3=1
    又因为单位正交基的模为+1,
    ∴ d e t R = + 1 \therefore detR = +1 detR=+1
    所以 R T R = I R^TR=I RTR=I,且 d e t R = + 1 detR=+1 detR=+1
  2. 证明
    四元数由四个数组成,有一个实部和三个虚部,形如: q = q 0 + q 1 i + q 2 j + q 3 k q=q_0+q_1i+q_2j+q_3k q=q0+q1i+q2j+q3k。那么上述的 ε = [ q 1 , q 2 , q 3 ] T ∈ R 3 \varepsilon = [ q_1,q_2,q_3]^T \in \mathbb{R}^3 ε=[q1,q2,q3]TR3 η = q 0 ∈ R \eta = q_0 \in \mathbb{R} η=q0R
    所以 ε \varepsilon ε η \eta η的维度分别为 3和1。
  3. 证明(一定要注意四元数实部与虚部的顺序,这里实部在最后)
    q 1 = [ x 1 , y 1 , z 1 , w 1 ] , q 2 = [ x 2 , y 2 , z 2 , w 2 ] q_1=[x_1,y_1,z_1,w_1],q_2=[x_2,y_2,z_2,w_2] q1=[x1,y1,z1,w1],q2=[x2,y2,z2,w2],其中 w 1 , w 2 w_1,w_2 w1,w2为实部
    q 1 ⋅ q 2 = ( w 1 x 2 + x 1 w 2 + y 1 z 2 − z 1 y 2 ) i + ( w 1 y 2 − x 1 z 2 + y 1 w 2 + z 1 x 2 ) j + ( w 1 z 2 + x 1 y 2 − y 1 x 2 + z 1 w 2 ) k + w 1 w 2 − x 1 x 2 − y 1 y 2 − z 1 z 2 \begin{aligned} q_1\cdot q_2 &=(w_1x_2+x_1w_2+y_1z_2-z_1y_2)i \\&+(w_1y_2-x_1z_2+y_1w_2+z_1x_2) j \\&+(w_1z_2+x_1y_2-y_1x_2+z_1w_2) k \\&+w_1w_2-x_1x_2-y_1y_2-z_1z_2 \end{aligned} q1q2=(w1x2+x1w2+y1z2z1y2)i+(w1y2x1z2+y1w2+z1x2)j+(w1z2+x1y2y1x2+z1w2)k+w1w2x1x2y1y2z1z2
    q 1 + q 2 = [ w 1 − z 1 y 1 x 1 z 1 w 1 − x 1 y 1 − y 1 x 1 w 1 z 1 − x 1 − y 1 − z 1 w 1 ] [ x 2 y 2 z 2 w 2 ] = [ w 1 x 2 + x 1 w 2 + y 1 z 2 − z 1 y 2 w 1 y 2 − x 1 z 2 + y 1 w 2 + z 1 x 2 w 1 z 2 + x 1 y 2 − y 1 x 2 + z 1 w 2 w 1 w 2 − x 1 x 2 − y 1 y 2 − z 1 z 2 ] = ( w 1 x 2 + x 1 w 2 + y 1 z 2 − z 1 y 2 ) i + ( w 1 y 2 − x 1 z 2 + y 1 w 2 + z 1 x 2 ) j + ( w 1 z 2 + x 1 y 2 − y 1 x 2 + z 1 w 2 ) k + w 1 w 2 − x 1 x 2 − y 1 y 2 − z 1 z 2 = q 1 ⋅ q 2 \begin{aligned} q_1^+q_2 &= \begin{bmatrix} w_1 & -z_1 & y_1 & x_1 \\z_1 & w_1 & -x_1 & y_1\\-y_1 & x_1 & w_1 & z_1 \\ -x_1 & -y_1 & -z_1 & w_1 \end{bmatrix} \begin{bmatrix} x_2 \\ y_2 \\z_2 \\w_2 \end{bmatrix} \\ &= \begin{bmatrix} w_1x_2+x_1w_2+y_1z_2-z_1y_2 \\ w_1y_2-x_1z_2+y_1w_2+z_1x_2 \\ w_1z_2+x_1y_2-y_1x_2+z_1w_2 \\ w_1w_2-x_1x_2-y_1y_2-z_1z_2 \end{bmatrix} \\&=(w_1x_2+x_1w_2+y_1z_2-z_1y_2)i \\&+(w_1y_2-x_1z_2+y_1w_2+z_1x_2) j \\&+(w_1z_2+x_1y_2-y_1x_2+z_1w_2) k \\&+w_1w_2-x_1x_2-y_1y_2-z_1z_2 \\ &= q_1\cdot q_2 \end{aligned} q1+q2=w1z1y1x1z1w1x1y1y1x1w1z1x1y1z1w1x2y2z2w2=w1x2+x1w2+y1z2z1y2w1y2x1z2+y1w2+z1x2w1z2+x1y2y1x2+z1w2w1w2x1x2y1y2z1z2=(w1x2+x1w2+y1z2z1y2)i+(w1y2x1z2+y1w2+z1x2)j+(w1z2+x1y2y1x2+z1w2)k+w1w2x1x2y1y2z1z2=q1q2
    所以: q 1 ⋅ q 2 = q 1 + q 2 q_1 \cdot q_2 = q_1^+q_2 q1q2=q1+q2
    同理可证: q 1 ⋅ q 2 = q 2 ⊕ q 1 q_1 \cdot q_2 = q_2^ \oplus q_1 q1q2=q2q1

证明方法二:
SLAM十四讲第二次作业-深蓝学院_第4张图片
SLAM十四讲第二次作业-深蓝学院_第5张图片
证明
SLAM十四讲第二次作业-深蓝学院_第6张图片

如上图, V r o t V_{rot} Vrot是由 V V V通过旋转得到,旋转轴是K,旋转的角度为 θ \theta θ,用旋转矩阵R表示该旋转,即为: V r o t = R ⋅ V V_{rot} = R \cdot V Vrot=RV, 且 K K K为单位向量, ∣ ∣ K ⃗ ∣ ∣ = 1 ||\vec{K} || =1 K =1,
V = V ⊥ + V ∥ V=V_\perp + V_\parallel V=V+V,
V ⊥ = V − V ∥ = − K × ( K × V ) V_\perp = V-V_\parallel = -K \times (K \times V) V=VV=K×(K×V)
V ∥ = ( K ⋅ V ) ⋅ K = K K T V V_\parallel = (K \cdot V) \cdot K = K K^T V V=(KV)K=KKTV,
则垂直分量和平行分量各自的旋转分量为:
V ∥ r o t = V ∥ V_{\parallel rot} = V_\parallel Vrot=V
V ⊥ r o t = c o s θ V ⊥ + s i n θ K × V V_{\perp rot} = cos\theta V_\perp+sin\theta K \times V Vrot=cosθV+sinθK×V
∴ V r o t = V ∥ r o t + V ⊥ r o t = V ∥ + c o s θ V ⊥ + s i n θ K × V = V ∥ + c o s θ ( V − V ∥ ) + s i n θ K × V = c o s θ V + ( 1 − c o s θ ) V ∥ + s i n θ K × V = c o s θ V + ( 1 − c o s θ ) K K T V + s i n θ K × V = R ⋅ V \begin{aligned}\therefore V_{rot} &= V_{\parallel rot} + V_{\perp rot} \\&= V_\parallel + cos\theta V_\perp +sin\theta K\times V \\&=V_\parallel + cos\theta(V-V_\parallel) + sin\theta K \times V \\&= cos\theta V + (1-cos\theta)V_\parallel +sin\theta K \times V \\&= cos\theta V+ (1-cos\theta) K K^T V + sin\theta K^\times V \\&=R \cdot V \end{aligned} Vrot=Vrot+Vrot=V+cosθV+sinθK×V=V+cosθ(VV)+sinθK×V=cosθV+(1cosθ)V+sinθK×V=cosθV+(1cosθ)KKTV+sinθK×V=RV
∴ R = c o s θ I + ( 1 − c o s θ ) K K T + s i n θ K × \therefore R = cos\theta I + (1-cos\theta) K K^T + sin\theta K^\times R=cosθI+(1cosθ)KKT+sinθK×
∴ R = c o s θ I + ( 1 − c o s θ ) n n T + s i n θ n × \therefore R = cos\theta I + (1-cos\theta)nn^T +sin\theta n^\times R=cosθI+(1cosθ)nnT+sinθn×

SLAM十四讲第二次作业-深蓝学院_第7张图片

证明
(1) p ′ p^{'} p的实部为0
假定点p的坐标为 p ( x , y , z ) p(x,y,z) p(x,y,z),则用四元数表示为: p = [ 0 , x , y , z ] = x i + y j + z k p=[0,x,y,z]=xi+yj+zk p=[0,x,y,z]=xi+yj+zk,
q = [ c o s θ 2 , n s i n θ 2 ] = c o s θ 2 + n x s i n θ 2 i + n y s i n θ 2 j + n z s i n θ 2 k q=[cos\frac{\theta}{2} ,nsin\frac{\theta}{2}]=cos\frac{\theta}{2}+n_x sin\frac{\theta}{2}i+n_y sin\frac{\theta}{2}j+n_z sin\frac{\theta}{2}k q=[cos2θ,nsin2θ]=cos2θ+nxsin2θi+nysin2θj+nzsin2θk
∵ q ∗ = [ c o s θ 2 , − n s i n θ 2 ] , q − 1 = q ∗ / ∣ ∣ q ∣ ∣ 2 \because q^\ast=[cos\frac{\theta}{2} ,-\mathbf{n}sin\frac{\theta}{2}],q^{-1}=q^\ast/||q||^2 q=[cos2θ,nsin2θ],q1=q/q2
q − 1 = [ c o s θ 2 , − n s i n θ 2 ] / ∣ ∣ q ∣ ∣ 2 = ( c o s θ 2 − n x s i n θ 2 i − n y s i n θ 2 j − n z s i n θ 2 k ) / ∣ ∣ q ∣ ∣ 2 q^{-1} = [cos\frac{\theta}{2} ,-nsin\frac{\theta}{2}]/||q||^2=(cos\frac{\theta}{2} - n_x sin\frac{\theta}{2}i - n_y sin\frac{\theta}{2}j - n_z sin\frac{\theta}{2}k)/||q||^2 q1=[cos2θ,nsin2θ]/q2=(cos2θnxsin2θinysin2θjnzsin2θk)/q2
∴ p ′ = q p q − 1 = [ c o s θ 2 , n s i n θ 2 ] [ 0 , x , y , z ] [ c o s θ 2 , − n s i n θ 2 ] / ∣ ∣ q ∣ ∣ 2 = ( c o s θ 2 + n x s i n θ 2 i + n y s i n θ 2 j + n z s i n θ 2 k ) ( x i + y j + z k ) ( ( c o s θ 2 − n x s i n θ 2 i − n y s i n θ 2 j − n z s i n θ 2 k ) / ∣ ∣ q ∣ ∣ 2 ) \begin{aligned} \therefore p^{'} &= qpq^{-1} \\&=[cos\frac{\theta}{2} ,nsin\frac{\theta}{2}] [0,x,y,z] [cos\frac{\theta}{2} ,-nsin\frac{\theta}{2}]/||q||^2\\&=(cos\frac{\theta}{2}+n_x sin\frac{\theta}{2}i+n_y sin\frac{\theta}{2}j+n_z sin\frac{\theta}{2}k)(xi+yj+zk)((cos\frac{\theta}{2} - n_x sin\frac{\theta}{2}i - n_y sin\frac{\theta}{2}j - n_z sin\frac{\theta}{2}k)/||q||^2) \end{aligned} p=qpq1=[cos2θ,nsin2θ][0,x,y,z][cos2θ,nsin2θ]/q2=(cos2θ+nxsin2θi+nysin2θj+nzsin2θk)(xi+yj+zk)((cos2θnxsin2θinysin2θjnzsin2θk)/q2)
将所有的实数取出,且忽略 ∣ ∣ q ∣ ∣ 2 ||q||^2 q2,则:
x n x c o s θ 2 s i n θ 2 + y n y c o s θ 2 s i n θ 2 + z n z c o s θ 2 s i n θ 2 + ( − 1 ) x n x s i n θ 2 x c o s θ 2 + y n x n z s i n θ 2 s i n θ 2 + ( − 1 ) z n x n y s i n θ 2 s i n θ 2 + ( − 1 ) y n y s i n θ 2 c o s θ 2 + ( − 1 ) x n y n z s i n θ 2 s i n θ 2 + z n x n y s i n θ 2 s i n θ 2 + x n y n z s i n θ 2 s i n θ 2 + ( − 1 ) y n x n z s i n θ 2 s i n θ 2 + ( − 1 ) z n z s i n θ 2 c o s θ 2 = 0 x n_x cos\frac{\theta}{2} sin\frac{\theta}{2} + y n_y cos\frac{\theta}{2} sin\frac{\theta}{2} +z n_z cos\frac{\theta}{2} sin\frac{\theta}{2} \\ + (-1) x n_x sin\frac{\theta}{2} x cos\frac{\theta}{2} + y n_x n_z sin\frac{\theta}{2} sin\frac{\theta}{2} + (-1)z n_x n_ysin\frac{\theta}{2} sin\frac{\theta}{2} \\+(-1)y n_y sin\frac{\theta}{2} cos\frac{\theta}{2} + (-1) x n_y n_z sin\frac{\theta}{2} sin\frac{\theta}{2} + z n_x n_y sin\frac{\theta}{2} sin\frac{\theta}{2} \\+ x n_y n_z sin\frac{\theta}{2} sin\frac{\theta}{2} +(-1) y n_x n_z sin\frac{\theta}{2}sin\frac{\theta}{2} + (-1) z n_z sin\frac{\theta}{2}cos\frac{\theta}{2} \\ \\=0 xnxcos2θsin2θ+ynycos2θsin2θ+znzcos2θsin2θ+(1)xnxsin2θxcos2θ+ynxnzsin2θsin2θ+(1)znxnysin2θsin2θ+(1)ynysin2θcos2θ+(1)xnynzsin2θsin2θ+znxnysin2θsin2θ+xnynzsin2θsin2θ+(1)ynxnzsin2θsin2θ+(1)znzsin2θcos2θ=0
所以实部为0,即 p ′ p^{'} p的实部为0。

(2) p ′ = Q p p^{'} = Qp p=Qp,写出矩阵 Q Q Q
p ′ = q p q − 1 = q + p + q − 1 = q + q − 1 ⊕ p \begin{aligned} p^{'} &= qpq^{-1} \\ &= q^+ p^+q^{-1} \\&= q^+ q^{-1^\oplus}p \end{aligned} p=qpq1=q+p+q1=q+q1p
∴ Q = q + q − 1 ⊕ \therefore Q= q^+ q^{-1^\oplus} Q=q+q1
假定四元数 q = [ x , y , z , w ] q=[x,y,z,w] q=[x,y,z,w],其中 w w w是实部,那么 q − 1 = [ − x , − y , − z , w ] / ∣ ∣ q ∣ ∣ 2 q^{-1}=[-x,-y,-z,w]/||q||^2 q1=[x,y,z,w]/q2
q + = [ η 1 + ε × ε − ε T η ] = [ w − z y x z w − x y − y x w z − x − y − z w ] q^+ = \begin{bmatrix} \eta1 + \varepsilon ^\times & \varepsilon \\ -\varepsilon^T & \eta \end{bmatrix}=\begin{bmatrix} w & -z & y & x\\z & w & -x & y\\-y & x & w & z \\ -x & -y & -z & w\end{bmatrix} q+=[η1+ε×εTεη]=wzyxzwxyyxwzxyzw,
q − 1 ⊕ = [ η 1 − ( − ε ) × − ε − ( − ε ) T η ] / ∣ ∣ q ∣ ∣ 2 = 1 ∣ ∣ q ∣ ∣ 2 ⋅ [ η 1 + ε × − ε ε T η ] = 1 ∣ ∣ q ∣ ∣ 2 ⋅ [ w − z y − x z w − x − y − y x w − z x y z w ] q^{-1^\oplus}= \begin{bmatrix} \eta1 - (-\varepsilon) ^\times & -\varepsilon \\ -(-\varepsilon)^T & \eta \end{bmatrix}/||q||^2 = \frac{1}{||q||^2 }\cdot \begin{bmatrix} \eta1 + \varepsilon ^\times & -\varepsilon \\ \varepsilon^T & \eta \end{bmatrix}=\frac{1}{||q||^2 }\cdot \begin{bmatrix} w & -z & y & -x\\z & w & -x & -y\\-y & x & w & -z \\ x & y & z & w\end{bmatrix} q1=[η1(ε)×(ε)Tεη]/q2=q21[η1+ε×εTεη]=q21wzyxzwxyyxwzxyzw
∴ Q = q + q − 1 ⊕ = 1 ∣ ∣ q ∣ ∣ 2 ⋅ [ w − z y x z w − x y − y x w z − x − y − z w ] [ w − z y − x z w − x − y − y x w − z x y z w ] = 1 ∣ ∣ q ∣ ∣ 2 ⋅ [ w 2 + x 2 − y 2 + z 2 2 x y − 2 z w 2 w y + 2 x z 0 2 x y + 2 z w w 2 − x 2 + y 2 − z 2 2 y z − 2 x w 0 2 x z − 2 y w 2 y z + 2 x w w 2 − x 2 − y 2 + z 2 0 0 0 0 w 2 + x 2 + y 2 + z 2 ] \begin{aligned} \therefore Q &= q^+ q^{-1^\oplus} \\&= \frac{1}{||q||^2 }\cdot\begin{bmatrix} w & -z & y & x\\z & w & -x & y\\-y & x & w & z \\ -x & -y & -z & w\end{bmatrix}\begin{bmatrix} w & -z & y & -x\\z & w & -x & -y\\-y & x & w & -z \\ x & y & z & w\end{bmatrix} \\&= \frac{1}{||q||^2 }\cdot \begin{bmatrix}w^2+x^2-y^2+z^2& 2xy-2zw & 2wy+2xz & 0\\ 2xy+2zw& w^2-x^2+y^2-z^2 & 2yz-2xw & 0\\2xz-2yw & 2yz+2xw & w^2-x^2-y^2+z^2 & 0 \\ 0 & 0 & 0 & w^2+x^2+y^2+z^2\end{bmatrix} \end{aligned} Q=q+q1=q21wzyxzwxyyxwzxyzwwzyxzwxyyxwzxyzw=q21w2+x2y2+z22xy+2zw2xz2yw02xy2zww2x2+y2z22yz+2xw02wy+2xz2yz2xww2x2y2+z20000w2+x2+y2+z2

证明方法二:
SLAM十四讲第二次作业-深蓝学院_第8张图片
SLAM十四讲第二次作业-深蓝学院_第9张图片

  1. for(atuo& a: avec)
    范围for循环,用a遍历avec中的每个量;
  2. for(atuo& a: avec)
    自动类型推导,根据a获得的值,用auto自动推断出a的类型;
  3. [](const A&a1,const A&a2){return a1.index 运用了lambda表达式。
  4. begin()

你可能感兴趣的:(SLAM,SLAM十四讲作业)