Skip to content
Open
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
3 changes: 1 addition & 2 deletions .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
CC: gcc
CXX: g++
CXXFLAGS: -fdiagnostics-color -O2
LD_LIBRARY_PATH: /usr/local/lib
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -54,7 +53,7 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: "1"
version: "1.10"

- uses: julia-actions/cache@v2

Expand Down
40 changes: 2 additions & 38 deletions .github/workflows/docs-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
CC: gcc
CXX: g++
CXXFLAGS: -fdiagnostics-color -O2
LD_LIBRARY_PATH: /usr/local/lib
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -55,7 +54,7 @@ jobs:

- uses: julia-actions/setup-julia@v2
with:
version: "1"
version: "1.10"

- uses: julia-actions/cache@v2

Expand All @@ -72,39 +71,4 @@ jobs:
run: |
julia --project=docs --color=yes docs/make.jl
env:
DOCS_DEPLOY: ${{ github.event.pull_request.head.repo.full_name == github.repository }}

# Only upload artifact for fork PRs
- name: Upload documentation artifact
if: github.event.pull_request.head.repo.full_name != github.repository
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/build
if-no-files-found: error
retention-days: 7

# Generate comment for artifact build
# - uses: marocchino/sticky-pull-request-comment@v2
# if: github.event.pull_request.head.repo.full_name != github.repository
# with:
# header: docs-preview
# message: |
# 📦 Documentation built for this PR.
#
# Since this PR originates from a fork, a preview deployment is not available.
#
# Download the artifact from this workflow run:
# ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

- uses: marocchino/sticky-pull-request-comment@v2
if: github.event.pull_request.head.repo.full_name == github.repository
env:
PR_NUMBER: ${{ github.event.number }}
with:
header: docs-preview
message: |
🚀 Documentation preview deployed.

Preview URL:
https://libsemigroups.github.io/Semigroups.jl/previews/PR${{ env.PR_NUMBER }}/
DOCS_DEPLOY: false
104 changes: 104 additions & 0 deletions deps/src/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
# BasedOnStyle: LLVM
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CompactNamespaces: false
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: ['RANGES_FOR', 'FOREACH']
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 200
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 100
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++14
TabWidth: 2
UseTab: Never
...

1 change: 1 addition & 0 deletions deps/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message(STATUS "libsemigroups libraries: ${LIBSEMIGROUPS_LIBRARIES}")
# Build the shared library
add_library(libsemigroups_julia SHARED
libsemigroups_julia.cpp
bmat8.cpp
constants.cpp
report.cpp
runner.cpp
Expand Down
135 changes: 135 additions & 0 deletions deps/src/bmat8.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
//
// Semigroups.jl
// Copyright (C) 2026 James D. Mitchell
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

#include "libsemigroups_julia.hpp"

#include <libsemigroups/bmat8.hpp>

// Disable CxxWrap mirroring for BMat8
namespace jlcxx {
template <>
struct IsMirroredType<libsemigroups::BMat8> : std::false_type {};
} // namespace jlcxx

namespace libsemigroups_julia {

void define_bmat8(jl::Module& m) {
using namespace libsemigroups;

auto type = m.add_type<BMat8>("BMat8");

type.constructor<>();

////////////////////////////////////////////////////////////////////////
// BMat8 mem fns
////////////////////////////////////////////////////////////////////////

m.method("BMat8", [](uint64_t mat) -> BMat8 { return BMat8(mat); });

type.method("add", [](BMat8 const& self, BMat8 const& that) {
return self + that;
});
type.method("add!", [](BMat8& self, BMat8 const& that) { self += that; });
type.method("at", [](BMat8 const& self, size_t r) {
return bmat8::to_vector(self.at(r));
});
type.method("at", [](BMat8 const& self, size_t r, size_t c) -> bool {
return self.at(r, c);
});
type.method("copy", [](BMat8 const& self) { return BMat8(self); });
type.method("degree", [](BMat8 const& self) { return 8; });
type.method("hash_value", [](BMat8 const& x) { return Hash<BMat8>()(x); });
type.method("is_greater",
[](BMat8 const& a, BMat8 const& b) -> bool { return a > b; });
type.method("is_greater_equal",
[](BMat8 const& a, BMat8 const& b) -> bool { return a >= b; });
type.method("is_equal",
[](BMat8 const& a, BMat8 const& b) -> bool { return a == b; });
type.method("swap", &BMat8::swap);
type.method("is_less",
[](BMat8 const& a, BMat8 const& b) -> bool { return a < b; });
type.method("is_less_equal",
[](BMat8 const& a, BMat8 const& b) -> bool { return a <= b; });
type.method("is_not_equal",
[](BMat8 const& a, BMat8 const& b) -> bool { return a != b; });

type.method(
"multiply_bmat8_bmat8",
[](BMat8 const& self, BMat8 const& that) { return self * that; });

type.method("multiply_bmat8_bool",
[](BMat8 const& self, bool val) { return self * val; });
type.method("multiply_bool_bmat8",
[](bool val, BMat8 const& self) { return val * self; });
// type.method("multiply_bmat8_bmat8!",
// [](BMat8& self, BMat8 const& that) { self *= that; });
// type.method("multiply_bmat8_bool!",
// [](BMat8& self, bool scalar) { self *= scalar; });

// These last two are a little out of pattern from those above.
type.method("bmat8_setitem", [](BMat8& self, size_t r, size_t c, bool val) {
self.at(r, c) = val;
});

type.method("bmat8_setrow",
[](BMat8& self, size_t r, jlcxx::ArrayRef<uint8_t> row) {
for (size_t c = 0; c < row.size(); c++) {
self.at(r, c) = row[c];
}
});

////////////////////////////////////////////////////////////////////////
// BMat8 helpers in libsemigroups namespace
////////////////////////////////////////////////////////////////////////

type.method("to_human_readable_repr",
[](BMat8 const& x) { return to_human_readable_repr(x, "[]"); });
type.method("to_int", &BMat8::to_int);

////////////////////////////////////////////////////////////////////////
// BMat8 helpers in bmat8 namespace
////////////////////////////////////////////////////////////////////////

m.method("bmat8_col_space_basis", &bmat8::col_space_basis);
m.method("bmat8_col_space_size",
[](BMat8 const& x) { return bmat8::col_space_size(x); });
m.method("bmat8_is_regular_element",
[](BMat8 const& x) { return bmat8::is_regular_element(x); });
m.method("bmat8_minimum_dim",
[](BMat8 const& x) { return bmat8::minimum_dim(x); });
m.method("bmat8_number_of_cols",
[](BMat8 const& x) { return bmat8::number_of_cols(x); });
m.method("bmat8_number_of_rows",
[](BMat8 const& x) { return bmat8::number_of_rows(x); });
m.method("bmat8_one", &bmat8::one<BMat8>);
m.method("bmat8_random", [](size_t dim) { return bmat8::random(dim); });
m.method("bmat8_row_space_basis", &bmat8::row_space_basis);
m.method("bmat8_row_space_size",
[](BMat8 const& x) { return bmat8::row_space_size(x); });
m.method("bmat8_rows", [](BMat8 const& x) {
std::vector<std::vector<bool>> result;
for (auto row : bmat8::rows(x)) {
result.push_back(bmat8::to_vector(row));
}
return result;
});
m.method("bmat8_transpose",
[](BMat8 const& x) { return bmat8::transpose(x); });

} // define_bmat8
} // namespace libsemigroups_julia
Loading
Loading