当前位置: 首页 > news >正文

网页上本地网站搜索怎样做网络营销案例分析1000字

网页上本地网站搜索怎样做,网络营销案例分析1000字,前端网页培训班,app研发费用整理下Eigen库的教程#xff0c;参考#xff1a;http://eigen.tuxfamily.org/dox/index.html 混淆 在Eigen中#xff0c;当变量同时出现在左值和右值#xff0c;赋值操作可能会带来混淆问题。这一篇将解释什么是混淆#xff0c;什么时候是有害的#xff0c;怎么使用做。 … 整理下Eigen库的教程参考http://eigen.tuxfamily.org/dox/index.html 混淆 在Eigen中当变量同时出现在左值和右值赋值操作可能会带来混淆问题。这一篇将解释什么是混淆什么时候是有害的怎么使用做。 例子 MatrixXi mat(3,3); mat 1, 2, 3, 4, 5, 6, 7, 8, 9; cout Here is the matrix mat:\n mat endl; // This assignment shows the aliasing problem mat.bottomRightCorner(2,2) mat.topLeftCorner(2,2); cout After the assignment, mat \n mat endl;输出 Here is the matrix mat: 1 2 3 4 5 6 7 8 9 After the assignment, mat 1 2 3 4 1 2 7 4 1在 mat.bottomRightCorner(2,2) mat.topLeftCorner(2,2); 赋值中展示了混淆。 mat(1,1) 在bottomRightCorner(2,2)和topLeftCorner(2,2)都存在。赋值结果中mat(2,2)本应该赋予操作前mat(1,1)的值5。但是最终程序结果mat(2,2)1。原因是Eigen使用了lazy evaluation懒惰评估上面等价于 mat(1,1) mat(0,0); mat(1,2) mat(0,1); mat(2,1) mat(1,0); mat(2,2) mat(1,1);下面会解释如何通过eval()来解决这个问题。 混淆还会在缩小矩阵时出现比如 vec vec.head(n) 和 mat mat.block(i,j,r,c)。 一般来说混淆在编译阶段很难被检测到。比如第一个例子如果mat再大一些可能就不会出现混淆了。但是Eigen可以在运行时检测某些混淆如前面讲的例子。 Matrix2i a; a 1, 2, 3, 4; cout Here is the matrix a:\n a endl; a a.transpose(); // !!! do NOT do this !!! cout and the result of the aliasing effect:\n a endl;Here is the matrix a: 1 2 3 4 and the result of the aliasing effect: 1 2 2 4我们可以通过EIGEN_NO_DEBUG宏在编译时关闭运行时的断言。 解决混淆问题 Eigen需要把右值赋值为一个临时matrix/array然后再将临时值赋值给左值便可以解决混淆。eval()函数实现了这个功能。 MatrixXi mat(3,3); mat 1, 2, 3, 4, 5, 6, 7, 8, 9; cout Here is the matrix mat:\n mat endl; // The eval() solves the aliasing problem mat.bottomRightCorner(2,2) mat.topLeftCorner(2,2).eval(); cout After the assignment, mat \n mat endl;输出 Here is the matrix mat: 1 2 3 4 5 6 7 8 9 After the assignment, mat 1 2 3 4 1 2 7 4 5同样 a a.transpose().eval(); 当然我们最好使用 transposeInPlace()。如果存在xxxInPlace函数推荐使用这类函数它们更加清晰地标明了你在做什么。提供的这类函数 OriginIn-placeMatrixBase::adjoint()MatrixBase::adjointInPlace()DenseBase::reverse()DenseBase::reverseInPlace()LDLT::solve()LDLT::solveInPlace()LLT::solve()LLT::solveInPlace()TriangularView::solve()TriangularView::solveInPlace()DenseBase::transpose()DenseBase::transposeInPlace()而针对vec vec.head(n)这种情况推荐使用conservativeResize()。 混淆和component级的操作。 组件级是指整体的操作比如matrix加法、scalar乘、array乘等这类操作是安全的不会出现混淆。 MatrixXf mat(2,2); mat 1, 2, 4, 7; cout Here is the matrix mat:\n mat endl endl; mat 2 * mat; cout After mat 2 * mat, mat \n mat endl endl; mat mat - MatrixXf::Identity(2,2); cout After the subtraction, it becomes\n mat endl endl; ArrayXXf arr mat; arr arr.square(); cout After squaring, it becomes\n arr endl endl;输出 Here is the matrix mat: 1 2 4 7After mat 2 * mat, mat 2 48 14After the subtraction, it becomes1 48 13After squaring, it becomes1 1664 169混淆和矩阵的乘法 在Eigen中矩阵的乘法一般都会出现混淆。除非是方阵实质是元素级的乘。 MatrixXf matA(2,2); matA 2, 0, 0, 2; matA matA * matA; cout matA;4 0 0 4其他的操作Eigen默认都是存在混淆的。所以Eigen对矩阵乘法自动引入了临时变量对的matAmatA*matA这是必须的但是对matBmatA*matA这样便是不必要的了。我们可以使用noalias()函数来声明这里没有混淆matA*matA的结果可以直接赋值为matB。 matB.noalias() matA * matA;从Eigen3.3开始如果目标矩阵resize且结果不直接赋值给目标矩阵默认不存在混淆。 MatrixXf A(2,2), B(3,2); B 2, 0, 0, 3, 1, 1; A 2, 0, 0, -2; A (B * A).cwiseAbs();//cwiseAbs不直接赋给目标 //A (B * A).eval().cwiseAbs() cout A;当然对于任何混淆问题都可以通过matA(matB*matA).eval() 来解决。 总结 当相同的矩阵或array在等式左右都出现时很容易出现混淆。 compnent级别的操作不用考虑混淆。矩阵相乘Eigen默认会解决混淆问题如果你确定不会出现混淆可以使用noalias来提效。混淆出现时可以用eval()和xxxInPlace()函数解决。转载于:https://www.cnblogs.com/houkai/p/6349990.html
http://www.zqtcl.cn/news/221071/

