boostorg / boostorg/python

Create diagonal matrix in python::numpy

オープン
#255 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
537
フォーク
223
平均マージ
11時間 22分
マージ済み PR(30日)
2

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。