python - Get symmetric elements of a non-symmetric sparse matrix
问题描述
I am having a non-symmetric (csr
) matrix A
and given the indexes of the non-zero elements, in the i
-th row, A[i].indices
, I want to obtain the corresponding elements in the i
-th column A[A[i].indices, :]
. However, as the matrix is not symmetric the returned elements are not of the same size as the A[i].indices
. I suppose some indices in A[i].indices
correspond to zero elements in the i
-th column.
For example, with index starting from zero, in matrix A
below, A[0].indices=[1,2]
and A[A[0].indices, :]=[a_{31}]
.
Is it possible to obtain efficiently all elements (including zeros) that correspond in A[A[0].indices, :]
? That is, to obtain A[A[0].indices, :] = [a_{21}, a_{31}]
, with a_{21}=0
.
Thank you you advance.
解决方案
推荐阅读
- c# - 通用列表更改计数器 C#
- kubernetes - Kubernetes-Ingress:如何使用 HTTPS 正确路由到两个服务?
- python - 如何在 TensorFlow 的急切执行中使用 Keras.applications 的 ResNeXt?
- java - 使用切换按钮打开数据
- awesome-wm - 对命令的输入选择
- javascript - 更新 DynamoDB 中的列表
- javascript - Ajax 调用加载 gps 获取 [object%20HTMLInputElement] 404 Not Found 错误
- javascript - 用特殊字符替换子字符串
- node.js - 预处理通过 AWS SES SMTP 与外部客户端发送的电子邮件
- mongodb - 在 windows 上的单节点集群上的 kubernetes 调用之间持久化 mongodb