From 4b44fcb6fdabec78386eca9e2fc6b4fe617341e7 Mon Sep 17 00:00:00 2001 From: Semyon1104 Date: Tue, 26 Nov 2024 18:05:23 +0300 Subject: [PATCH] fix cerr --- tasks/mpi/titov_s_simple_iteration/src/ops_mpi.cpp | 5 ----- tasks/seq/titov_s_simple_iteration/src/ops_seq.cpp | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/tasks/mpi/titov_s_simple_iteration/src/ops_mpi.cpp b/tasks/mpi/titov_s_simple_iteration/src/ops_mpi.cpp index 78b0344167..ca1087041f 100644 --- a/tasks/mpi/titov_s_simple_iteration/src/ops_mpi.cpp +++ b/tasks/mpi/titov_s_simple_iteration/src/ops_mpi.cpp @@ -16,9 +16,6 @@ using namespace std::chrono_literals; void titov_s_simple_iteration_mpi::MPISimpleIterationSequential::transformMatrix() { for (unsigned int i = 0; i < rows_; ++i) { float diagonal = input_[i * cols_ + i]; - if (diagonal == 0.0f) { - throw std::runtime_error("Diagonal element is zero, cannot transform matrix."); - } for (unsigned int j = 0; j < cols_ - 1; ++j) { if (i != j) { input_[i * cols_ + j] = -input_[i * cols_ + j] / diagonal; @@ -65,7 +62,6 @@ bool titov_s_simple_iteration_mpi::MPISimpleIterationSequential::pre_processing( auto* epsilon_ptr = reinterpret_cast(taskData->inputs[rows_]); epsilon_ = *epsilon_ptr; if (!isDiagonallyDominant()) { - std::cerr << "Matrix is not diagonally dominant. The method may not converge.\n"; return false; } @@ -78,7 +74,6 @@ bool titov_s_simple_iteration_mpi::MPISimpleIterationSequential::validation() { internal_order_test(); if (taskData->inputs_count.empty() || taskData->inputs.empty()) { - std::cerr << "Validation failed: inputs_count or inputs is empty.\n"; return false; } diff --git a/tasks/seq/titov_s_simple_iteration/src/ops_seq.cpp b/tasks/seq/titov_s_simple_iteration/src/ops_seq.cpp index 4031b56862..e29b692c71 100644 --- a/tasks/seq/titov_s_simple_iteration/src/ops_seq.cpp +++ b/tasks/seq/titov_s_simple_iteration/src/ops_seq.cpp @@ -8,9 +8,6 @@ using namespace std::chrono_literals; void titov_s_simple_iteration_seq::SimpleIterationSequential::transformMatrix() { for (unsigned int i = 0; i < rows_; ++i) { float diagonal = input_[i * cols_ + i]; - if (diagonal == 0.0f) { - throw std::runtime_error("Diagonal element is zero, cannot transform matrix."); - } for (unsigned int j = 0; j < cols_ - 1; ++j) { if (i != j) { @@ -47,7 +44,6 @@ bool titov_s_simple_iteration_seq::SimpleIterationSequential::validation() { internal_order_test(); if (taskData->inputs_count.empty() || taskData->inputs.empty()) { - std::cerr << "Validation failed: inputs_count or inputs is empty.\n"; return false; } @@ -55,36 +51,30 @@ bool titov_s_simple_iteration_seq::SimpleIterationSequential::validation() { unsigned int cols = taskData->inputs_count[1]; if (taskData->inputs.size() < rows + 1) { - std::cerr << "Validation failed: inputs size is less than expected (rows + 1).\n"; return false; } if (rows == 0 || cols == 0) { - std::cerr << "Validation failed: rows or cols is 0.\n"; return false; } for (unsigned int i = 0; i < rows; ++i) { auto* tmp_ptr = reinterpret_cast(taskData->inputs[i]); if (tmp_ptr == nullptr) { - std::cerr << "Validation failed: inputs[" << i << "] is nullptr.\n"; return false; } } auto* epsilon_ptr = reinterpret_cast(taskData->inputs[rows]); if (epsilon_ptr == nullptr) { - std::cerr << "Validation failed: epsilon_ptr is nullptr.\n"; return false; } float epsilon = *epsilon_ptr; if (epsilon <= 0.0f || epsilon > 1.0f) { - std::cerr << "Validation failed: epsilon (" << epsilon << ") is out of range.\n"; return false; } if (taskData->outputs_count.empty() || taskData->outputs_count[0] < 1) { - std::cerr << "Validation failed: outputs_count is invalid.\n"; return false; }