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
5 changes: 2 additions & 3 deletions ai_git_helpers/commit_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ci"
}

MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.2")
MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.5")
MAX_OUTPUT_TOKENS = 200
TEMPERATURE = 0.2
SUBJECT_MAX = 72
Expand Down Expand Up @@ -294,8 +294,7 @@ def main():
context=context
)},
],
max_output_tokens=MAX_OUTPUT_TOKENS,
temperature=TEMPERATURE,
max_output_tokens=MAX_OUTPUT_TOKENS
)

message = (response.output_text or "").strip()
Expand Down
2 changes: 1 addition & 1 deletion ai_git_helpers/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
from openai import OpenAI

MODEL = "gpt-5.2"
MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.5")

SYSTEM_PROMPT = """
You are helping maintain the R package RcppAlgos. You are an expert C++
Expand Down
2 changes: 1 addition & 1 deletion ai_git_helpers/pr_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
from openai import OpenAI

MODEL = "gpt-5.2"
MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.5")

SYSTEM_PROMPT = """
You are helping maintain the R package RcppAlgos. You are an expert C++
Expand Down
6 changes: 2 additions & 4 deletions ai_git_helpers/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

MAX_FILE_BYTES = 200_000
MAX_DIFF_BYTES_TOTAL = 400_000
MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.2")
MODEL = os.getenv("AI_REVIEW_MODEL", "gpt-5.5")
MAX_OUTPUT_TOKENS = 4000
TEMPERATURE = 0.2

SYSTEM_PROMPT = """\
You are an expert C++ software engineer with deep knowledge of
Expand Down Expand Up @@ -467,8 +466,7 @@ def main():
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_content},
],
max_output_tokens=MAX_OUTPUT_TOKENS,
temperature=TEMPERATURE,
max_output_tokens=MAX_OUTPUT_TOKENS
)

text = (response.output_text or "").strip()
Expand Down
13 changes: 12 additions & 1 deletion src/PartitionsCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,19 @@ int PartitionsCount(const std::vector<int> &Reps,
} else if (part.ptype == PartitionType::CompMultiset) {
// N.B. With PartitionType::Multiset we use the default
// IsComp = false. Below, we set IsComp = true

// CountPartsMultiset() uses the final flag to decide whether zeros
// should participate in the permutation count. When the user supplied
// zero, this agrees with the usual weak/non-weak distinction. When
// zero was not supplied, any zeros in startZ are only internal padding
// introduced by the partition counting machinery, and the
// corresponding compositions should be counted as fixed-length
// arrangements. In that case, use the weak-style permutation count
// so NumPermsWithRep() does not drop those padded positions.
const bool countZeros = !part.includeZero || part.isWeak;

part.count = part.solnExist ?
CountPartsMultiset(Reps, part.startZ, true, part.isWeak) : 0;
CountPartsMultiset(Reps, part.startZ, true, countZeros) : 0;
return 1;
} else if (part.ptype == PartitionType::PrmMultiset) {
// See note above under CompMultiset
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/testPermuteGeneral.R
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,12 @@ test_that("permuteCount produces correct results under partition constraints", {
),
compositionsCount(table(c(rep(0L, 5), 1:100)), weak = TRUE)
)

expect_equal(
permuteCount(
1:15, 8, freqs = rep(5:1, each = 3), constraintFun = "sum",
comparisonFun = "==", limitConstraints = 40
),
compositionsCount(1:15, 8, freqs = rep(5:1, each = 3), target = 40)
)
})
Loading