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

Method initialize

src/modules/convex/type/model.hpp:43–59  ·  view source on GitHub ↗

* @brief Initialize the model randomly with a user-provided scale factor */

Source from the content-addressed store, hash-verified

41 * @brief Initialize the model randomly with a user-provided scale factor
42 */
43 void initialize(const double &inScaleFactor) {
44 // using madlib::dbconnector::$database::NativeRandomNumberGenerator
45 NativeRandomNumberGenerator rng;
46 int i, j, rr;
47 double base = rng.min();
48 double span = rng.max() - base;
49 for (rr = 0; rr < matrixU.cols(); rr ++) {
50 for (i = 0; i < matrixU.rows(); i ++) {
51 matrixU(i, rr) = inScaleFactor * (rng() - base) / span;
52 }
53 }
54 for (rr = 0; rr < matrixV.cols(); rr ++) {
55 for (j = 0; j < matrixV.rows(); j ++) {
56 matrixV(j, rr) = inScaleFactor * (rng() - base) / span;
57 }
58 }
59 }
60
61 /*
62 * Some operator wrappers for two matrices.

Callers 5

runMethod · 0.45
NewtonMethod · 0.45
OrdinalAccumulatorMethod · 0.45
GLMAccumulatorMethod · 0.45

Calls 2

minMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected