From 2ce5da95b0c18d564b882240198462b8a2d6e426 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Mon, 3 Feb 2025 15:41:30 +0800 Subject: [PATCH] tmp --- lib/core/array.h | 17 +++++++---------- lib/core/exceptions.h | 18 +++++++++--------- lib/core/matrix.h | 4 ++-- lib/core/spmat.h | 4 ++-- lib/core/vector_t.h | 16 ++++++++-------- lib/utility/stream_t.h | 6 +++--- 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/lib/core/array.h b/lib/core/array.h index 3b63eb0..e6e7d1f 100644 --- a/lib/core/array.h +++ b/lib/core/array.h @@ -62,8 +62,8 @@ namespace gctl typedef array _1f_array; ///< 1-D single-precision floating-point array typedef array _1d_array; ///< 1-D double-precision floating-point array typedef array _1s_array; ///< 1-D string array - typedef array> _1cf_array; ///< 1-D complex float array - typedef array> _1cd_array; ///< 1-D complex double array + typedef array > _1cf_array; ///< 1-D complex float array + typedef array > _1cd_array; ///< 1-D complex double array /** * @brief Iterator template. This could be used to enable the use of iteration algorithms for array-like objects. @@ -145,7 +145,7 @@ namespace gctl * * @param init_val Initial values */ - array(std::initializer_list init_val); + array(std::vector init_val); /** * @brief Construct a new array object as a sequence @@ -394,7 +394,7 @@ namespace gctl * * @param init_val Initial values */ - void resize(std::initializer_list init_val); + void resize(std::vector init_val); /** * @brief Resize a new array object as a sequence @@ -894,7 +894,7 @@ namespace gctl } template - array::array(std::initializer_list init_val) + array::array(std::vector init_val) { length_ = 0; val_ = nullptr; @@ -1244,15 +1244,12 @@ namespace gctl } template - void array::resize(std::initializer_list init_val) + void array::resize(std::vector init_val) { resize(init_val.size()); - - typename std::initializer_list::iterator iter = init_val.begin(); for (size_t i = 0; i < length_; i++) { - val_[i] = *iter; - iter++; + val_[i] = init_val[i]; } return; } diff --git a/lib/core/exceptions.h b/lib/core/exceptions.h index bdab956..5d7c03d 100644 --- a/lib/core/exceptions.h +++ b/lib/core/exceptions.h @@ -114,7 +114,7 @@ namespace gctl public: runtime_error() : std::runtime_error("GCTL: Unexpected runtime error."){} runtime_error(std::string estr) : std::runtime_error(("GCTL: Unexpected runtime error. "+estr).c_str()){} - virtual ~runtime_error(){} + //virtual ~runtime_error(){} }; class range_error : public std::range_error @@ -122,7 +122,7 @@ namespace gctl public: range_error() : std::range_error("GCTL: Invalid range detected."){} range_error(std::string estr) : std::range_error(("GCTL: Invalid range detected. "+estr).c_str()){} - virtual ~range_error(){} + //virtual ~range_error(){} }; class overflow_error : public std::overflow_error @@ -130,7 +130,7 @@ namespace gctl public: overflow_error() : std::overflow_error("GCTL: Overflow error."){} overflow_error(std::string estr) : std::overflow_error(("GCTL: Overflow error. "+estr).c_str()){} - virtual ~overflow_error(){} + //virtual ~overflow_error(){} }; class underflow_error : public std::underflow_error @@ -138,7 +138,7 @@ namespace gctl public: underflow_error() : std::underflow_error("GCTL: Underflow error."){} underflow_error(std::string estr) : std::underflow_error(("GCTL: Underflow error. "+estr).c_str()){} - virtual ~underflow_error(){} + //virtual ~underflow_error(){} }; @@ -147,7 +147,7 @@ namespace gctl public: logic_error() : std::logic_error("GCTL: Logic error."){} logic_error(std::string estr) : std::logic_error(("GCTL: Logic error. "+estr).c_str()){} - virtual ~logic_error(){} + //virtual ~logic_error(){} }; class domain_error : public std::domain_error @@ -155,7 +155,7 @@ namespace gctl public: domain_error() : std::domain_error("GCTL: Domain error."){} domain_error(std::string estr) : std::domain_error(("GCTL: Domain error. "+estr).c_str()){} - virtual ~domain_error(){} + //virtual ~domain_error(){} }; class invalid_argument : public std::invalid_argument @@ -163,7 +163,7 @@ namespace gctl public: invalid_argument() : std::invalid_argument("GCTL: Invalid argument."){} invalid_argument(std::string estr) : std::invalid_argument(("GCTL: Invalid argument. "+estr).c_str()){} - virtual ~invalid_argument(){} + //virtual ~invalid_argument(){} }; class length_error : public std::length_error @@ -171,7 +171,7 @@ namespace gctl public: length_error() : std::length_error("GCTL: Length error."){} length_error(std::string estr) : std::length_error(("GCTL: Length error. "+estr).c_str()){} - virtual ~length_error(){} + //virtual ~length_error(){} }; class out_of_range : public std::out_of_range @@ -179,7 +179,7 @@ namespace gctl public: out_of_range() : std::out_of_range("GCTL: Out of range."){} out_of_range(std::string estr) : std::out_of_range(("GCTL: Out of range. "+estr).c_str()){} - virtual ~out_of_range(){} + //virtual ~out_of_range(){} }; } diff --git a/lib/core/matrix.h b/lib/core/matrix.h index 022af98..d4fd98b 100644 --- a/lib/core/matrix.h +++ b/lib/core/matrix.h @@ -45,8 +45,8 @@ namespace gctl typedef matrix _2f_matrix; ///< 2-D single-precision floating-point array typedef matrix _2d_matrix; ///< 2-D double-precision floating-point array typedef matrix _2s_matrix; ///< 2-D string array - typedef matrix> _2cf_matrix; ///< 1-D complex float array - typedef matrix> _2cd_matrix; ///< 1-D complex double array + typedef matrix > _2cf_matrix; ///< 1-D complex float array + typedef matrix > _2cd_matrix; ///< 1-D complex double array /** * @brief 二维数组模版 diff --git a/lib/core/spmat.h b/lib/core/spmat.h index 23ff26b..2283454 100644 --- a/lib/core/spmat.h +++ b/lib/core/spmat.h @@ -42,8 +42,8 @@ namespace gctl typedef spmat _1i_spmat; ///< 整形浮点稀疏矩阵 typedef spmat _1f_spmat; ///< 单精度浮点稀疏矩阵 typedef spmat _1d_spmat; ///< 双精度浮点稀疏矩阵 - typedef spmat> _1cf_spmat; ///< 单精度复浮点稀疏矩阵 - typedef spmat> _1cd_spmat; ///< 双精度复浮点稀疏矩阵 + typedef spmat > _1cf_spmat; ///< 单精度复浮点稀疏矩阵 + typedef spmat > _1cd_spmat; ///< 双精度复浮点稀疏矩阵 /** * @brief 稀疏矩阵的节点元素类型 diff --git a/lib/core/vector_t.h b/lib/core/vector_t.h index 4e17d3b..b142c57 100644 --- a/lib/core/vector_t.h +++ b/lib/core/vector_t.h @@ -41,14 +41,14 @@ namespace gctl typedef std::vector _1f_vector; ///< 1-D single-precision floating-point vector typedef std::vector _1d_vector; ///< 1-D double-precision floating-point vector typedef std::vector _1s_vector; ///< 1-D string vector - typedef std::vector> _1cf_vector; ///< 1-D complex float vector - typedef std::vector> _1cd_vector; ///< 1-D complex double vector - typedef std::vector> _2i_vector; ///< 2-D integer vector - typedef std::vector> _2f_vector; ///< 2-D single-precision floating-point vector - typedef std::vector> _2d_vector; ///< 2-D double-precision floating-point vector - typedef std::vector> _2s_vector; ///< 2-D string vector - typedef std::vector>> _2cf_vector; ///< 2-D complex float vector - typedef std::vector>> _2cd_vector; ///< 2-D complex double vector + typedef std::vector > _1cf_vector; ///< 1-D complex float vector + typedef std::vector > _1cd_vector; ///< 1-D complex double vector + typedef std::vector > _2i_vector; ///< 2-D integer vector + typedef std::vector > _2f_vector; ///< 2-D single-precision floating-point vector + typedef std::vector > _2d_vector; ///< 2-D double-precision floating-point vector + typedef std::vector > _2s_vector; ///< 2-D string vector + typedef std::vector > > _2cf_vector; ///< 2-D complex float vector + typedef std::vector > > _2cd_vector; ///< 2-D complex double vector /** * @brief Clear the memory space used by a 1-D vector diff --git a/lib/utility/stream_t.h b/lib/utility/stream_t.h index 3ce85cb..fb83a7f 100644 --- a/lib/utility/stream_t.h +++ b/lib/utility/stream_t.h @@ -132,7 +132,7 @@ namespace gctl } template - void str2type_vector2d(const std::vector> &vec2d, + void str2type_vector2d(const std::vector > &vec2d, std::string order_str, std::vector &vec) { int idx; @@ -174,7 +174,7 @@ namespace gctl } template - void type2str_vector2d(std::vector> &vec2d, + void type2str_vector2d(std::vector > &vec2d, const std::vector &vec) { std::vector str_vec; @@ -185,7 +185,7 @@ namespace gctl } template - void type2str_vector2d(std::vector> &vec2d, + void type2str_vector2d(std::vector > &vec2d, const std::vector &vec, Args&... rest) { std::vector str_vec;