python - 为什么我在 python 错误中收到“all”函数?
问题描述
为什么我在all
函数中收到函数错误?
import numpy as np
A = np.matrix([[.6+1j,.5], [.6,.5]])
def isNormalcomplex(A):
if (all(A@A.T.conj() == A.T.conj()@A)):
print("The matrix is normal")
else:
print("The matrix is Non-normal")
isNormalcomplex(A)
ValueError:具有多个元素的数组的真值不明确。使用 a.any() 或 a.all()
解决方案
推荐阅读
- r - 保留数据框中的特定列
- reactjs - 带子选项的多选
- postgresql - 是否可以仅通过 FUNCTION 执行 INSERT?
- templates - 从 excel 获取 Drools 规则引擎中的默认规则
- c - 有没有办法跟踪在 gem5 上运行的应用程序的调用堆栈?
- c - 如何通过STM32L010接收来自HCRS04传感器的ECHO信号
- google-coral - macOS BigSur 无法识别 Google Edge TPU 开发板
- javascript - Navigator - getCurrentPosition() 承诺在找到位置之前解决
- python - 理解 Python 中的 [foo for bar, foo in arr]
- python - ValueError:具有多个元素的数组的真值不明确。遍历掩码数组时使用 a.any() 或 a.all()