More Efficient Assignment Operation - Sparse Matrix

1 view (last 30 days)
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 Comment
Stewen
Stewen on 3 Apr 2013
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.

Sign in to comment.

Answers (1)

Cedric
Cedric on 3 Apr 2013
Edited: Cedric on 3 Apr 2013

Community Treasure Hunt

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

Start Hunting!