Added boundaryvalues(), fixed indexing bug in matrix_abs_max()
Added calculate_fg()