-
Notifications
You must be signed in to change notification settings - Fork 2
Changed: store conversion matrices as SparseMatrixCSC
#212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SparseMatrixCSC
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #212 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 26 26
Lines 4285 4286 +1
=======================================
+ Hits 4239 4240 +1
Misses 46 46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I also stored |
SparseMatrixCSC
SparseMatrixCSC
On this subject, the prediction matrices and defect matrices for It is still a bad idea to store them as That is why I reverted my last commit. |
SparseMatrixCSC
SparseMatrixCSC
Following discussion at adrhill/SparseConnectivityTracer.jl#248, the conversion matrices from decision variable$\mathbf{Z}$ to inputs $\mathbf{U}$ and input increments $\mathbf{\Delta U}$ are now hard-coded as
SparseMatrixCSC{NT, Int}
, since the benchmarks indicated that it's not really slower than dense matrices on small plant models. It also ensures that sparsity detection for the differentiation ofNonLinMPC
withMultipleShooting
is not overly-conservative. Side-bonus: it's more efficient on the memory.I reproduce the benchmark here for posterity:
resulting in:
The only case in which sparse multiplication is slightly slower is when
nu=2
,Hp=50
andHc=50
, which I would argue that it's a bad tuning (the control periodTs
should be increased to reduce the horizons and the computational burden).Note this benchmark infirm my assumption in #202:
Morale: from now on I will rely more on
sparse
matrices when they contain a fair amount of zeros.