Skip to content

Commit

Permalink
Merge pull request #1100 from cwpearson/fix/read-integer-mtx-into-fp
Browse files Browse the repository at this point in the history
Allow reading integer mtx files into floating-point matrices
  • Loading branch information
lucbv authored Sep 13, 2021
2 parents a901b87 + e57e0a9 commit 17574ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/KokkosKernels_IOUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,9 @@ int read_mtx (
mtx_field = COMPLEX;
}
else if (fline.find("integer") != std::string::npos){
if(std::is_integral<scalar_t>::value)
if(std::is_integral<scalar_t>::value
|| std::is_floating_point<scalar_t>::value
|| std::is_same<scalar_t,Kokkos::Experimental::half_t>::value)
mtx_field = INTEGER;
else
throw std::runtime_error("scalar_t in read_mtx() incompatible with integer-typed MatrixMarket file.");
Expand Down

0 comments on commit 17574ed

Please sign in to comment.