Skip to content

Commit

Permalink
Fix MacOS segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Aug 7, 2023
1 parent 5cbe302 commit 8abb36b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 0 additions & 21 deletions examples/example-array-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,42 @@

namespace lrc = librapid;

template<typename... Args>
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<int> 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<int> 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<int> leftVector(lrc::Shape({5}));
lrc::Array<int> 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;
Expand Down

0 comments on commit 8abb36b

Please sign in to comment.