From 8abb36bc9b041171847c52a6ef8129cf717f28d0 Mon Sep 17 00:00:00 2001 From: Toby Davis Date: Sun, 6 Aug 2023 23:17:01 -0700 Subject: [PATCH] Fix MacOS segfault --- .github/workflows/continuous-integration.yaml | 5 ----- examples/example-array-1.cpp | 21 ------------------- 2 files changed, 26 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 59e9a369..b60fce27 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -298,11 +298,6 @@ jobs: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} - - name: Run example-array-1 (Debug) - run: | - cd buildDebug - ./examples/example-array-1 - - name: Run Tests (Debug) run: | cd buildDebug diff --git a/examples/example-array-1.cpp b/examples/example-array-1.cpp index 4dfa22aa..4209c2dd 100644 --- a/examples/example-array-1.cpp +++ b/examples/example-array-1.cpp @@ -2,63 +2,42 @@ namespace lrc = librapid; -template -void printHelper(Args... args) { - fmt::print(args...); - std::cout << std::flush; // Flush the output buffer -} - auto main() -> int { fmt::print("LibRapid Example -- Array 1\n"); // Create a vector with 10 elements - printHelper("Creating Vector"); lrc::Array myVector(lrc::Shape({5})); // Fill the vector with values - printHelper("Filling Vector"); for (int i = 0; i < 5; i++) { myVector[i] = i; } // Print the vector - printHelper("Printing Vector"); fmt::print("Vector: {}\n", myVector); // Create a matrix with 3x5 elements - printHelper("Creating Matrix"); lrc::Array myMatrix(lrc::Shape({3, 5})); - printHelper("Filling Matrix"); for (int i = 0; i < 3; i++) { for (int j = 0; j < 5; j++) { myMatrix[i][j] = i * 5 + j; } } - printHelper("Printing Matrix"); fmt::print("Matrix:\n{}\n", myMatrix); // Do some simple calculations - printHelper("Adding Vectors"); fmt::print("My Vector + My Vector: {}\n", myVector + myVector); - - printHelper("Adding Elements"); fmt::print("[0] + [4]: {}\n", myVector[0].get() + myVector[4].get()); fmt::print("\n"); - printHelper("Combined Operations"); fmt::print("M + M * M:\n{}\n", myMatrix + myMatrix * myMatrix); // Add a vector to a row of a matrix - printHelper("Vector + Matrix[2]"); fmt::print("My Vector + My matrix [2]: {}\n", myVector + myMatrix[2]); // Compare two arrays - printHelper("Creating Vectors"); lrc::Array leftVector(lrc::Shape({5})); lrc::Array rightVector(lrc::Shape({5})); - printHelper("Comma Initializing Vectors"); leftVector << 1, 2, 3, 4, 5; rightVector << 5, 4, 3, 2, 1; - printHelper("Less Than"); fmt::print("{} < {} --> {}\n", leftVector, rightVector, leftVector < rightVector); - printHelper("Greater or Equal"); fmt::print("{} >= {} --> {}\n", leftVector, rightVector, leftVector >= rightVector); return 0;