More Efficient Assignment Operation - Sparse Matrix

For somebody used to dealing with large sparse matrices, there should be a more efficient way of carrying out such an assignment operation. Probably a pretty simple solution but I have little experience with sparse-matrix syntax.
A = sparse(20000,60000); A(10001:end,20001:50000) = ([speye(10000,10000),-speye(10000,10000),speye(10000,10000)]);
I have a large sparse matrix for which I am attempting to assign certain segments (simplified example as per below snippet) to some identity matrices. The assignment method below is extremely inefficient, taking up a large amount of memory and too much time (10sec for example below on my server, but my real dataset is much bigger). Looking at the screenshot from taskmanager, we can see clearly a large spike in memory usage while the operation is being carried out.

1 个评论

Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle. http://realmadrid-galatasaray-macidsmartizle.blogspot.com/ Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle.
http://realmadrid-galatasaray-canlimacizle.dinstudio.se/ Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle. http://realmadridgscanliseyret.nordblogs.com/ Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle. http://real-gs-dsmart-izle.de.tl/ Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle. http://realmadrid-gs-canlimacyayini.blogs.sapo.pt/ Configuring your models to run in real time enables you to use hardware-in-the-loop testing instead of expensive prototypes to test your system. You can find mistakes earlier in the development process, reducing costs and shortening the design cycle.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

提问:

2013-4-3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by