boostorg / boostorg/python

Create diagonal matrix in python::numpy

Aperta
#255 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
537
Fork
223
Merge medio
11h 22m
PR unite (30g)
2

Descrizione

This is probably a feature request.
What is the correct way to create diagonal matrix in boost::python::numpy?

Of course, I can just create a usual 2D matrix then assign its diagonal. But is there a better way?

It seems that in numpy (in python), the diagonal matrix is stored in a compact format, e.g. only stores the diagonal data. This can be observed by `a = np.diag(np.random.rand(20000,1))` and watch the memory usage. (much smaller than 20000^2 * 8 / 2^20 MB)

It would be nice to have a method to build diagonal matrix in this "compact" format.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.