Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .circleci/config.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10

# Maintain dependencies for git submodules
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- master
- 'release/*'
pull_request:
branches:
- master
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
build_type: [Debug, Release]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++

- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..

- name: Build
run: |
cd build
make

- name: Run tests
run: |
cd build
./test/testmain
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@

/.idea/
/cmake-*/
/build-*/
/test/catch.hpp

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "deps/fbitset"]
path = deps/fbitset
url = https://github.com/tschijnmo/fbitset
url = https://github.com/DrudgeCAS/fbitset
12 changes: 0 additions & 12 deletions .ycm_extra_conf.py

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://circleci.com/gh/tschijnmo/libparenth.svg?style=shield)](https://circleci.com/gh/tschijnmo/libparenth)
[![CI](https://github.com/DrudgeCAS/libparenth/actions/workflows/ci.yml/badge.svg)](https://github.com/DrudgeCAS/libparenth/actions/workflows/ci.yml)

# libparenth
Fast searching for optimal parenthesization of tensor contractions
19 changes: 10 additions & 9 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Download the Catch2 single header.
# Fetch Catch2 v3.11.0
include(FetchContent)

file(DOWNLOAD
"https://github.com/catchorg/Catch2/releases/download/v2.0.1/catch.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/catch.hpp"
)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.11.0
)

include_directories(testmain
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
FetchContent_MakeAvailable(Catch2)

# The main test driver.
add_executable(testmain
testmain.cpp
matrixchain.cpp
)
Comment on lines 13 to 15
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMakeLists.txt no longer includes testmain.cpp in the add_executable call, but the file still exists in the repository. Since the file now only contains comments and Catch2::Catch2WithMain provides the main function, testmain.cpp should either be:

  1. Removed from the repository entirely (since it's not being used), or
  2. Added back to the sources list if it serves a purpose

The current state where the file exists but isn't compiled is inconsistent and may cause confusion.

Copilot uses AI. Check for mistakes.

target_link_libraries(testmain PRIVATE Catch2::Catch2WithMain)
14 changes: 12 additions & 2 deletions test/matrixchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
*/

#include <initializer_list>
#include <sstream>
#include <vector>

#include <catch.hpp>

#include <libparenth.hpp>

// Disable Catch2's range detection for fbitset by providing stream insertion operator
namespace fbitset {
template<int N>
inline std::ostream& operator<<(std::ostream& os, const Fbitset<N>& fs) {
os << "Fbitset<" << N << ">{count=" << fs.count() << "}";
return os;
}
}
Comment on lines +19 to +25
Copy link

Copilot AI Nov 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stream insertion operator is being added to the fbitset namespace, which modifies a third-party library's namespace. This is generally not recommended as it can lead to ODR (One Definition Rule) violations if the fbitset library also defines this operator, or if multiple translation units define it differently.

A better approach would be to define this operator in an anonymous namespace or in a custom namespace specific to your tests. Alternatively, consider whether this could be contributed to the fbitset library itself if it's genuinely useful.

Copilot uses AI. Check for mistakes.

#include <catch2/catch_test_macros.hpp>

using namespace libparenth;

TEST_CASE("A simple chain product of three matrices can be parenthesized")
Expand Down
10 changes: 2 additions & 8 deletions test/testmain.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>

int main(int argc, char* argv[])
{
int result = Catch::Session().run(argc, argv);
return result;
}
// Main test runner is provided by Catch2::Catch2WithMain
// This file is kept for potential future custom main() if needed