我在使用inner_product
来合并std::vector<float>
和std::vector<std::vector<float>>
时遇到困难。考虑到,例如,<2,3>
和<<4,5>,<6,7>>
,我想inner_product
生产正在调用inner_product(C++ STL)的自定义调用
2*<4,5> + 3*<6,7> = <8,10> + <18,21> = <26,31>.
假设
vector<float> foo;
和
vector<vector<float>> bar;
初始化和大小相同,我不知道什么UK1
,UK2
和UK3
在
应该是。我怀疑UK1
应该是vector
填充0.0f
s,其大小与bar
中的vector
s大小相同。 UK3
或许应该是这样的
std::transform(UK4.begin(), UK4.end(), UK4.begin(),
std::bind1st(std::multiplies<float>(), UK5));
我猜UK2
应该以某种方式代表逐分量vector<float>
除了!
我甚至不想去思考如何更复杂时bar
的载体是通过与float
属性的类的对象替换,这将成为...