boostorg / boostorg/python

Create diagonal matrix in python::numpy

Abierto
#255 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
537
Forks
223
Merge medio
11 h 22 min
PR fusionados (30 d)
2

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.