void bi::inverse_gamma_log_densities(const M1 Z, const T1 alpha, const T1 beta, V1 p, const bool clear) { /* pre-condition */ BI_ASSERT(Z.size1() == p.size()); op_elements(vec(Z), vec(Z), inverse_gamma_log_density_functor<T1>(alpha, beta)); if (clear) { sum_columns(Z, p); } else { typename sim_temp_vector<V1>::type p1(p.size()); sum_columns(Z, p1); add_elements(p, p1, p); } }
int main(void) { double sales[NUM_SALES_PEOPLE][NUM_QUARTERS]; /* table of sales */ double person_totals[NUM_SALES_PEOPLE]; /* row totals */ double quarter_totals[NUM_QUARTERS]; /* column totals */ int status; status = scan_table(sales, NUM_SALES_PEOPLE); if (status == 1) { sum_rows(person_totals, sales, NUM_SALES_PEOPLE); sum_columns(quarter_totals, sales, NUM_SALES_PEOPLE); display_table(sales, person_totals, quarter_totals, NUM_SALES_PEOPLE); } return (0); }