37 m_trace_sampler=trace_sampler;
40 m_operator_log=operator_log;
43 m_computation_engine=computation_engine;
44 SG_REF(m_computation_engine);
47 void CLogDetEstimator::init()
51 m_computation_engine=NULL;
73 SG_INFO(
"Computing %d log-det estimates\n", num_estimates);
75 REQUIRE(m_operator_log,
"Operator function is NULL\n");
79 REQUIRE(m_trace_sampler,
"Trace sampler is NULL\n");
85 "Mismatch in dimensions of the operator and trace-sampler, %d vs %d!\n",
93 for (
index_t i=0; i<num_estimates; ++i)
95 for (
index_t j=0; j<num_trace_samples; ++j)
97 SG_INFO(
"Computing log-determinant trace sample %d/%d\n", j,
100 SG_DEBUG(
"Creating job for estimate %d, trace sample %d/%d\n", i, j,
106 aggregators->append_element(agg);
111 REQUIRE(m_computation_engine,
"Computation engine is NULL\n");
114 SG_INFO(
"Waiting for jobs to finish\n");
116 SG_INFO(
"All jobs finished, aggregating results\n");
124 int32_t num_aggregates=aggregators->get_num_elements();
127 for (int32_t i=0; i<num_aggregates; ++i)
131 (aggregators->get_element(i));
143 if (idx_row>=num_trace_samples)
155 SG_INFO(
"Finished computing %d log-det estimates\n", num_estimates);
166 REQUIRE(m_operator_log,
"Operator function is NULL\n");
170 REQUIRE(m_trace_sampler,
"Trace sampler is NULL\n");
178 for (
index_t i=0; i<num_estimates; ++i)
180 for (
index_t j=0; j<num_trace_samples; ++j)
191 REQUIRE(m_computation_engine,
"Computation engine is NULL\n");
201 for (int32_t i=0; i<num_aggregates; ++i)
206 SG_ERROR(
"Element is not CJobResultAggregator type!\n");
213 SG_ERROR(
"Result is not CScalarResult type!\n");
216 index_t idx_row=i%num_trace_samples;
217 index_t idx_col=i/num_trace_samples;