diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index abfd15ad..cef9a029 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -14,10 +14,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] env: - CC: gcc-10 - CXX: g++-10 + CC: gcc-12 + CXX: g++-12 # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 678aa846..7956d2ad 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,10 +15,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] env: - CC: gcc-10 - CXX: g++-10 + CC: gcc-12 + CXX: g++-12 # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -105,7 +105,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e6f2f2b..a41815ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,10 +16,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-22.04, ubuntu-24.04 ] env: - CC: gcc-10 - CXX: g++-10 + CC: gcc-12 + CXX: g++-12 # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/rust_build.yml b/.github/workflows/rust_build.yml index b3436cf1..c4cfccc6 100644 --- a/.github/workflows/rust_build.yml +++ b/.github/workflows/rust_build.yml @@ -20,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ windows-latest,ubuntu-20.04, ubuntu-22.04 ] + os: [ windows-latest,ubuntu-22.04, ubuntu-24.04 ] # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c83d2082..626889cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: test: name: test dev # The type of runner that the job will run on - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/algorithm/matrix/matrix.hpp b/algorithm/matrix/matrix.hpp index 6cf5659f..ef15f8fd 100644 --- a/algorithm/matrix/matrix.hpp +++ b/algorithm/matrix/matrix.hpp @@ -486,46 +486,33 @@ struct number : public Expression> { // work function, computing this expression at position i, import for lazy computing - T value(size_t i, size_t j) const { return this->num; } + T value(size_t i, size_t j) const { return this->num;} + //before invoke, invoke the ~number // 感觉是优化错误 size_t rows() const { return 0x3f3f3f3f; } size_t cols() const { return 0x3f3f3f3f; } - }; +template +static number make_number(T t){ + return number(t); +} + template inline EXPRESSION::BinaryOp operator+(const Expression &lhs, const Expression &rhs) { return expToBinaryOp(lhs, rhs); } -template -inline EXPRESSION::BinaryOp> -operator+(const Expression &lhs, const T2 &rhs) { - return expToBinaryOp(lhs, number(rhs)); -} - -template -inline EXPRESSION::BinaryOp, T2> -operator+(const T1 &lhs, const Expression &rhs) { - return expToBinaryOp(rhs, lhs); -} - /** * matrix + matrix, must equal. * * input mat1,mat2 and will_return's type is same. * */ -template -inline EXPRESSION::BinaryOp, T2> -operator-(const T1 &lhs, const Expression &rhs) { - return expToBinaryOp(number(lhs * -1), rhs); -} - /** * matrix - matrix, must equal. * input mat1,mat2 and will_return's type is same. @@ -536,12 +523,6 @@ operator-(const Expression &lhs, const Expression &rhs) { return expToBinaryOp(lhs, rhs); } -template -inline EXPRESSION::BinaryOp> -operator-(const Expression &lhs, const T2 &rhs) { - return expToBinaryOp(lhs, number(rhs)); -} - /** * matrix * number, need T1 can * T2 diff --git a/algorithm/matrix/matrix_test.cpp b/algorithm/matrix/matrix_test.cpp index c75939de..ee0cfb60 100644 --- a/algorithm/matrix/matrix_test.cpp +++ b/algorithm/matrix/matrix_test.cpp @@ -379,8 +379,8 @@ TEST_CASE("operator plus", "[test_3]") { m25 = m2 + m5; Matrix m36{m3 + m6}; Matrix temp = m1 + m4 + m7; - Matrix temp2 = m1 + m4 + m7 + 2; - Matrix temp4 = m1 + m4 + 2 + m7; + Matrix temp2 = m1 + m4 + m7 + make_number(2); + Matrix temp4 = m1 + m4 + make_number(2) + m7; CHECK(Matrix::inside_equal(m1 + m4, m7)); CHECK(Matrix::inside_equal(m14, m7)); CHECK(Matrix::inside_equal(m2 + m5, m8));