| 96 | |
| 97 | |
| 98 | AnyType |
| 99 | avg_vector_transition::run(AnyType& args) { |
| 100 | AvgVectorState<MutableArrayHandle<double> > state = args[0]; |
| 101 | if (args[1].isNull()) { return args[0]; } |
| 102 | MappedColumnVector x; |
| 103 | try { |
| 104 | MappedColumnVector xx = args[1].getAs<MappedColumnVector>(); |
| 105 | x.rebind(xx.memoryHandle(), xx.size()); |
| 106 | } catch (const ArrayWithNullException &e) { |
| 107 | return args[0]; |
| 108 | } |
| 109 | |
| 110 | if (state.numRows == 0) |
| 111 | state.initialize(*this, static_cast<uint32_t>(x.size())); |
| 112 | else if (x.size() != state.sumOfVectors.size() |
| 113 | || state.numDimensions != |
| 114 | static_cast<uint32_t>(state.sumOfVectors.size())) |
| 115 | throw std::invalid_argument("Invalid arguments: Dimensions of points " |
| 116 | "not consistent."); |
| 117 | |
| 118 | ++state.numRows; |
| 119 | state.sumOfVectors += x; |
| 120 | return state; |
| 121 | } |
| 122 | |
| 123 | AnyType |
| 124 | avg_vector_merge::run(AnyType& args) { |
nothing calls this directly
no test coverage detected