LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::anonymous_namespace{bigint_combinatorics.cpp} 命名空间参考

函数

Result< BigInt > finish_combinatorial (BigInt value, ComputationContext &context, const char *operation)
Result< unsigned int > kernel_argument (const BigInt &value, const char *operation)
BigInt require_combinatorial (Result< BigInt > result)
Result< void > reserve_product (const BigInt &largest_factor, unsigned int factors, ComputationContext &context, const char *operation)

函数说明

◆ finish_combinatorial()

Result< BigInt > LMCAS::anonymous_namespace{bigint_combinatorics.cpp}::finish_combinatorial ( BigInt value,
ComputationContext & context,
const char * operation )

在文件 bigint_combinatorics.cpp 第 35 行定义.

36 {
37 auto access = context.consume_steps(0, operation);
38 if (!access) {
39 return Result<BigInt>::failure(access.error());
40 }
41 auto bits = context.require_integer_bits(value.bit_length(), operation);
42 if (!bits) {
43 return Result<BigInt>::failure(bits.error());
44 }
45 return Result<BigInt>::success(std::move(value));
46}
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(T value)
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
const std::string const ExprPtr & value

引用了 LMCAS::context, LMCAS::Result< T >::failure(), finish_combinatorial(), LMCAS::Result< T >::success() , 以及 LMCAS::value.

被这些函数引用 finish_combinatorial().

函数调用图:
这是这个函数的调用关系图:

◆ kernel_argument()

Result< unsigned int > LMCAS::anonymous_namespace{bigint_combinatorics.cpp}::kernel_argument ( const BigInt & value,
const char * operation )

在文件 bigint_combinatorics.cpp 第 8 行定义.

8 {
9 if (value.is_negative()) {
11 CasErrc::DomainError, "combinatorial arguments must be nonnegative", operation);
12 }
13 const auto converted = value.try_to_uint64();
14 if (!converted || *converted > std::numeric_limits<unsigned int>::max()) {
16 CasErrc::ResourceLimit, "argument exceeds the LMMP unsigned kernel range", operation);
17 }
18 return static_cast<unsigned int>(*converted);
19}

引用了 LMCAS::DomainError, LMCAS::Result< T >::failure(), kernel_argument(), LMCAS::ResourceLimit , 以及 LMCAS::value.

被这些函数引用 kernel_argument().

函数调用图:
这是这个函数的调用关系图:

◆ require_combinatorial()

BigInt LMCAS::anonymous_namespace{bigint_combinatorics.cpp}::require_combinatorial ( Result< BigInt > result)

在文件 bigint_combinatorics.cpp 第 48 行定义.

48 {
49 if (result) {
50 return std::move(result.value());
51 }
52 if (result.error().code == CasErrc::DomainError) {
53 throw std::domain_error(result.error().message);
54 }
55 if (result.error().code == CasErrc::ResourceLimit) {
56 throw std::length_error(result.error().message);
57 }
58 throw std::runtime_error(result.error().message);
59}
CasError & error()
std::string message

引用了 LMCAS::CasError::code, LMCAS::DomainError, LMCAS::Result< T >::error(), LMCAS::CasError::message, require_combinatorial(), LMCAS::ResourceLimit , 以及 LMCAS::Result< T >::value().

被这些函数引用 require_combinatorial().

函数调用图:
这是这个函数的调用关系图:

◆ reserve_product()

Result< void > LMCAS::anonymous_namespace{bigint_combinatorics.cpp}::reserve_product ( const BigInt & largest_factor,
unsigned int factors,
ComputationContext & context,
const char * operation )

在文件 bigint_combinatorics.cpp 第 21 行定义.

22 {
23 auto steps = context.consume_steps(factors, operation);
24 if (!steps) {
25 return steps;
26 }
27 const auto factor_bits = largest_factor.bit_length();
28 if (factors != 0 && factor_bits > std::numeric_limits<std::size_t>::max() / factors) {
30 "combinatorial bit bound overflows", operation);
31 }
32 return context.require_integer_bits(factor_bits * factors, operation);
33}

引用了 LMCAS::context, LMCAS::Result< T >::failure(), reserve_product(), LMCAS::ResourceLimit , 以及 LMCAS::steps.

被这些函数引用 reserve_product().

函数调用图:
这是这个函数的调用关系图: