#include "math/dense_blas_internal.h" #include #include namespace fesa::dense_blas_internal { Result ToMklSize(const std::size_t size) { if (size > static_cast((std::numeric_limits::max)())) { return Result::Failure(Status::Failure( {{Severity::kError, "dense-blas-size-overflow", {}, "", "", "Dense operation size exceeds the MKL integer range."}})); } return Result::Success(static_cast(size)); } void CopyValues(const double* source, const std::size_t size, double* destination) { if (size == 0U) { return; } const auto mkl_size = ToMklSize(size); if (!mkl_size.HasValue()) { throw std::length_error{"Dense copy size exceeds the MKL integer range."}; } cblas_dcopy(mkl_size.Value(), source, 1, destination, 1); } } // namespace fesa::dense_blas_internal