Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 复杂二维矩阵上函数的np和cm迭代_Python_Python 3.x - Fatal编程技术网

Python 复杂二维矩阵上函数的np和cm迭代

Python 复杂二维矩阵上函数的np和cm迭代,python,python-3.x,Python,Python 3.x,如何使用fct迭代二维矩阵 在伪代码中,它应该如下所示: import cmath as cm matrixphase = 0 complexmatrix = fouriertransformation of an image for each entry: matrixphase[i,j]= cm.phase(complexmatrix[i,j]) print(matrix phase) 我认为这个问题有一个非常简单的解决方案,但我只是不知道怎么解决。你的问题没有提到一个名为sou

如何使用fct迭代二维矩阵

在伪代码中,它应该如下所示:

import cmath as cm
matrixphase = 0
complexmatrix = fouriertransformation of an image

for each entry:
    matrixphase[i,j]= cm.phase(complexmatrix[i,j])
print(matrix phase)

我认为这个问题有一个非常简单的解决方案,但我只是不知道怎么解决。

你的问题没有提到一个名为
source
的列表, 但是想象一下我们有一个。 然后一个C程序员可能会使用嵌套的
i
j
进行循环,
而蟒蛇学家倾向于:

如果要显示项目或计算简单的总和, 所以不需要指标,, 那么这就足够了:

for row in source:
    for item in row:
        ...

您的问题没有提到名为
source
的列表, 但是想象一下我们有一个。 然后一个C程序员可能会使用嵌套的
i
j
进行循环,
而蟒蛇学家倾向于:

如果要显示项目或计算简单的总和, 所以不需要指标,, 那么这就足够了:

for row in source:
    for item in row:
        ...

你可能是对的,这可能很容易。但你并没有给我们太多的支持。向我们展示您迄今为止编写的代码,即使当前代码是“错误的”。好的,我确实找到了一个非常简单的方法。如果python中没有比这更优雅的东西,那么仍然有可能运行一个简单的for case:在我的例子中:
对于范围内的i(len(source)):对于范围内的j(len(source[i]):
你可能是对的,这可能很简单。但你并没有给我们太多的支持。向我们展示您迄今为止编写的代码,即使当前代码是“错误的”。好的,我确实找到了一个非常简单的方法。如果python中没有比这更优雅的东西,那么仍然有可能运行一个简单的for case:在我的例子中是这样的:
for i in range(len(source)):for j in range(len(source[i]):