MCPcopy Create free account
hub / github.com/apache/madlib / run

Method run

src/modules/linalg/average.cpp:98–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98AnyType
99avg_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
123AnyType
124avg_vector_merge::run(AnyType& args) {

Callers

nothing calls this directly

Calls 4

isNullMethod · 0.45
rebindMethod · 0.45
sizeMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected