【问题标题】:Error while calculating eigen vectors and eigen values using the modred module in python使用python中的modred模块计算特征向量和特征值时出错
【发布时间】:2018-03-25 16:36:11
【问题描述】:

我正在尝试使用 python 中的 modred 模块计算正交分解。

当代码执行以下行时:

> myPOD = mr.PODHandles(inner_product,max_vecs_per_node=20) eigvals,
> eigvecs = myPOD.compute_decomp(vec_handles)

我收到以下错误。我不明白这个错误,因为我对 python 很陌生。

Traceback(最近一次调用最后一次):

File "podd.py", line 147, in <module>
    eigvals, eigvecs = myPOD.compute_decomp(vec_handles)  
File "/home/sindhuja/.local/lib/python2.7/site-packages/modred/pod.py", line 326, in compute_decomp
    self.compute_eigendecomp(atol=atol, rtol=rtol)  
File "/home/sindhuja/.local/lib/python2.7/site-packages/modred/pod.py", line 301, in compute_eigendecomp
    is_positive_definite=True)   
File "/home/sindhuja/.local/lib/python2.7/site-packages/modred/parallel.py", line 216, in call_and_bcast
    outputs = func(*args, **kwargs)   
File "/home/sindhuja/.local/lib/python2.7/site-packages/modred/util.py", line 250, in eigh
    eigvals, eigvecs = np.linalg.eigh(np.mat(mat))  
File "/home/sindhuja/.local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 1291, in eigh
    w, vt = gufunc(a, signature=signature, extobj=extobj) 
TypeError: No loop matching the specified signature and casting was found for ufunc eigh_lo

我该如何处理这个错误?

【问题讨论】:

    标签: python eigenvalue eigenvector


    【解决方案1】:

    试试这个:

    eigvals, eigvecs = myPOD_compute_decomp(vec_handles)
    

    这个函数返回两个参数,但你只给一个。

    【讨论】:

    • 堆栈跟踪似乎表明他提供了两个变量进行赋值。此外,术语 argument 用于表示传递给函数的参数,而不是由函数返回。
    猜你喜欢
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 2011-12-11
    • 1970-01-01
    • 1970-01-01
    • 2014-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多