C++ C++;求复浮点多维数组向量的平均值

C++ C++;求复浮点多维数组向量的平均值,c++,multidimensional-array,vector,complex-numbers,moving-average,C++,Multidimensional Array,Vector,Complex Numbers,Moving Average,我想知道是否有任何方法可以将多维数组存储在向量中,并找到数组的平均值。每个数组都包含相同的复杂浮点维数 #include <iostream> #include <vector> template <typename T> class MyGarden : public LittleGarden<T> { public: typedef LittleGarden<T> BaseClass; typedef type

我想知道是否有任何方法可以将多维数组存储在向量中,并找到数组的平均值。每个数组都包含相同的复杂浮点维数

#include <iostream>
#include <vector>

template <typename T> 
class MyGarden : public LittleGarden<T>
{
public:

    typedef LittleGarden<T> BaseClass;
    typedef typename BaseClass::value_type value_type;

    using BaseClass::Flowers_info;
    using BaseClass::Average;
};

 std::vector<array<T>> Collection;
 Collection.push_back(Flowers_info);  
 Average = std::accumulate(Collection.begin(),Collection.end(), 0)/Collection.size();
#包括
#包括
模板
我的花园类别:公共小花园
{
公众:
typedef LittleGarden基类;
typedef typename基类::值\类型值\类型;
使用BaseClass::Flowers\u info;
使用BaseClass::Average;
};
病媒采集;
收藏。推回(花卉信息);
Average=std::accumulate(Collection.begin(),Collection.end(),0)/Collection.size();
但我有一个错误:

error: no match for ‘operator=’ (operand types are ‘array<std::complex<float> >’ and ‘std::vector<array<std::complex<float> >, std::allocator<array<std::complex<float> > > >::size_type {aka long unsigned int}’)
Average = std::accumulate(Collection.begin(),Collection.end(), 0)/Collection.size();
        ^
error: no match for ‘operator+’ (operand types are ‘int’ and ‘array<std::complex<float> >’)  
   __init = __init + *__first;
                   ^
note:mismatched types ‘complext<T>’ and ‘int’
错误:与“operator=”不匹配(操作数类型为“array”和“std::vector::size_type{aka long unsigned int}”)
Average=std::accumulate(Collection.begin(),Collection.end(),0)/Collection.size();
^
错误:“运算符+”不匹配(操作数类型为“int”和“array”)
__init=uuu init+*uuu first;
^
注意:不匹配的类型“complext”和“int”
它在一个.h文件中,当直接使用Flowers\u信息而不进入向量时,它就起作用了,但我想收集大约10个Flowers\u信息,并在使用之前进行平均。现在向量的维数与Flowers_info的维数相同,但是对这些复数的多维数组进行平均是相当困难的。我自己解决不了这个问题,有人能给我一个建议吗


多谢各位

“阵列的平均值”是多少?哪里有多维数组?您需要将一个函子传递给
std::acculate
,它知道如何处理两个
std::array>
。请参见。另外,这个
数组是什么
std::array
有两个参数,即元素的类型和数量。什么是花信息的类型?如编译器错误所示,Flower_info的类型没有定义
运算符=
运算符+
。类型
数组
没有这些运算符。“数组的平均值”是多少?哪里有多维数组?您需要将一个函子传递给
std::acculate
,它知道如何处理两个
std::array>
。请参见。另外,这个
数组是什么
std::array
有两个参数,即元素的类型和数量。什么是花信息的类型?如编译器错误所示,Flower_info的类型没有定义
运算符=
运算符+
。类型
数组
没有这些运算符。