Comment rewrite
This commit is contained in:
+37
-49
@@ -35,10 +35,11 @@
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// INCLUDE DESCRIPTION
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
#include <io/print_tensor.hpp>
|
||||
#include <iostream> // for std::cout, std::endl
|
||||
//#include <io/print_tensor.hpp>
|
||||
#include <tensor/vector.hpp> // for panic::tensor::vector
|
||||
#include <tensor/matrix.hpp>
|
||||
|
||||
#include <tensor/vector.hpp> // for panic::vector
|
||||
#include <tensor/matrix.hpp> // for panic::matrix
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// DEFINE DESCRIPTION
|
||||
@@ -61,32 +62,32 @@ namespace panic {
|
||||
//
|
||||
// Description:
|
||||
// The vector is printed out in square brackets.
|
||||
// Overloaded for panic::uint, panic::int and panic::real
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void print_vector(const panic::tensor::uint_vector& v){
|
||||
template <typename T>
|
||||
bool print_vector(const panic::tensor::vector<T>& v){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < v.size()-1; ++i){
|
||||
std::cout << v[i] << ", ";
|
||||
}
|
||||
std::cout << v[v.size()-1]<< "]" << std::endl;
|
||||
|
||||
}
|
||||
void print_vector(const panic::tensor::int_vector& v){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < v.size()-1; ++i){
|
||||
std::cout << v[i] << ", ";
|
||||
}
|
||||
std::cout << v[v.size()-1]<< "]" << std::endl;
|
||||
return true;
|
||||
|
||||
}
|
||||
void print_vector(const panic::tensor::real_vector& v){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < v.size()-1; ++i){
|
||||
std::cout << v[i] << ", ";
|
||||
}
|
||||
std::cout << v[v.size()-1]<< "]" << std::endl;
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// EXPLICIT TEMPLATE INSTANTIATION
|
||||
//
|
||||
// The implementation is in this .cpp file.
|
||||
// Build the overload for the official PANIC numeric types.
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
template bool print_vector<panic::types::uint_t>(const panic::tensor::vector<panic::types::uint_t>& v
|
||||
);
|
||||
template bool print_vector<panic::types::int_t>(const panic::tensor::vector<panic::types::int_t>& v
|
||||
);
|
||||
template bool print_vector<panic::types::real_t>(const panic::tensor::vector<panic::types::real_t>& v
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,9 +96,9 @@ void print_vector(const panic::tensor::real_vector& v){
|
||||
//
|
||||
// Description:
|
||||
// The matrix is printed out in square brackets.
|
||||
// Overloaded for panic::uint, panic::int and panic::real
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void print_matrix(const panic::tensor::uint_matrix& A){
|
||||
template <typename T>
|
||||
bool print_matrix(const panic::tensor::matrix<T>& A){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < A.rows(); ++i){
|
||||
std::cout << "[";
|
||||
@@ -110,37 +111,24 @@ void print_matrix(const panic::tensor::uint_matrix& A){
|
||||
std::cout << A(A.rows()-1,A.cols()-1) << "]]" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void print_matrix(const panic::tensor::int_matrix& A){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < A.rows(); ++i){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t j = 0; j < A.cols(); ++j){
|
||||
std::cout << A(i,j) << ", ";
|
||||
}
|
||||
if (i < A.rows()-1){
|
||||
std::cout << A(A.rows()-1,A.cols()-1) << "]" << std::endl;
|
||||
}else{
|
||||
std::cout << A(A.rows()-1,A.cols()-1) << "]]" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// EXPLICIT TEMPLATE INSTANTIATION
|
||||
//
|
||||
// The implementation is in this .cpp file.
|
||||
// Build the overload for the official PANIC numeric types.
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
template bool print_matrix<panic::types::uint_t>(const panic::tensor::matrix<panic::types::uint_t>& A
|
||||
);
|
||||
template bool print_matrix<panic::types::int_t>(const panic::tensor::matrix<panic::types::int_t>& A
|
||||
);
|
||||
template bool print_matrix<panic::types::real_t>(const panic::tensor::matrix<panic::types::real_t>& A
|
||||
);
|
||||
|
||||
|
||||
void print_matrix(const panic::tensor::real_matrix& A){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t i = 0; i < A.rows(); ++i){
|
||||
std::cout << "[";
|
||||
for (panic::types::uint_t j = 0; j < A.cols(); ++j){
|
||||
std::cout << A(i,j) << ", ";
|
||||
}
|
||||
if (i < A.rows()-1){
|
||||
std::cout << A(A.rows()-1,A.cols()-1) << "]" << std::endl;
|
||||
}else{
|
||||
std::cout << A(A.rows()-1,A.cols()-1) << "]]" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace io
|
||||
|
||||
Reference in New Issue
Block a user