相关文章:

  • 烟台网站建设推荐企汇互联见效付款查看网站被百度收录
  • 做标签网站360街景地图怎么看
  • 深圳网站建设领先天津建设企业网站
  • 网站建设犭金手指C排名15温州 建网站的公司
  • 邢台建设银行官方网站公众号开发者密码是什么意思
  • 网站录入信息 前台查询功能怎么做营销网站主题有哪些内容
  • 网站SEO的评价触屏音乐网站源码
  • 网站开发u盘128够吗网站建设是固定资产嘛
  • 网站域名备案信息wordpress搜索文章内容
  • 出口退税在哪个网站做怎么在一起做网站上拿货
  • 网站友链查询传到网站根目录
  • 网站服务器端口设置北京专业网络直播制作
  • 可以免费做演播的听书网站南京企业自助建站
  • 软件下载类型网站怎么做长沙官网优化技术
  • 药品网站订单源码外贸网站建设服务器
  • 深圳网站制作07551免费开发网站
  • 如何直接用jsp做网站不写servletwordpress模板 单栏
  • 长沙网站建设哪个公司好设计公司网站 唐山
  • 原创小说手机网站制作需要多少钱郴州seo外包
  • 深圳市大鹏建设局网站网站关键词没排名怎么办
  • 水果商城网站制作多少钱c#如何做公司网站
  • 国内做进口的电商网站网站建设的经验做法
  • 蚂蚁搬家公司官方网站免费网站软件制作
  • 搭建网站要用到的工具外链代发免费
  • 肥城网站建设流程oem中国代加工网
  • 到底建手机网站还是电脑网站网站视频怎么做
  • 小区网站建设前端手机网站
  • 做一个网站价格WordPress好看的404
  • 查看注册过的网站在线网站软件免费下载
  • 门户网站建设公司价位域名出售网站