Open main menu

CDOT Wiki β

Changes

BLAStoise

66 bytes removed, 19:19, 12 February 2017
Assignment 1
Below is a snippet of the code:
<nowikipre>
void Solver::fill_edit_matrix() {
all_columns.resize(row_num + 1, vector<int>(column_num + 1, 0)); all_rows.resize(row_num + 1, vector<int>(column_num + 1, 0)); top_left_costs.resize(row_num + 1, vector<int>(column_num + 1, 0));
int initialVector = 0; for (int i = 0; i < submatrix_dim; i++){ initialVector = initialVector * 10 + 2; // 222 == "222" == (1, 1, 1) }
// padding string b step vectors for (int submatrix_j = 1; submatrix_j <= column_num; submatrix_j++) { if ((submatrix_j * submatrix_dim - 1) >= string_b_real_size) { vector<int> temp_vec(submatrix_dim, 0); for (int i = 0; i < (string_b_real_size - ((submatrix_j - 1) * submatrix_dim)); i++) temp_vec[i] = 1; all_rows[0][submatrix_j] = SubmatrixCalculator::stepsToInt(temp_vec); } else { all_rows[0][submatrix_j] = initialVector; } }
// padding string a step vectors for (int submatrix_i = 1; submatrix_i <= row_num; submatrix_i++) { if ((submatrix_i * submatrix_dim - 1) >= string_a_real_size) { vector<int> temp_vec(submatrix_dim, 0); for (int i = 0; i < (string_a_real_size - ((submatrix_i - 1) * submatrix_dim)); i++) temp_vec[i] = 1; all_columns[submatrix_i][0] = SubmatrixCalculator::stepsToInt(temp_vec); } else { all_columns[submatrix_i][0] = initialVector; } }
for (int submatrix_i = 1; submatrix_i <= row_num; submatrix_i++) { if ((submatrix_i - 1) * submatrix_dim > string_a_real_size) top_left_costs[submatrix_i][1] = string_a_real_size; else top_left_costs[submatrix_i][1] = (submatrix_i - 1) * submatrix_dim;
for (int submatrix_j = 1; submatrix_j <= column_num; submatrix_j++) {
pair<int, int> final_steps = subm_calc->resultIndex[ // offset calculation str_a_offsets[submatrix_i] + // left string str_b_offsets[submatrix_j] + // top string // left steps subm_calc->stepOffsets[0][all_columns[submatrix_i][submatrix_j - 1]] + // top steps subm_calc->stepOffsets[1][all_rows[submatrix_i - 1][submatrix_j]] ];
all_columns[submatrix_i][submatrix_j] = final_steps.first; all_rows[submatrix_i][submatrix_j] = final_steps.second;
if (submatrix_j != 1) { top_left_costs[submatrix_i][submatrix_j] = top_left_costs[submatrix_i][submatrix_j - 1]; top_left_costs[submatrix_i][submatrix_j] += subm_calc->sumSteps( all_rows[submatrix_i - 1][submatrix_j - 1]); } }
}
}
}}</nowikipre>
=== Assignment 2 ===
=== Assignment 3 ===
26
edits