博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Eigen] Issues when using Eigen
阅读量:6293 次
发布时间:2019-06-22

本文共 1589 字,大约阅读时间需要 5 分钟。

1. Efficient Expression

Refer to this post , for dense matrix calculation.

But what about sparse matrix product??

What does Eigen do when:

- [Enhancement, unsolved] Sparse matrix product –> Sparse m? dense matrix and vector? Does it make itself dense first?

Is this expression fast when using SpMat? When a_, y_, lambda_*_,  is a (dense) vector, penalty_ a scalar?

a_ = - penalty_ * (A_.transpose() * y_)

    + A_.transpose() * lambda_y_
    + Q_.transpose() * lambda_stf_;

 

or this one better following the post above?

 

a_ = - penalty_ * (A_.transpose() * y_);

a_.noalias() += A_.transpose() * lambda_y_;
a_.noalias() += Q_.transpose() * lambda_stf_;

 

 

- [Enhancement, unsolved] Will it be faster to use sparse vector when do multiplication with sparse matrix, instead of dense one?

- [Bugs, unsolved] When I ran the following I got bugs:

VX dual_res_v         = -lambda_stf_.transpose() * (Q_ - Q_new);

dual_res_v.noalias() += - penalty_ * (y_ - y_prev).transpose() * A_;
dual_res_v.noalias() += - (lambda_y_ - lambda_y_prev).transpose() * A_;
dual_res_v.noalias() += penalty_ * x_.transpose() * (Q_ - Q_new).transpose() * Q_;

Where VX is dense vector in Eigen, and lambda_*_, y_* and x_* are dense vector, Q_ and A_ are sparse matrix.

The index is compatible. The following lines work fine in my code:

 

VX dual_res_v = -lambda_stf_.transpose() * (Q_ - Q_new)

    - penalty_ * (y_ - y_prev).transpose() * A_
    - (lambda_y_ - lambda_y_prev).transpose() * A_
    + penalty_ * x_.transpose() * (Q_ - Q_new).transpose() * Q_;

But I don’t know what’s wrong with the new one.

转载于:https://www.cnblogs.com/duckie/p/5772415.html

你可能感兴趣的文章
/etc/fstab,/etc/mtab,和 /proc/mounts
查看>>
Apache kafka 简介
查看>>
socket通信Demo
查看>>
技术人员的焦虑
查看>>
js 判断整数
查看>>
mongodb $exists
查看>>
js实现页面跳转的几种方式
查看>>
sbt笔记一 hello-sbt
查看>>
常用链接
查看>>
pitfall override private method
查看>>
!important 和 * ----hack
查看>>
聊天界面图文混排
查看>>
控件的拖动
查看>>
svn eclipse unable to load default svn client的解决办法
查看>>
Android.mk 文件语法详解
查看>>
QT liunx 工具下载
查看>>
内核源码树
查看>>
Java 5 特性 Instrumentation 实践
查看>>
AppScan使用
查看>>
Java NIO框架Netty教程(三) 字符串消息收发(转)
查看>>