boostorg / boostorg/python

Create diagonal matrix in python::numpy

Ouverte
#255 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C++
Étoiles
537
Forks
223
Merge moyen
11 h 22 min
PR mergées (30 j)
2

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.