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

Method run

src/modules/linalg/svd.cpp:80–100  ·  view source on GitHub ↗

* @brief This function returns a random normalized unit vector of specified size * @param args[0] The dimension * @return The unit-norm vector **/

Source from the content-addressed store, hash-verified

78 * @return The unit-norm vector
79 **/
80AnyType svd_unit_vector::run(AnyType & args)
81{
82 int32_t dim = args[0].getAs<int32_t>();
83
84 if(dim < 1){
85 throw std::invalid_argument(
86 "invalid argument - Positive integer expected for dimension");
87 }
88
89 MutableNativeColumnVector vectorEigen;
90 Allocator& allocator = defaultAllocator();
91 vectorEigen.rebind(allocator.allocateArray<double>(dim));
92 vectorEigen.setRandom();
93 vectorEigen = vectorEigen.normalized();
94
95 // AnyType tuple;
96 // tuple << vectorEigen;
97 // return tuple;
98
99 return vectorEigen;
100}
101
102/**
103 * @brief This function is the transition function of the aggregator computing the Lanczos vectors

Callers

nothing calls this directly

Calls 7

__projectFunction · 0.85
madlib_construct_arrayFunction · 0.50
rebindMethod · 0.45
sizeMethod · 0.45
isNullMethod · 0.45
ptrMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected