Bug 2464 - Store spectrum conversion matrix in CSR format
Store spectrum conversion matrix in CSR format
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: spectrum
ns-3-dev
All All
: P5 enhancement
Assigned To: Nicola Baldo
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-06 19:06 UTC by Alexander Krotov
Modified: 2016-10-19 09:00 UTC (History)
1 user (show)

See Also:


Attachments
Proposed patch (3.52 KB, patch)
2016-08-06 19:06 UTC, Alexander Krotov
Details | Diff
Benchmark scenario (2.60 KB, text/x-c++src)
2016-08-06 21:18 UTC, Alexander Krotov
Details
Proposed patch (3.53 KB, patch)
2016-10-16 19:08 UTC, Alexander Krotov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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