小编Tri*_*ion的帖子

复数数组的总和

我有一些复杂的数组,像这样创建:

System.Numerics.Complex[] ValeurPixelsExperiment = new System.Numerics.Complex[132];
System.Numerics.Complex[] ValeurPixelsReference = new System.Numerics.Complex[132];
System.Numerics.Complex[] ValeurPixelsSumExperiment = new System.Numerics.Complex[1024];
System.Numerics.Complex[] ValeurPixelsSumReference = new System.Numerics.Complex[1024];
Run Code Online (Sandbox Code Playgroud)

前两个数组中填充了来自a的一系列像素颜色的蓝色分量Bitmap Couleur.这里,复数都有一个虚部0.现在我希望最后两个数组的每个成员都是前两个数组的所有成员的总和(再次,虚部将为0),但我如果没有在我的循环中添加循环,我找不到"简单"的方法,我不是很喜欢.

我知道我可以使用int或float数而不是复数,这就是我最初所做的,但是当我打算使用AForge.NET框架中的Fast Fourier Transform函数时,我需要我的数据是复杂的形式.所以我不能只使用.Sum()

我希望我足够清楚!有人知道如何实现这个目标吗?

这是我的代码,使用余数.Sum()来自我使用的浮点数,这不起作用:

for (int i = 1; i < 1024; i++)
{
     for (int j = 157; j < 288; j++)
     {
          ValeurPixelsExperiment[j - 156] = Couleur.GetPixel(i, j).B; 
     }
     ValeurPixelsSumExperiment[i] = ValeurPixelsExperiment //.Sum(); I NEED HELP HERE

     for (int j = 484; j < 615; j++)
     {
          ValeurPixelsReference[j - 483] = Couleur.GetPixel(i, …
Run Code Online (Sandbox Code Playgroud)

c# complex-numbers

2
推荐指数
1
解决办法
95
查看次数

标签 统计

c# ×1

complex-numbers ×1