void matrix_t::mostrarMatriz(void) { char aux[80]; if (traspuesta_ == false) { for(int i=1;i<=m_;i++){ std::cout << "|"; for(int j=1;j<=n_;j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); cout << aux; } std::cout << " |"; cout << endl; } cout << endl; } else { for(int i=1;i<=n_;i++){ std::cout << "|"; for(int j=1;j<=m_;j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); cout << aux; } std::cout << " |"; cout << endl; } cout << endl; } }
void matrix_t::filtra(matrix_t& M, matrix_item_t it, double precision){ matrix_inx_t m = get_m(); matrix_inx_t n = get_n(); M.redimensiona(m, n); for (int i = 1; i < m; i++) { for (int j = 1; j < n ; j++) { if (M.igual(get_matrix_item(i, j),it,precision) == true) { M.set_matrix_item(i, j, get_matrix_item(i, j)); } else { matrix_item_t x = 0.00000; M.set_matrix_item(i, j, x); } } } }
ostream& matrix_t::write(ostream& os) { char aux[80]; sprintf(aux, " %10d %10d ",get_m(),get_n()); os << aux<<endl; for(int i=1;i<=get_m();i++){ for(int j=1;j<=get_n();j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); os << aux; } os << endl; } }
ostream& matrix_t::write(ostream& os) { char aux[80]; sprintf(aux, " %10d %10d ",m_,n_); os << aux<<endl; if (traspuesta_ == false) { for(int i=1;i<=m_;i++){ for(int j=1;j<=n_;j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); os << aux; } os << endl; } } else { for(int i=1;i<=n_;i++){ for(int j=1;j<=m_;j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); os << aux; } os << endl; } } }
void matrix_t::mostrarMatriz(void) { char aux[80]; for(int i=1;i<=get_m();i++){ for(int j=1;j<=get_n();j++){ sprintf(aux," %10.6lf ",get_matrix_item(i,j)); cout << aux; } cout << endl; } cout << endl; }