Bug 2464

Summary: Store spectrum conversion matrix in CSR format
Product: ns-3 Reporter: Alexander Krotov <krotov>
Component: spectrumAssignee: Nicola Baldo <nicola>
Status: RESOLVED FIXED    
Severity: enhancement CC: ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Proposed patch
Benchmark scenario
Proposed patch

Description Alexander Krotov 2016-08-06 19:06:24 UTC
Created attachment 2518 [details]
Proposed patch

Spectrum conversion matrix is usually sparse. In most cases bands of TX and RX correspond one-to-one, so the matrix is diagonal even. So I decided that matrix should be stored in CSR format instead of vector of vectors.

Proposed patch is attached.
Comment 1 Alexander Krotov 2016-08-06 20:18:02 UTC
I checked that patch results in much less multiplications, but the improvement in time is not that great. Probably it needs more benchmarking in large scenarios and feedback.
Comment 2 Alexander Krotov 2016-08-06 21:18:30 UTC
Created attachment 2524 [details]
Benchmark scenario

For attached scenario proposed patch shows about 30% reduction in time on my computer (from ~30 seconds to ~20 seconds).
Comment 3 Nicola Baldo 2016-10-16 17:47:48 UTC
Hi Alex,

thanks a lot for this patch, it looks very good! I think it would be very nice to include it. The only (minor) comment I have is to change operator [] to .at() for accessing std::vector elements. Other than this, the implementation looks very neat! Please go ahead and push it.
Comment 4 Alexander Krotov 2016-10-16 19:08:44 UTC
Created attachment 2620 [details]
Proposed patch

I have updated patch to use at() and tested it.

I can't push it as I have no write access to ns-3-dev.
Comment 5 Alexander Krotov 2016-10-19 09:00:27 UTC
Pushed in changeset 608e628ef4b5