From 7ddd65dda5754ee23d64f53fd07e5cb8545853cb Mon Sep 17 00:00:00 2001 From: Kai Zhao Date: Wed, 11 Dec 2024 15:40:58 -0500 Subject: [PATCH] add static_assert --- include/SZ3/decomposition/InterpolationDecomposition.hpp | 2 +- include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp | 5 +++-- include/SZ3/decomposition/NoPredictionDecomposition.hpp | 2 +- include/SZ3/decomposition/TimeSeriesDecomposition.hpp | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/SZ3/decomposition/InterpolationDecomposition.hpp b/include/SZ3/decomposition/InterpolationDecomposition.hpp index 2237e366..e582fc2f 100644 --- a/include/SZ3/decomposition/InterpolationDecomposition.hpp +++ b/include/SZ3/decomposition/InterpolationDecomposition.hpp @@ -20,7 +20,7 @@ class InterpolationDecomposition : public concepts::DecompositionInterface, Quantizer>::value, - "must implement the quatizer interface"); + "must implement the quantizer interface"); } T *decompress(const Config &conf, std::vector &quant_inds, T *dec_data) override { diff --git a/include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp b/include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp index 0ef5a892..de25f33f 100644 --- a/include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp +++ b/include/SZ3/decomposition/LorenzoRegressionDecomposition.hpp @@ -30,12 +30,13 @@ class LorenzoRegressionDecomposition : public concepts::DecompositionInterface, Quantizer>::value, + "must implement the quantizer interface"); + if (N != 1 && N != 3) { fprintf(stderr, "SZMeta Front only support 1D or 3D data\n"); throw std::invalid_argument("SZMeta Front only support 1D or 3D data"); } - static_assert(std::is_base_of, Quantizer>::value, - "must implement the quatizer interface"); } ~LorenzoRegressionDecomposition() override { clear(); } diff --git a/include/SZ3/decomposition/NoPredictionDecomposition.hpp b/include/SZ3/decomposition/NoPredictionDecomposition.hpp index 13c1f5d8..976f47de 100644 --- a/include/SZ3/decomposition/NoPredictionDecomposition.hpp +++ b/include/SZ3/decomposition/NoPredictionDecomposition.hpp @@ -12,7 +12,7 @@ class NoPredictionDecomposition : public concepts::DecompositionInterface, Quantizer>::value, - "must implement the quatizer interface"); + "must implement the quantizer interface"); } T *decompress(const Config &conf, std::vector &quant_inds, T *dec_data) override { diff --git a/include/SZ3/decomposition/TimeSeriesDecomposition.hpp b/include/SZ3/decomposition/TimeSeriesDecomposition.hpp index bc9c0fa9..e0509096 100644 --- a/include/SZ3/decomposition/TimeSeriesDecomposition.hpp +++ b/include/SZ3/decomposition/TimeSeriesDecomposition.hpp @@ -23,6 +23,10 @@ class TimeSeriesDecomposition : public concepts::DecompositionInterface, Predictor>::value, + "must implement the predictor interface"); + static_assert(std::is_base_of, Quantizer>::value, + "must implement the quantizer interface"); assert((conf.dims.size() == 2) && "timestep prediction requires 2d dataset"); global_dimensions[0] = conf.dims[0]; global_dimensions[1] = conf.dims[1];